Skip to content

Commit

Permalink
ci: Added pr pipeline for building binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrst88 committed Nov 15, 2023
1 parent d5beeab commit e2985a6
Showing 1 changed file with 53 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,36 @@
name: Build and release binaries manually.
name: Build and release binaries

on:
workflow_dispatch:
inputs:
ZKVM_RELEASE_TAG:
description: 'zkVM Release tag'
required: true
BRANCH_TAG:
description: 'Which branch to build'
required: true

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:
Expand All @@ -24,7 +42,7 @@ jobs:
with:
submodules: recursive
token: ${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}
ref: ${{ inputs.BRANCH_TAG }}
ref: ${{ steps.set.outputs.release_version }}

- name: Prepare environment
run: |
Expand All @@ -36,7 +54,7 @@ jobs:
run: |
mkdir -p ./build
cd ./build
cmake .. -DCMAKE_BUILD_TYPE="Release" -DSOLC_VERSION_ZKEVM="${{ inputs.ZKVM_RELEASE_TAG }}" -DUSE_Z3=OFF
cmake .. -DCMAKE_BUILD_TYPE="Release" -DSOLC_VERSION_ZKEVM="${{ needs.setup.outputs.release_version }}" -DUSE_Z3=OFF
make -j$(nproc)
pwd
ls -la ./solc/
Expand All @@ -45,7 +63,7 @@ jobs:
- name: Prepare binary file name
run: |
mkdir -p releases/linux-amd64
mv ./build/solc/solc releases/linux-amd64/solc-linux-amd64-${{ inputs.BRANCH_TAG }}-${{ inputs.ZKVM_RELEASE_TAG }}
mv ./build/solc/solc releases/linux-amd64/solc-linux-amd64-${{ needs.setup.outputs.release_version }}
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3
with:
Expand All @@ -54,6 +72,7 @@ jobs:

build_linux_arm64:
runs-on: [matterlabs-ci-runner-arm]
needs: [setup]
container:
image: matterlabs/llvm_runner:latest
credentials:
Expand All @@ -65,7 +84,7 @@ jobs:
with:
submodules: recursive
token: ${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}
ref: ${{ inputs.BRANCH_TAG }}
ref: ${{ steps.set.outputs.release_version }}

- name: Prepare environment
run: |
Expand All @@ -77,7 +96,7 @@ jobs:
run: |
mkdir -p ./build
cd ./build
cmake .. -DCMAKE_BUILD_TYPE="Release" -DSOLC_VERSION_ZKEVM="${{ inputs.ZKVM_RELEASE_TAG }}" -DUSE_Z3=OFF -DUSE_CVC4=OFF
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/
Expand All @@ -86,7 +105,7 @@ jobs:
- name: Prepare binary file name
run: |
mkdir -p releases/linux-arm64
mv ./build/solc/solc releases/linux-arm64/solc-linux-arm64-${{ inputs.BRANCH_TAG }}-${{ inputs.ZKVM_RELEASE_TAG }}
mv ./build/solc/solc releases/linux-arm64/solc-linux-arm64-${{ needs.setup.outputs.release_version }}
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3
with:
Expand All @@ -95,13 +114,14 @@ jobs:

build_macos_amd64:
runs-on: macos-12-xl
needs: [setup]
steps:
- name: Checkout source
uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}
ref: ${{ inputs.BRANCH_TAG }}
ref: ${{ steps.set.outputs.release_version }}

- name: Prepare environment
shell: zsh {0}
Expand Down Expand Up @@ -133,7 +153,7 @@ jobs:
run: |
mkdir -p ./build
cd ./build
cmake .. -DCMAKE_BUILD_TYPE="Release" -DSOLC_VERSION_ZKEVM="${{ inputs.ZKVM_RELEASE_TAG }}" -DUSE_Z3=OFF
cmake .. -DCMAKE_BUILD_TYPE="Release" -DSOLC_VERSION_ZKEVM="${{ needs.setup.outputs.release_version }}" -DUSE_Z3=OFF
- name: Building the Solidity compiler
run: |
Expand All @@ -145,7 +165,7 @@ jobs:
shell: zsh {0}
run: |
mkdir -p ./releases/macosx-amd64
mv ./build/solc/solc ./releases/macosx-amd64/solc-macosx-amd64-${{ inputs.BRANCH_TAG }}-${{ inputs.ZKEVM_RELEASE_TAG }}
mv ./build/solc/solc ./releases/macosx-amd64/solc-macosx-amd64-${{ needs.setup.outputs.release_version }}
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3
with:
Expand All @@ -154,6 +174,7 @@ jobs:

build_macos_arm64:
runs-on: [self-hosted, macOS, ARM64]
needs: [setup]
steps:
- name: Clear repository
run: rm -rf ~/.gitconfig; rm -rf {*,.*} || true
Expand All @@ -163,7 +184,7 @@ jobs:
with:
submodules: recursive
token: ${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}
ref: ${{ inputs.BRANCH_TAG }}
ref: ${{ steps.set.outputs.release_version }}

