Build and release binaries #495
This file contains 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 and release binaries | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
tags: | |
- "**" | |
jobs: | |
setup: | |
name: Setup | |
runs-on: [ubuntu-latest] | |
outputs: | |
release_version: ${{ steps.set.outputs.release_version }} | |
git_tag: ${{ steps.set.outputs.git_tag }} | |
steps: | |
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 | |
- name: Generate output with git tag | |
id: set | |
run: | | |
if [[ ${{ github.event_name }} != 'pull_request' ]]; then | |
version=$(cut -d "-" -f1 <<< ${GITHUB_REF#refs/*/}) | |
echo "release_version=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | |
echo "git_tag=${version}" >> $GITHUB_OUTPUT | |
else | |
echo "release_version=${{ github.base_ref }}" >> $GITHUB_OUTPUT | |
echo "git_tag=${{ github.base_ref }}" >> $GITHUB_OUTPUT | |
fi | |
build_linux_amd64: | |
runs-on: [matterlabs-ci-runner] | |
needs: [setup] | |
container: | |
image: matterlabs/llvm_runner:latest | |
credentials: | |
username: ${{ secrets.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
submodules: recursive | |
ref: ${{ steps.set.outputs.release_version }} | |
- name: Building the Solidity compiler | |
run: | | |
mkdir -p ./build | |
cd ./build | |
cmake .. -DCMAKE_BUILD_TYPE="Release" -DSOLC_VERSION_ZKEVM="${{ needs.setup.outputs.release_version }}" -DUSE_Z3=OFF | |
make -j$(nproc) | |
pwd | |
ls -la ./solc/ | |
ls -la ./solc/solc | |
- name: Prepare binary file name | |
run: | | |
mkdir -p releases/linux-amd64 | |
./build/solc/solc --version | |
mv ./build/solc/solc releases/linux-amd64/solc-linux-amd64-${{ needs.setup.outputs.release_version }} | |
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3 | |
with: | |
name: release_linux_amd64 | |
path: releases | |
build_linux_arm64: | |
runs-on: [matterlabs-ci-runner-arm] | |
needs: [setup] | |
container: | |
image: matterlabs/llvm_runner:latest | |
credentials: | |
username: ${{ secrets.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
submodules: recursive | |
ref: ${{ steps.set.outputs.release_version }} | |
- name: Building the Solidity compiler | |
run: | | |
mkdir -p ./build | |
cd ./build | |
cmake .. -DCMAKE_BUILD_TYPE="Release" -DSOLC_VERSION_ZKEVM="${{ needs.setup.outputs.release_version }}" -DUSE_Z3=OFF -DUSE_CVC4=OFF | |
make -j$(nproc) | |
pwd | |
ls -la ./solc/ | |
ls -la ./solc/solc | |
- name: Prepare binary file name | |
run: | | |
mkdir -p releases/linux-arm64 | |
./build/solc/solc --version | |
mv ./build/solc/solc releases/linux-arm64/solc-linux-arm64-${{ needs.setup.outputs.release_version }} | |
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3 | |
with: | |
name: release_linux_arm64 | |
path: releases | |
build_macos_amd64: | |
runs-on: macos-12-xl | |
needs: [setup] | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
submodules: recursive | |
ref: ${{ steps.set.outputs.release_version }} | |
# It is needed as we use some commands which a deprecated in newer versions of boost | |
- name: Install BOOST | |
shell: zsh {0} | |
run: | | |
curl -L -o boost_1_71_0.tar.gz https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.gz | |
tar xzf ./boost_1_71_0.tar.gz | |
cd ./boost_1_71_0 | |
./bootstrap.sh --prefix=/usr/local --with-python-version=2.7 | |
./b2 -j$(sysctl -n hw.ncpu) | |
./b2 install -j$(sysctl -n hw.ncpu) | |
- name: Cmake gen | |
shell: zsh {0} | |
env: | |
CXXFLAGS: "-Wno-narrowing" | |
run: | | |
mkdir -p ./build | |
cd ./build | |
cmake .. -DCMAKE_BUILD_TYPE="Release" -DSOLC_VERSION_ZKEVM="${{ needs.setup.outputs.release_version }}" -DUSE_Z3=OFF | |
- name: Building the Solidity compiler | |
run: | | |
cd ./build | |
make -j12 | |
./solc/solc --version | |
- name: Prepare binary file name | |
shell: zsh {0} | |
run: | | |
mkdir -p ./releases/macosx-amd64 | |
./build/solc/solc --version | |
mv ./build/solc/solc ./releases/macosx-amd64/solc-macosx-amd64-${{ needs.setup.outputs.release_version }} | |
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3 | |
with: | |
name: release_macos_amd64 | |
path: releases | |
build_macos_arm64: | |
runs-on: [self-hosted, macOS, ARM64] | |
needs: [setup] | |
steps: | |
- name: Clear repository | |
run: rm -rf ~/.gitconfig; rm -rf {*,.*} || true | |
- name: Checkout source | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
submodules: recursive | |
ref: ${{ steps.set.outputs.release_version }} | |
# It is needed as we use some commands which a deprecated in newer versions of boost | |
- name: Install BOOST | |
shell: zsh {0} | |
run: | | |
curl -L -o boost_1_71_0.tar.gz https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.gz | |
tar xzf ./boost_1_71_0.tar.gz | |
cd ./boost_1_71_0 | |
export BOOST_DIR=$(pwd)/boost | |
mkdir $BOOST_DIR | |
./bootstrap.sh --prefix=$BOOST_DIR | |
./b2 -j12 | |
./b2 install -j12 | |
- name: Cmake gen | |
shell: zsh {0} | |
env: | |
CXXFLAGS: "-Wno-narrowing" | |
run: | | |
mkdir -p ./build | |
cd ./build | |
cmake .. -DCMAKE_BUILD_TYPE="Release" -DSOLC_VERSION_ZKEVM="${{ needs.setup.outputs.release_version }}" -DUSE_Z3=OFF | |
- name: Building the Solidity compiler | |
shell: zsh {0} | |
run: | | |
cd ./build | |
make -j12 | |
./solc/solc --version | |
- name: Prepare binary file name | |
shell: zsh {0} | |
run: | | |
mkdir -p ./releases/macosx-arm64 | |
./build/solc/solc --version | |
mv ./build/solc/solc ./releases/macosx-arm64/solc-macosx-arm64-${{ needs.setup.outputs.release_version }} | |
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3 | |
with: | |
name: release_macos_arm64 | |
path: releases | |
prepare-release: | |
runs-on: [ matterlabs-default-infra-runners ] | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: | |
- setup | |
- build_macos_arm64 | |
- build_macos_amd64 | |
- build_linux_arm64 | |
- build_linux_amd64 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
ref: ${{ steps.set.outputs.release_version }} | |
- name: Download artifact macos_arm64 | |
uses: actions/download-artifact@v3 | |
with: | |
name: release_macos_arm64 | |
path: releases | |
- name: Download artifact macosx_amd64 | |
uses: actions/download-artifact@v3 | |
with: | |
name: release_macos_amd64 | |
path: releases | |
- name: Download artifact linux_amd64 | |
uses: actions/download-artifact@v3 | |
with: | |
name: release_linux_amd64 | |
path: releases | |
- name: Download artifact linux_arm64 | |
uses: actions/download-artifact@v3 | |
with: | |
name: release_linux_arm64 | |
path: releases | |
- name: Generate changelog | |
id: changelog | |
shell: bash | |
run: | | |
awk '/###/ {flag=!flag; if (seen++) exit; next} flag' ./Changelog.md > tmp_changelog.txt | |
- name: Prepare release | |
uses: softprops/action-gh-release@v1 | |
with: | |
generate_release_notes: false | |
name: zkVM solc ${{ needs.setup.outputs.release_version }} | |
body_path: ./tmp_changelog.txt | |
tag_name: ${{ needs.setup.outputs.release_version }} | |
files: | | |
releases/**/** |