Skip to content

Commit

Permalink
ci: Refactor version rendering (#379)
Browse files Browse the repository at this point in the history
# What ❔

<!-- What are the changes this PR brings about? -->
<!-- Example: This PR adds a PR template to the repo. -->
<!-- (For bigger PRs adding more context is appreciated) -->

## Why ❔

<!-- Why are these changes done? What goal do they contribute to? What
are the principles behind them? -->
<!-- Example: PR templates ensure PR reviewers, observers, and future
iterators are in context about the evolution of repos. -->

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ ] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
  • Loading branch information
alexandrst88 authored Nov 15, 2023
1 parent 8981769 commit 093f739
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions .github/workflows/build_and_release_binary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ jobs:
name: Setup
runs-on: [ubuntu-latest]
outputs:
release_tag: ${{ steps.set.outputs.release_tag }}
release_version: ${{ steps.set.outputs.release_version }}
git_tag: ${{ steps.set.outputs.git_tag }}
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3

Expand All @@ -30,8 +31,9 @@ jobs:
else
git_tag="${{ inputs.BRANCH_TAG }}-${{ inputs.ZKVM_RELEASE_TAG }}"
fi
version=$(cut -d "-" -f2 <<< ${git_tag})
echo "release_tag=${version}" >> $GITHUB_OUTPUT
version=$(cut -d "-" -f1 <<< ${git_tag})
echo "release_version=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
echo "git_tag=${version}" >> $GITHUB_OUTPUT
build_linux_amd64:
runs-on: [matterlabs-ci-runner]
Expand All @@ -47,7 +49,7 @@ jobs:
with:
submodules: recursive
token: ${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}
ref: ${{ needs.setup.outputs.release_tag }}
ref: ${{ steps.set.outputs.release_version }}

- name: Prepare environment
run: |
Expand All @@ -59,7 +61,7 @@ jobs:
run: |
mkdir -p ./build
cd ./build
cmake .. -DCMAKE_BUILD_TYPE="Release" -DSOLC_VERSION_ZKEVM="${{ needs.setup.outputs.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 @@ -68,7 +70,7 @@ jobs:
- name: Prepare binary file name
run: |
mkdir -p releases/linux-amd64
mv ./build/solc/solc releases/linux-amd64/solc-linux-amd64-${{ needs.setup.outputs.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 @@ -89,7 +91,7 @@ jobs:
with:
submodules: recursive
token: ${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}
ref: ${{ needs.setup.outputs.release_tag }}
ref: ${{ steps.set.outputs.release_version }}

- name: Prepare environment
run: |
Expand All @@ -101,7 +103,7 @@ jobs:
run: |
mkdir -p ./build
cd ./build
cmake .. -DCMAKE_BUILD_TYPE="Release" -DSOLC_VERSION_ZKEVM="${{ needs.setup.outputs.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 @@ -110,7 +112,7 @@ jobs:
- name: Prepare binary file name
run: |
mkdir -p releases/linux-arm64
mv ./build/solc/solc releases/linux-arm64/solc-linux-arm64-${{ needs.setup.outputs.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 @@ -126,7 +128,7 @@ jobs:
with:
submodules: recursive
token: ${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}
ref: ${{ needs.setup.outputs.release_tag }}
ref: ${{ steps.set.outputs.release_version }}

- name: Prepare environment
shell: zsh {0}
Expand Down Expand Up @@ -158,7 +160,7 @@ jobs:
run: |
mkdir -p ./build
cd ./build
cmake .. -DCMAKE_BUILD_TYPE="Release" -DSOLC_VERSION_ZKEVM="${{ needs.setup.outputs.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 @@ -170,7 +172,7 @@ jobs:
shell: zsh {0}
run: |
mkdir -p ./releases/macosx-amd64
mv ./build/solc/solc ./releases/macosx-amd64/solc-macosx-amd64-${{ needs.setup.outputs.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 @@ -189,7 +191,7 @@ jobs:
with:
submodules: recursive
token: ${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}
ref: ${{ needs.setup.outputs.release_tag }}
ref: ${{ steps.set.outputs.release_version }}

- name: Prepare environment
shell: zsh {0}
Expand Down Expand Up @@ -223,7 +225,7 @@ jobs:
run: |
mkdir -p ./build
cd ./build
cmake .. -DCMAKE_BUILD_TYPE="Release" -DSOLC_VERSION_ZKEVM="${{ needs.setup.outputs.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 @@ -236,7 +238,7 @@ jobs:
shell: zsh {0}
run: |
mkdir -p ./releases/macosx-arm64
mv ./build/solc/solc ./releases/macosx-arm64/solc-macosx-arm64-${{ needs.setup.outputs.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 Down Expand Up @@ -265,7 +267,7 @@ jobs:
with:
script: |
const semver = require('semver');
const currentVersion = '${{ needs.setup.outputs.release_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 @@ -277,7 +279,7 @@ jobs:
with:
submodules: recursive
token: ${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}
ref: ${{ needs.setup.outputs.release_tag }}
ref: ${{ steps.set.outputs.release_version }}

- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
Expand Down Expand Up @@ -348,15 +350,15 @@ jobs:
mkdir build
cd build
$boost_dir=(Resolve-Path ..\deps\boost\lib\cmake\Boost-*)
cmake .. -D SOLC_VERSION_ZKEVM="${{ needs.setup.outputs.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-${{ needs.setup.outputs.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 @@ -367,6 +369,7 @@ jobs:
prepare-release:
runs-on: [ matterlabs-default-infra-runners ]
needs:
- setup
- build_macos_arm64
- build_macos_amd64
- build_linux_arm64
Expand All @@ -377,7 +380,7 @@ jobs:
uses: actions/checkout@v3
with:
token: ${{ secrets.ZKSYNC_ADMIN_BOT_ORG_REPO_WRITE }}
ref: ${{ needs.setup.outputs.release_tag }}
ref: ${{ steps.set.outputs.release_version }}

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

0 comments on commit 093f739

Please sign in to comment.