|
| 1 | +name: Build binaries on multi platform |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - develop |
| 6 | + - "release_*" |
| 7 | + |
| 8 | +jobs: |
| 9 | + b_windows: |
| 10 | + runs-on: [ self-hosted, Windows ] |
| 11 | + |
| 12 | + steps: |
| 13 | + - name: Checkout code |
| 14 | + uses: actions/checkout@v5 |
| 15 | + |
| 16 | + - name: Cache dependencies |
| 17 | + id: cache-deps |
| 18 | + uses: actions/cache@v4 |
| 19 | + with: |
| 20 | + path: .\deps |
| 21 | + key: dependencies-win-${{ runner.arch }}-${{ hashFiles('scripts/install_deps.ps1') }} |
| 22 | + restore-keys: dependencies-win-${{ runner.arch }}- |
| 23 | + |
| 24 | + - name: Installing dependencies |
| 25 | + if: steps.cache-deps.outputs.cache-hit != 'true' |
| 26 | + shell: powershell |
| 27 | + run: .\scripts\install_deps.ps1 |
| 28 | + |
| 29 | + - name: Run build script |
| 30 | + shell: bash |
| 31 | + run: powershell.exe .github/workflows/build_win.ps1 |
| 32 | + |
| 33 | + - name: Upload artifact |
| 34 | + uses: actions/upload-artifact@v4 |
| 35 | + with: |
| 36 | + name: solc-windows |
| 37 | + path: build\solc\Release\solc.exe |
| 38 | + compression-level: 0 |
| 39 | + |
| 40 | + b_macos: |
| 41 | + runs-on: [ self-hosted, macOS ] |
| 42 | + |
| 43 | + steps: |
| 44 | + - name: Checkout code |
| 45 | + uses: actions/checkout@v5 |
| 46 | + |
| 47 | + - name: Run build script |
| 48 | + run: .github/workflows/build.sh |
| 49 | + |
| 50 | + - name: Upload artifact |
| 51 | + uses: actions/upload-artifact@v4 |
| 52 | + with: |
| 53 | + name: solc-macos |
| 54 | + path: build/solc/solc |
| 55 | + compression-level: 0 |
| 56 | + |
| 57 | + b_linux: |
| 58 | + runs-on: [ self-hosted, Linux, for-linux ] |
| 59 | + |
| 60 | + env: |
| 61 | + CMAKE_OPTIONS: -DCMAKE_BUILD_TYPE=Release -DUSE_Z3_DLOPEN=ON -DUSE_CVC4=OFF -DSOLC_STATIC_STDLIBS=ON |
| 62 | + MAKEFLAGS: -j 10 |
| 63 | + CPUs: 10 |
| 64 | + |
| 65 | + container: |
| 66 | + image: solbuildpackpusher/solidity-buildpack-deps@sha256:84a1fb8771236e8d9aa5c615a425b8929e56a6e4f150a60078c8d74a1ceaa6c2 |
| 67 | + |
| 68 | + steps: |
| 69 | + - name: Checkout code |
| 70 | + uses: actions/checkout@v5 |
| 71 | + |
| 72 | + - name: Fix git safe directory |
| 73 | + run: git config --global --add safe.directory '*' |
| 74 | + |
| 75 | + - name: Run build script |
| 76 | + run: .github/workflows/build.sh |
| 77 | + |
| 78 | + - name: Upload artifact |
| 79 | + uses: actions/upload-artifact@v4 |
| 80 | + with: |
| 81 | + name: solc-linux |
| 82 | + path: build/solc/solc |
| 83 | + compression-level: 0 |
| 84 | + |
| 85 | + b_ems: |
| 86 | + runs-on: [ self-hosted, Linux, for-ems ] |
| 87 | + |
| 88 | + env: |
| 89 | + MAKEFLAGS: -j 10 |
| 90 | + CPUs: 5 |
| 91 | + |
| 92 | + container: |
| 93 | + image: solbuildpackpusher/solidity-buildpack-deps@sha256:c57f2bfb8c15d70fe290629358dd1c73dc126e3760f443b54764797556b887d4 |
| 94 | + |
| 95 | + steps: |
| 96 | + - name: Checkout code |
| 97 | + uses: actions/checkout@v5 |
| 98 | + |
| 99 | + - name: Fix git safe directory |
| 100 | + run: git config --global --add safe.directory '*' |
| 101 | + |
| 102 | + - name: Run build script |
| 103 | + run: .github/workflows/build_ems.sh |
| 104 | + |
| 105 | + - name: Upload artifact |
| 106 | + uses: actions/upload-artifact@v4 |
| 107 | + with: |
| 108 | + name: solc-ems |
| 109 | + path: upload/soljson.js |
| 110 | + compression-level: 0 |
| 111 | + |
| 112 | + upload-to-s3: |
| 113 | + needs: [ b_windows, b_macos, b_linux, b_ems ] |
| 114 | + runs-on: [ self-hosted, Linux ] |
| 115 | + steps: |
| 116 | + - name: Download all artifacts |
| 117 | + uses: actions/download-artifact@v4 |
| 118 | + with: |
| 119 | + path: artifacts |
| 120 | + |
| 121 | + - name: List all artifacts |
| 122 | + run: | |
| 123 | + ls -R artifacts/ |
| 124 | +
|
| 125 | + - name: Gather and rename binaries from dependent jobs |
| 126 | + run: | |
| 127 | + mkdir github/ |
| 128 | + cp artifacts/solc-linux/solc github/solc-static-linux |
| 129 | + cp artifacts/solc-macos/solc github/solc-macos |
| 130 | + cp artifacts/solc-windows/solc.exe github/solc-windows.exe |
| 131 | + cp artifacts/solc-ems/soljson.js github/soljson.js |
| 132 | + |
| 133 | + cd github |
| 134 | + tar --create --file ../github-binaries.tar * |
| 135 | +
|
| 136 | + - name: Rename binaries to solc-bin naming convention |
| 137 | + run: | |
| 138 | + full_version=$( |
| 139 | + github/solc-static-linux --version | |
| 140 | + sed -En 's/^Version: ([0-9.]+.*\+commit\.[0-9a-f]+(\.mod)?).*$/\1/p' |
| 141 | + ) |
| 142 | +
|
| 143 | + mkdir -p solc-bin/{linux-amd64,macosx-amd64,windows-amd64,bin} |
| 144 | +
|
| 145 | + mv github/solc-static-linux "solc-bin/linux-amd64/solc-linux-amd64-v${full_version}" |
| 146 | + mv github/solc-macos "solc-bin/macosx-amd64/solc-macosx-amd64-v${full_version}" |
| 147 | + mv github/solc-windows.exe "solc-bin/windows-amd64/solc-windows-amd64-v${full_version}.exe" |
| 148 | + mv github/soljson.js "solc-bin/bin/soljson-v${full_version}.js" |
| 149 | +
|
| 150 | + cd solc-bin/ |
| 151 | + tar --create --file ../solc-bin-binaries.tar * |
| 152 | +
|
| 153 | + - name: Upload to S3 |
| 154 | + env: |
| 155 | + S3_BUCKET_PROD: ${{ secrets.S3_BUCKET_PROD }} |
| 156 | + S3_BUCKET_TEST: ${{ secrets.S3_BUCKET_TEST }} |
| 157 | + run: | |
| 158 | + case "${GITHUB_REF_NAME}" in |
| 159 | + develop) bucket="${S3_BUCKET_PROD}" ;; |
| 160 | + release_*) bucket="${S3_BUCKET_TEST}" ;; |
| 161 | + esac |
| 162 | + |
| 163 | + aws s3 cp github-binaries.tar "s3://${bucket}/${{ github.sha }}/" --only-show-errors |
| 164 | + aws s3 cp solc-bin-binaries.tar "s3://${bucket}/${{ github.sha }}/" --only-show-errors |
0 commit comments