ci: unify workflows and fix windows version (#732) #772
Workflow file for this run
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 | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
tags: | |
- "**" | |
concurrency: | |
group: ${{ github.repository_id }}-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
solc-version: ${{ steps.set.outputs.solc-version }} | |
zksync-version: ${{ steps.set.outputs.zksync-version }} | |
skip-windows: ${{ steps.check-version.outputs.result }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Define release version | |
shell: bash | |
id: set | |
run: | | |
if [[ ${{ github.event_name }} != 'pull_request' ]]; then | |
echo "zksync-version=$(cut -d "-" -f2 <<< ${GITHUB_REF#refs/*/})" | tee -a "${GITHUB_OUTPUT}" | |
else | |
echo "zksync-version=1.0.${{ github.run_id }}" | tee -a "${GITHUB_OUTPUT}" | |
fi | |
SOLC_VERSION=$(grep 'PROJECT_VERSION' CMakeLists.txt | grep -oP '(\d+\.\d+\.\d+)') | |
echo "solc-version=${SOLC_VERSION}" | tee -a "${GITHUB_OUTPUT}" | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install semver | |
run: npm install semver | |
- name: Check that version is >= 0.6.0 | |
id: check-version | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const semver = require('semver'); | |
const currentVersion = '${{ steps.set.outputs.solc-version }}'; | |
const result = semver.lt(currentVersion, '0.6.0'); | |
console.log(`Is the version < 0.6.0? ${result}`); | |
return result; | |
result-encoding: string | |
build: | |
needs: setup | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: "MacOS x86" | |
runner: macos-12-large | |
release-suffix: macosx-amd64 | |
- name: "MacOS arm64" | |
runner: [self-hosted, macOS, ARM64] | |
release-suffix: macosx-arm64 | |
- name: "Linux x86" | |
runner: matterlabs-ci-runner-high-performance | |
image: matterlabs/llvm_runner:ubuntu20-llvm17-latest | |
release-suffix: linux-amd64 | |
- name: "Linux ARM64" | |
runner: matterlabs-ci-runner-arm | |
image: matterlabs/llvm_runner:ubuntu20-llvm17-latest | |
release-suffix: linux-arm64 | |
- name: Windows | |
runner: windows-2019-github-hosted-64core | |
release-suffix: windows-amd64 | |
runs-on: ${{ matrix.runner }} | |
container: | |
image: ${{ matrix.image || '' }} | |
name: ${{ matrix.name }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Prepare Windows env | |
if: runner.os == 'Windows' | |
uses: matter-labs/era-compiler-ci/.github/actions/prepare-msys@v1 | |
- name: Building the Solidity compiler | |
uses: matter-labs/era-compiler-ci/.github/actions/build-solc@v1 | |
with: | |
release-suffix: ${{ matrix.release-suffix }} | |
zksync-version: ${{ needs.setup.outputs.zksync-version }} | |
solc-version: ${{ needs.setup.outputs.solc-version }} | |
boost-version: 1.74.0 | |
release: | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: release* | |
path: releases | |
- name: Generate changelog | |
shell: bash | |
run: awk '/###/ {flag=!flag; if (seen++) exit; next} flag' ./Changelog.md > release-changelog.txt | |
- name: Prepare release | |
uses: softprops/action-gh-release@v2 | |
with: | |
generate_release_notes: false | |
name: ZKsync solc ${{ github.ref_name }} | |
body_path: release-changelog.txt | |
tag_name: ${{ github.ref_name }} | |
files: releases/**/** |