|
| 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: Prepare artifact for caching |
| 34 | + shell: bash |
| 35 | + run: | |
| 36 | + mkdir github/ |
| 37 | + cp build/solc/Release/solc.exe github/solc-windows.exe |
| 38 | +
|
| 39 | + - name: Save artifact to cache |
| 40 | + uses: actions/cache/save@v4 |
| 41 | + with: |
| 42 | + path: github/solc-windows.exe |
| 43 | + key: solc-windows-${{ github.run_id }} |
| 44 | + enableCrossOsArchive: true |
| 45 | + |
| 46 | + b_macos: |
| 47 | + runs-on: [ self-hosted, macOS ] |
| 48 | + |
| 49 | + env: |
| 50 | + CMAKE_BUILD_TYPE: Release |
| 51 | + CMAKE_OPTIONS: -DCMAKE_OSX_ARCHITECTURES:STRING=x86_64;arm64 |
| 52 | + TERM: xterm |
| 53 | + MAKEFLAGS: -j5 |
| 54 | + CPUs: 5 |
| 55 | + |
| 56 | + steps: |
| 57 | + - name: Checkout code |
| 58 | + uses: actions/checkout@v5 |
| 59 | + |
| 60 | + - name: Run build script |
| 61 | + shell: bash -el {0} |
| 62 | + run: .github/workflows/build.sh |
| 63 | + |
| 64 | + - name: Prepare artifact for caching |
| 65 | + run: | |
| 66 | + mkdir github/ |
| 67 | + cp build/solc/solc github/solc-macos |
| 68 | +
|
| 69 | + - name: Save artifact to cache |
| 70 | + uses: actions/cache/save@v4 |
| 71 | + with: |
| 72 | + path: github/solc-macos |
| 73 | + key: solc-macos-${{ github.run_id }} |
| 74 | + enableCrossOsArchive: true |
| 75 | + |
| 76 | + b_linux: |
| 77 | + runs-on: [ self-hosted, Linux, for-linux ] |
| 78 | + |
| 79 | + env: |
| 80 | + CMAKE_OPTIONS: -DCMAKE_BUILD_TYPE=Release -DUSE_Z3_DLOPEN=ON -DUSE_CVC4=OFF -DSOLC_STATIC_STDLIBS=ON |
| 81 | + MAKEFLAGS: -j 10 |
| 82 | + CPUs: 10 |
| 83 | + |
| 84 | + container: |
| 85 | + image: solbuildpackpusher/solidity-buildpack-deps@sha256:84a1fb8771236e8d9aa5c615a425b8929e56a6e4f150a60078c8d74a1ceaa6c2 |
| 86 | + |
| 87 | + steps: |
| 88 | + - name: Checkout code |
| 89 | + uses: actions/checkout@v5 |
| 90 | + |
| 91 | + - name: Fix git safe directory |
| 92 | + run: git config --global --add safe.directory '*' |
| 93 | + |
| 94 | + - name: Run build script |
| 95 | + run: .github/workflows/build.sh |
| 96 | + |
| 97 | + - name: Prepare artifact for caching |
| 98 | + run: | |
| 99 | + mkdir github/ |
| 100 | + cp build/solc/solc github/solc-static-linux |
| 101 | +
|
| 102 | + - name: Save artifact to cache |
| 103 | + uses: actions/cache/save@v4 |
| 104 | + with: |
| 105 | + path: github/solc-static-linux |
| 106 | + key: solc-linux-${{ github.run_id }} |
| 107 | + |
| 108 | + b_ems: |
| 109 | + runs-on: [ self-hosted, Linux, for-ems ] |
| 110 | + |
| 111 | + env: |
| 112 | + MAKEFLAGS: -j 10 |
| 113 | + CPUs: 5 |
| 114 | + |
| 115 | + container: |
| 116 | + image: solbuildpackpusher/solidity-buildpack-deps@sha256:c57f2bfb8c15d70fe290629358dd1c73dc126e3760f443b54764797556b887d4 |
| 117 | + |
| 118 | + steps: |
| 119 | + - name: Checkout code |
| 120 | + uses: actions/checkout@v5 |
| 121 | + |
| 122 | + - name: Fix git safe directory |
| 123 | + run: git config --global --add safe.directory '*' |
| 124 | + |
| 125 | + - name: Run build script |
| 126 | + run: .github/workflows/build_ems.sh |
| 127 | + |
| 128 | + - name: Prepare artifact for caching |
| 129 | + run: | |
| 130 | + mkdir github/ |
| 131 | + cp upload/soljson.js github/soljson.js |
| 132 | +
|
| 133 | + - name: Save artifact to cache |
| 134 | + uses: actions/cache/save@v4 |
| 135 | + with: |
| 136 | + path: github/soljson.js |
| 137 | + key: solc-ems-${{ github.run_id }} |
| 138 | + |
| 139 | + upload-to-s3: |
| 140 | + needs: [ b_windows, b_macos, b_linux, b_ems ] |
| 141 | + |
| 142 | + runs-on: [ self-hosted, macOS ] |
| 143 | + |
| 144 | + permissions: |
| 145 | + actions: read |
| 146 | + contents: read |
| 147 | + |
| 148 | + steps: |
| 149 | + - name: Restore solc-windows |
| 150 | + uses: actions/cache/restore@v4 |
| 151 | + with: |
| 152 | + path: github/solc-windows.exe |
| 153 | + key: solc-windows-${{ github.run_id }} |
| 154 | + enableCrossOsArchive: true |
| 155 | + |
| 156 | + - name: Restore solc-macos |
| 157 | + uses: actions/cache/restore@v4 |
| 158 | + with: |
| 159 | + path: github/solc-macos |
| 160 | + key: solc-macos-${{ github.run_id }} |
| 161 | + enableCrossOsArchive: true |
| 162 | + |
| 163 | + - name: Restore solc-linux |
| 164 | + uses: actions/cache/restore@v4 |
| 165 | + with: |
| 166 | + path: github/solc-static-linux |
| 167 | + key: solc-linux-${{ github.run_id }} |
| 168 | + |
| 169 | + - name: Restore solc-ems |
| 170 | + uses: actions/cache/restore@v4 |
| 171 | + with: |
| 172 | + path: github/soljson.js |
| 173 | + key: solc-ems-${{ github.run_id }} |
| 174 | + |
| 175 | + - name: List all artifacts |
| 176 | + run: | |
| 177 | + ls -R github/ |
| 178 | +
|
| 179 | + - name: Create tarball for use on github |
| 180 | + run: | |
| 181 | + cd github |
| 182 | + tar --create --file ../github-binaries.tar * |
| 183 | +
|
| 184 | + - name: Rename binaries to solc-bin naming convention |
| 185 | + run: | |
| 186 | + full_version=$( |
| 187 | + github/solc-macos --version | |
| 188 | + sed -En 's/^Version: ([0-9.]+.*\+commit\.[0-9a-f]+(\.mod)?).*$/\1/p' |
| 189 | + ) |
| 190 | +
|
| 191 | + mkdir -p solc-bin/{linux-amd64,macosx-amd64,windows-amd64,bin} |
| 192 | +
|
| 193 | + cp github/solc-static-linux "solc-bin/linux-amd64/solc-linux-amd64-v${full_version}" |
| 194 | + cp github/solc-macos "solc-bin/macosx-amd64/solc-macosx-amd64-v${full_version}" |
| 195 | + cp github/solc-windows.exe "solc-bin/windows-amd64/solc-windows-amd64-v${full_version}.exe" |
| 196 | + cp github/soljson.js "solc-bin/bin/soljson-v${full_version}.js" |
| 197 | +
|
| 198 | + cd solc-bin/ |
| 199 | + tar --create --file ../solc-bin-binaries.tar * |
| 200 | +
|
| 201 | + - name: Upload to S3 |
| 202 | + shell: zsh -el {0} |
| 203 | + env: |
| 204 | + S3_BUCKET_PROD: ${{ secrets.S3_BUCKET_PROD }} |
| 205 | + S3_BUCKET_TEST: ${{ secrets.S3_BUCKET_TEST }} |
| 206 | + run: | |
| 207 | + case "${GITHUB_REF_NAME}" in |
| 208 | + develop) bucket="${S3_BUCKET_PROD}" ;; |
| 209 | + release_*) bucket="${S3_BUCKET_TEST}" ;; |
| 210 | + esac |
| 211 | + |
| 212 | + aws s3 cp github-binaries.tar "s3://${bucket}/${{ github.sha }}/" --only-show-errors |
| 213 | + aws s3 cp solc-bin-binaries.tar "s3://${bucket}/${{ github.sha }}/" --only-show-errors |
| 214 | + |
| 215 | + cd github |
| 216 | + aws s3 cp solc-windows.exe "s3://${bucket}/${{ github.sha }}/" --only-show-errors |
| 217 | + aws s3 cp solc-macos "s3://${bucket}/${{ github.sha }}/" --only-show-errors |
| 218 | + aws s3 cp solc-static-linux "s3://${bucket}/${{ github.sha }}/" --only-show-errors |
| 219 | + aws s3 cp soljson.js "s3://${bucket}/${{ github.sha }}/" --only-show-errors |
| 220 | + |
| 221 | + cd .. && rm -rf github solc-bin *.tar |
0 commit comments