Skip to content

Commit

Permalink
Problem: windows build in CI fails (crypto-org-chain#868)
Browse files Browse the repository at this point in the history
* Problem: windows build in CI fails

Solution:
- patch grocksdb to remove binding of not exported apis
- add workflow to test windows build in PR

* use crypto-org-chain fork
  • Loading branch information
yihuang committed Feb 15, 2023
1 parent 2611ea2 commit cd726ec
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 39 deletions.
22 changes: 20 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ jobs:
set +e
(git diff --no-ext-diff --exit-code)
echo "name=changed::$?" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: steps.changes.outputs.changed == 1
with:
name: gomod2nix.toml
Expand Down Expand Up @@ -190,11 +190,29 @@ jobs:
set +e
(git diff --no-ext-diff --exit-code)
echo "name=changed::$?" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: steps.changes.outputs.changed == 1
with:
name: contracts_out
path: ./contracts/out
if-no-files-found: ignore
- if: steps.changes.outputs.changed == 1
run: echo "Working directory is dirty" && exit 1

build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: setup msys2
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: false
install: git msys2-devel base-devel mingw-w64-x86_64-gcc mingw-w64-x86_64-go mingw-w64-x86_64-jq mingw-w64-x86_64-dlfcn
- name: get rocksdb & build
env:
PLATFORM: Windows_x86_64
shell: msys2 {0}
run: |
./scripts/build-windows.sh
./build/cronosd.exe version --long
28 changes: 4 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,36 +144,16 @@ jobs:
- name: setup msys2
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
msystem: MINGW64
update: false
install: git msys2-devel base-devel mingw-w64-x86_64-gcc mingw-w64-x86_64-rocksdb mingw-w64-x86_64-go mingw-w64-x86_64-jq mingw-w64-x86_64-dlfcn
install: git msys2-devel base-devel mingw-w64-x86_64-gcc mingw-w64-x86_64-go mingw-w64-x86_64-jq mingw-w64-x86_64-dlfcn
- name: get rocksdb & build
env:
PLATFORM: Windows_x86_64
shell: msys2 {0}
run: |
uname -a
export GOROOT=/mingw64/lib/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
export CGO_CFLAGS="-I/mingw64/include/rocksdb"
export CGO_LDFLAGS="-L/mingw64/lib -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy -llz4 -lzstd"
echo $PATH
go version
wget https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-rocksdb-6.26.1-1-any.pkg.tar.zst
pacman -U mingw-w64-x86_64-rocksdb-6.26.1-1-any.pkg.tar.zst --noconfirm
COSMOS_BUILD_OPTIONS=rocksdb make build
ls -la ./build/
mv ./build/cronosd ./build/cronosd.exe
cp /mingw64/bin/libbz2-1.dll ./build
cp /mingw64/bin/libgcc_s_seh-1.dll ./build
cp /mingw64/bin/liblz4.dll ./build
cp /mingw64/bin/librocksdb.dll ./build
cp /mingw64/bin/libsnappy.dll ./build
cp /mingw64/bin/libstdc++-6.dll ./build
cp /mingw64/bin/libwinpthread-1.dll ./build
cp /mingw64/bin/libzstd.dll ./build
cp /mingw64/bin/zlib1.dll ./build
./scripts/build-windows.sh
./build/cronosd.exe version --long
cd ./build
tar cvfz ../cronos.tar.gz *
cd ..
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/sims.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jobs:
echo ${{ job.status }} > status_build.txt
- name: Upload file status_build.txt as an artifact
if: github.event_name == 'issue_comment'
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v3
with:
name: pass_status_build
path: status_build.txt
Expand All @@ -146,7 +146,7 @@ jobs:
echo ${{ job.status }} > status_install.txt
- name: Upload file status_install.txt as an artifact
if: github.event_name == 'issue_comment'
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v3
with:
name: pass_status_install
path: status_install.txt
Expand Down Expand Up @@ -201,7 +201,7 @@ jobs:
echo ${{ job.status }} > status_sim1.txt
- name: Upload file status_sim1.txt as an artifact
if: github.event_name == 'issue_comment'
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v3
with:
name: pass_status_sim1
path: status_sim1.txt
Expand Down Expand Up @@ -256,7 +256,7 @@ jobs:
echo ${{ job.status }} > status_sim2.txt
- name: Upload file status_sim2.txt as an artifact
if: github.event_name == 'issue_comment'
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v3
with:
name: pass_status_sim2
path: status_sim2.txt
Expand Down Expand Up @@ -311,7 +311,7 @@ jobs:
echo ${{ job.status }} > status_sim3.txt
- name: Upload file status_sim3.txt as an artifact
if: github.event_name == 'issue_comment'
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v3
with:
name: pass_status_sim3
path: status_sim3.txt
Expand Down Expand Up @@ -366,7 +366,7 @@ jobs:
echo ${{ job.status }} > status_sim4.txt
- name: Upload file status_sim4.txt as an artifact
if: github.event_name == 'issue_comment'
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v3
with:
name: pass_status_sim4
path: status_sim4.txt
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: 'Tar debug files'
if: failure()
run: tar cfz debug_files.tar.gz -C "${TMPDIR-/tmp}/pytest-of-runner" .
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: failure()
with:
name: debug-files
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ replace (
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
// use replace to force update grocksdb dependency in tm-db
github.com/linxGnu/grocksdb => github.com/linxGnu/grocksdb v1.7.14
github.com/linxGnu/grocksdb => github.com/crypto-org-chain/grocksdb v1.7.11-0.20230214093311-ba44112a39c1
github.com/miguelmota/go-ethereum-hdwallet => github.com/crypto-org-chain/go-ethereum-hdwallet v0.1.2

github.com/peggyjv/gravity-bridge/module/v2 => github.com/crypto-org-chain/gravity-bridge/module/v2 v2.0.1-0.20230126051749-d984b1562242
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ github.com/crypto-org-chain/go-ethereum v1.10.19-deepcopy-jumptable/go.mod h1:IJ
github.com/crypto-org-chain/go-ethereum-hdwallet v0.1.2 h1:Qu2GMavGHCcomdVWmZej76JpOO6uvII6IpPDdJUG+Qo=
github.com/crypto-org-chain/gravity-bridge/module/v2 v2.0.1-0.20230126051749-d984b1562242 h1:sh/yUvdmPXe2h7iDvjy5CeTspnaE7ZJpX8qioulhsbg=
github.com/crypto-org-chain/gravity-bridge/module/v2 v2.0.1-0.20230126051749-d984b1562242/go.mod h1:pD1kWIBJBBeTIk+9oVg0DVxK/2wMd5EgFfBxGTRyuUs=
github.com/crypto-org-chain/grocksdb v1.7.11-0.20230214093311-ba44112a39c1 h1:VClcM7YN+5SA46WPDWQVAycbegrTgVPv/wD895OXiAk=
github.com/crypto-org-chain/grocksdb v1.7.11-0.20230214093311-ba44112a39c1/go.mod h1:pY55D0o+r8yUYLq70QmhdudxYvoDb9F+9puf4m3/W+U=
github.com/crypto-org-chain/tm-db v0.6.8-0.20230118040049-14dc6b00a5b3 h1:msHkCjNEUSqknqzjBCQscfxVm1ifyxoRBb0goZKqGCU=
github.com/crypto-org-chain/tm-db v0.6.8-0.20230118040049-14dc6b00a5b3/go.mod h1:JOMwkZce6XmnsAfSRa3VSA/e2tV1R2y7lqljiw5STlQ=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
Expand Down Expand Up @@ -678,8 +680,6 @@ github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6
github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg=
github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
github.com/linxGnu/grocksdb v1.7.14 h1:8lMZzyWeNP5lI0BIppX05DzmQzXj/Tgu82bgWYtowLY=
github.com/linxGnu/grocksdb v1.7.14/go.mod h1:pY55D0o+r8yUYLq70QmhdudxYvoDb9F+9puf4m3/W+U=
github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4=
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
Expand Down
6 changes: 3 additions & 3 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,9 @@ schema = 3
version = "v0.1.0"
hash = "sha256-wQqGTtRWsfR9n0O/SXHVgECebbnNmHddxJIbG63OJBQ="
[mod."github.com/linxGnu/grocksdb"]
version = "v1.7.14"
hash = "sha256-nMqj1pL7bhydPqL8VZMnQEX4KpEeq1COXIjcwkeFW9M="
replaced = "github.com/linxGnu/grocksdb"
version = "v1.7.11-0.20230214093311-ba44112a39c1"
hash = "sha256-aNRJ5Ihlj90lz/VBSYVVpw6MElfTkivitmrmHGvQk3A="
replaced = "github.com/crypto-org-chain/grocksdb"
[mod."github.com/magiconair/properties"]
version = "v1.8.6"
hash = "sha256-xToSfpuePctkTdhJtsuKIEkXwfMZbnkFT98ahIfd4wY="
Expand Down
23 changes: 23 additions & 0 deletions scripts/build-windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
uname -a
export GOROOT=/mingw64/lib/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
export CGO_CFLAGS="-I/mingw64/include/rocksdb"
export CGO_LDFLAGS="-L/mingw64/lib -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy -llz4 -lzstd"
echo $PATH
go version
wget https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-rocksdb-7.9.2-1-any.pkg.tar.zst
pacman -U mingw-w64-x86_64-rocksdb-7.9.2-1-any.pkg.tar.zst --noconfirm
COSMOS_BUILD_OPTIONS=rocksdb make build
ls -la ./build/
mv ./build/cronosd ./build/cronosd.exe
cp /mingw64/bin/libbz2-1.dll ./build
cp /mingw64/bin/libgcc_s_seh-1.dll ./build
cp /mingw64/bin/liblz4.dll ./build
cp /mingw64/bin/librocksdb.dll ./build
cp /mingw64/bin/libsnappy.dll ./build
cp /mingw64/bin/libstdc++-6.dll ./build
cp /mingw64/bin/libwinpthread-1.dll ./build
cp /mingw64/bin/libzstd.dll ./build
cp /mingw64/bin/zlib1.dll ./build

0 comments on commit cd726ec

Please sign in to comment.