Repository navigation
Merge pull request #143 from yanghang8612/backport/ci-pipeline-update… #55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build binaries on multi platform | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| - "release_*" | |
| jobs: | |
| b_windows: | |
| runs-on: windows-2022 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| submodules: true | |
| - name: Cache dependencies | |
| id: cache-deps | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| .\deps\boost | |
| .\deps\cmake | |
| key: hosted-dependencies-win-v2-${{ runner.arch }}-${{ hashFiles('scripts/install_deps.ps1') }} | |
| - name: Installing dependencies | |
| if: steps.cache-deps.outputs.cache-hit != 'true' | |
| shell: powershell | |
| run: .\scripts\install_deps.ps1 | |
| - name: Run build script | |
| shell: bash | |
| run: powershell.exe .github/workflows/build_win.ps1 | |
| - name: Prepare artifact for caching | |
| shell: bash | |
| run: | | |
| mkdir github/ | |
| cp build/solc/Release/solc.exe github/solc-windows.exe | |
| - name: Upload Windows binary | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: solc-windows | |
| path: github/solc-windows.exe | |
| if-no-files-found: error | |
| b_macos: | |
| runs-on: macos-15 | |
| env: | |
| CMAKE_BUILD_TYPE: Release | |
| CMAKE_OPTIONS: -DCMAKE_OSX_ARCHITECTURES:STRING=x86_64;arm64 -DBoost_ROOT=${{ github.workspace }}/deps/boost -DBoost_NO_SYSTEM_PATHS=ON | |
| TERM: xterm | |
| MAKEFLAGS: -j 3 | |
| CPUs: 3 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| submodules: true | |
| - name: Select pinned macOS toolchain | |
| run: | | |
| sudo xcode-select --switch /Applications/Xcode_16.4.app/Contents/Developer | |
| bash .circleci/install_cmake.sh 3.29.3 | |
| xcodebuild -version | |
| clang --version | |
| cmake --version | |
| - name: Cache universal Boost | |
| id: cache-boost | |
| uses: actions/cache@v5 | |
| with: | |
| path: deps/boost | |
| key: hosted-boost-macos-universal-1.84.0-xcode16.4-v1 | |
| - name: Build universal Boost | |
| if: steps.cache-boost.outputs.cache-hit != 'true' | |
| run: | | |
| boost_version=1.84.0 | |
| boost_dir="boost_${boost_version//./_}" | |
| boost_archive="${RUNNER_TEMP}/${boost_dir}.tar.bz2" | |
| curl --fail --location --retry 3 \ | |
| "https://archives.boost.io/release/${boost_version}/source/${boost_dir}.tar.bz2" \ | |
| --output "${boost_archive}" | |
| tar -xjf "${boost_archive}" -C "${RUNNER_TEMP}" | |
| cd "${RUNNER_TEMP}/${boost_dir}" | |
| ./bootstrap.sh \ | |
| --with-toolset=clang \ | |
| --with-libraries=filesystem,program_options,system,test | |
| ./b2 -j 3 -d0 \ | |
| link=static \ | |
| variant=release \ | |
| threading=multi \ | |
| address-model=64 \ | |
| architecture=arm+x86 \ | |
| --prefix="${GITHUB_WORKSPACE}/deps/boost" \ | |
| install | |
| - name: Run build script | |
| shell: bash -el {0} | |
| run: .github/workflows/build.sh | |
| - name: Prepare artifact for caching | |
| run: | | |
| mkdir github/ | |
| cp build/solc/solc github/solc-macos | |
| - name: Upload macOS binary | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: solc-macos | |
| path: github/solc-macos | |
| if-no-files-found: error | |
| b_linux: | |
| runs-on: ubuntu-24.04 | |
| env: | |
| CMAKE_OPTIONS: -DCMAKE_BUILD_TYPE=Release -DSOLC_LINK_STATIC=ON | |
| TERM: xterm | |
| MAKEFLAGS: -j 4 | |
| CPUs: 4 | |
| container: | |
| # ghcr.io/argotorg/solidity-buildpack-deps:ubuntu2404-6 | |
| image: ghcr.io/argotorg/solidity-buildpack-deps@sha256:c0412c53e59ce0c96bde4c08e7332ea12e4cadba9bbac829621947897fa21272 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| submodules: true | |
| - name: Fix git safe directory | |
| run: git config --global --add safe.directory '*' | |
| - name: Run build script | |
| run: .github/workflows/build.sh | |
| - name: Prepare artifact for caching | |
| run: | | |
| mkdir github/ | |
| cp build/solc/solc github/solc-static-linux | |
| - name: Upload Linux binary | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: solc-linux | |
| path: github/solc-static-linux | |
| if-no-files-found: error | |
| b_linux_arm: | |
| runs-on: ubuntu-24.04-arm | |
| env: | |
| CMAKE_OPTIONS: -DCMAKE_BUILD_TYPE=Release -DSOLC_LINK_STATIC=ON | |
| TERM: xterm | |
| MAKEFLAGS: -j 4 | |
| CPUs: 4 | |
| container: | |
| # ghcr.io/argotorg/solidity-buildpack-deps:ubuntu2404.arm-1 | |
| image: ghcr.io/argotorg/solidity-buildpack-deps@sha256:6cdb928fa8743d0b5d515c2c489b8d545c541f2370af28d5d3a71532056a0f22 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| submodules: true | |
| - name: Fix git safe directory | |
| run: git config --global --add safe.directory '*' | |
| - name: Run build script | |
| run: .github/workflows/build.sh | |
| - name: Prepare artifact for caching | |
| run: | | |
| mkdir github/ | |
| cp build/solc/solc github/solc-static-linux-arm | |
| - name: Upload Linux ARM64 binary | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: solc-linux-arm | |
| path: github/solc-static-linux-arm | |
| if-no-files-found: error | |
| b_ems: | |
| runs-on: ubuntu-24.04 | |
| env: | |
| TERM: xterm | |
| MAKEFLAGS: -j 4 | |
| CPUs: 4 | |
| container: | |
| # ghcr.io/argotorg/solidity-buildpack-deps:emscripten-21 | |
| # NOTE: Keep in sync with the digest in scripts/build_emscripten.sh | |
| image: ghcr.io/argotorg/solidity-buildpack-deps@sha256:fc53d68a4680ffa7d5f70164e13a903478964f15bcc07434d74833a05f4fbc19 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| submodules: true | |
| - name: Fix git safe directory | |
| run: git config --global --add safe.directory '*' | |
| - name: Run build script | |
| run: .github/workflows/build_ems.sh | |
| - name: Prepare artifact for caching | |
| run: | | |
| mkdir github/ | |
| cp upload/soljson.js github/soljson.js | |
| - name: Upload Emscripten binary | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: solc-ems | |
| path: github/soljson.js | |
| if-no-files-found: error | |
| upload-to-s3: | |
| needs: [ b_windows, b_macos, b_linux, b_linux_arm, b_ems ] | |
| runs-on: [ self-hosted, Linux, for-linux ] | |
| permissions: | |
| actions: read | |
| contents: read | |
| steps: | |
| - name: Download solc-windows | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: solc-windows | |
| path: github | |
| - name: Download solc-macos | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: solc-macos | |
| path: github | |
| - name: Download solc-linux | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: solc-linux | |
| path: github | |
| - name: Download solc-linux-arm | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: solc-linux-arm | |
| path: github | |
| - name: Download solc-ems | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: solc-ems | |
| path: github | |
| - name: Restore executable permissions | |
| run: chmod +x github/solc-static-linux github/solc-static-linux-arm github/solc-macos | |
| - name: List all artifacts | |
| run: | | |
| ls -R github/ | |
| - name: Create tarball for use on github | |
| run: | | |
| cd github | |
| tar --create --file ../github-binaries.tar * | |
| - name: Rename binaries to solc-bin naming convention | |
| run: | | |
| full_version=$( | |
| github/solc-static-linux --version | | |
| sed -En 's/^Version: ([0-9.]+.*\+commit\.[0-9a-f]+(\.mod)?).*$/\1/p' | |
| ) | |
| mkdir -p solc-bin/{linux-amd64,linux-arm64,macosx-amd64,windows-amd64,bin} | |
| cp github/solc-static-linux-arm "solc-bin/linux-arm64/solc-linux-arm64-v${full_version}" | |
| cp github/solc-static-linux "solc-bin/linux-amd64/solc-linux-amd64-v${full_version}" | |
| cp github/solc-macos "solc-bin/macosx-amd64/solc-macosx-amd64-v${full_version}" | |
| cp github/solc-windows.exe "solc-bin/windows-amd64/solc-windows-amd64-v${full_version}.exe" | |
| cp github/soljson.js "solc-bin/bin/soljson-v${full_version}.js" | |
| cd solc-bin/ | |
| tar --create --file ../solc-bin-binaries.tar * | |
| - name: Upload to S3 | |
| shell: bash | |
| env: | |
| S3_BUCKET: ${{ secrets.S3_BUCKET_PROD }} | |
| run: | | |
| aws s3 cp github-binaries.tar "s3://${S3_BUCKET}/${{ github.sha }}/" --only-show-errors | |
| aws s3 cp solc-bin-binaries.tar "s3://${S3_BUCKET}/${{ github.sha }}/" --only-show-errors | |
| cd github | |
| aws s3 cp solc-windows.exe "s3://${S3_BUCKET}/${{ github.sha }}/" --only-show-errors | |
| aws s3 cp solc-macos "s3://${S3_BUCKET}/${{ github.sha }}/" --only-show-errors | |
| aws s3 cp solc-static-linux "s3://${S3_BUCKET}/${{ github.sha }}/" --only-show-errors | |
| aws s3 cp solc-static-linux-arm "s3://${S3_BUCKET}/${{ github.sha }}/" --only-show-errors | |
| aws s3 cp soljson.js "s3://${S3_BUCKET}/${{ github.sha }}/" --only-show-errors | |
| cd .. && rm -rf github solc-bin *.tar |