- name: Prepare environment
shell: zsh {0}
Expand Down Expand Up @@ -197,7 +218,7 @@ jobs:
run: |
mkdir -p ./build
cd ./build
cmake .. -DCMAKE_BUILD_TYPE="Release" -DSOLC_VERSION_ZKEVM="${{ inputs.ZKVM_RELEASE_TAG }}" -DUSE_Z3=OFF
cmake .. -DCMAKE_BUILD_TYPE="Release" -DSOLC_VERSION_ZKEVM="${{ needs.setup.outputs.release_version }}" -DUSE_Z3=OFF
- name: Building the Solidity compiler
shell: zsh {0}
Expand All @@ -210,7 +231,7 @@ jobs:
shell: zsh {0}
run: |
mkdir -p ./releases/macosx-arm64
mv ./build/solc/solc ./releases/macosx-arm64/solc-macosx-arm64-${{ inputs.BRANCH_TAG }}-${{ inputs.ZKVM_RELEASE_TAG }}
mv ./build/solc/solc ./releases/macosx-arm64/solc-macosx-arm64-${{ needs.setup.outputs.release_version }}
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3
with:
Expand All @@ -219,6 +240,7 @@ jobs:

build_windows_amd64:
runs-on: windows-2019-github-hosted-16core
needs: [setup]
outputs:
version_to_skip: ${{ steps.compare_version.outputs.result }}
steps:
Expand All @@ -238,7 +260,7 @@ jobs:
with:
script: |
const semver = require('semver');
const currentVersion = '${{ inputs.BRANCH_TAG }}';
const currentVersion = '${{ needs.setup.outputs.git_tag }}';
const result = semver.lt(currentVersion, '0.6.0');
console.log(`Is the version < 0.6.0? ${result}`);
return result;
Expand All @@ -250,7 +272,7 @@ jobs:
with:
submodules: recursive
token: ${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}
ref: ${{ inputs.BRANCH_TAG }}
ref: ${{ steps.set.outputs.release_version }}

- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
Expand Down Expand Up @@ -321,15 +343,15 @@ jobs:
mkdir build
cd build
$boost_dir=(Resolve-Path ..\deps\boost\lib\cmake\Boost-*)
cmake .. -D SOLC_VERSION_ZKEVM="${{ inputs.ZKVM_RELEASE_TAG }}" -D USE_Z3="OFF" -DBoost_DIR="$boost_dir\" -DBoost_USE_STATIC_RUNTIME=1 -DBoost_USE_STATIC_LIBS=1 -DBoost_COMPILER=clang15 -T LLVM_v142 -DPEDANTIC=OFF -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
cmake .. -D SOLC_VERSION_ZKEVM="${{ needs.setup.outputs.release_version }}" -D USE_Z3="OFF" -DBoost_DIR="$boost_dir\" -DBoost_USE_STATIC_RUNTIME=1 -DBoost_USE_STATIC_LIBS=1 -DBoost_COMPILER=clang15 -T LLVM_v142 -DPEDANTIC=OFF -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
cmake --build . -j 10 --target install --config Release
- name: Prepare binary file name
if: steps.compare_version.outputs.result != 'true'
run: |
mkdir -p releases\windows-amd64
ls .\build\solc\Release\
mv .\build\solc\Release\solc.exe releases\windows-amd64\solc-windows-amd64-${{ inputs.BRANCH_TAG }}-${{ inputs.ZKVM_RELEASE_TAG }}.exe
mv .\build\solc\Release\solc.exe releases\windows-amd64\solc-windows-amd64-${{ needs.setup.outputs.release_version }}.exe
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3
if: steps.compare_version.outputs.result != 'true'
Expand All @@ -339,7 +361,9 @@ jobs:

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
Expand All @@ -350,7 +374,7 @@ jobs:
uses: actions/checkout@v3
with:
token: ${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}
ref: ${{ inputs.BRANCH_TAG }}
ref: ${{ steps.set.outputs.release_version }}

- name: Download artifact macos_arm64
uses: actions/download-artifact@v3
Expand Down Expand Up @@ -393,9 +417,9 @@ jobs:
uses: softprops/action-gh-release@v1
with:
generate_release_notes: false
name: zkVM solc ${{ inputs.BRANCH_TAG }}-${{ inputs.ZKVM_RELEASE_TAG }}
name: zkVM solc ${{ needs.setup.outputs.release_version }}
body_path: ./tmp_changelog.txt
tag_name: ${{ inputs.BRANCH_TAG }}-${{ inputs.ZKVM_RELEASE_TAG }}
tag_name: ${{ needs.setup.outputs.release_version }}
token: ${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}
files: |
releases/**/**

0 comments on commit e2985a6

Please sign in to comment.