test: refactor unit tests with solc downloader #529
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: Tests | |
# Execute workflow for each PR and with each merge to the trunk | |
on: | |
workflow_dispatch: | |
inputs: | |
zksolc-version: | |
type: string | |
description: "Prebuilt zksolc version to use, (repo: https://github.com/matter-labs/zksolc-bin/releases)" | |
required: true | |
default: "1.5.0" | |
pull_request: | |
paths-ignore: | |
- '.gitignore' | |
- '**/*.md' | |
push: | |
branches: | |
- main | |
# Cancel the workflow if any new changes pushed to a feature branch or the trunk | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
# Check for secrets leak in the repository | |
secrets-scanner: | |
uses: matter-labs/era-compiler-ci/.github/workflows/secrets-scanner.yaml@v1 | |
secrets: inherit | |
# Check for cargo issues | |
cargo-checks: | |
runs-on: matterlabs-ci-runner | |
container: | |
image: ghcr.io/matter-labs/zksync-llvm-runner:latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
- name: Build LLVM | |
uses: matter-labs/era-compiler-ci/.github/actions/build-llvm@v1 | |
with: | |
target-env: 'gnu' | |
enable-assertions: 'false' | |
- name: Cargo checks | |
uses: matter-labs/era-compiler-ci/.github/actions/cargo-check@v1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
# Build and run unit and CLI tests | |
build-and-test: | |
strategy: | |
fail-fast: false # finalize testing of all targets even if one failed | |
matrix: | |
include: | |
- name: "MacOS x86" | |
runner: macos-12-large | |
- name: "MacOS arm64" | |
runner: [self-hosted, macOS, ARM64] | |
- name: "Linux x86 gnu" | |
runner: matterlabs-ci-runner | |
image: ghcr.io/matter-labs/zksync-llvm-runner:latest | |
target: "x86_64-unknown-linux-gnu" | |
enable-coverage: 'false' # enable coverage on Linux GNU | |
- name: "Linux ARM64 gnu" | |
runner: matterlabs-ci-runner-arm | |
image: ghcr.io/matter-labs/zksync-llvm-runner:latest | |
target: "aarch64-unknown-linux-gnu" | |
- name: "Linux x86 musl" | |
runner: matterlabs-ci-runner | |
image: ghcr.io/matter-labs/zksync-llvm-runner:latest | |
target: "x86_64-unknown-linux-musl" | |
- name: "Linux ARM64 musl" | |
runner: matterlabs-ci-runner-arm | |
image: ghcr.io/matter-labs/zksync-llvm-runner:latest | |
target: "aarch64-unknown-linux-musl" | |
- name: "Windows" | |
runner: windows-2022-github-hosted-16core | |
runs-on: ${{ matrix.runner }} | |
container: | |
image: ${{ matrix.image || '' }} # Special workaround to allow matrix builds with optional container | |
name: ${{ matrix.name }} | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
- name: Check CLI test files | |
if: github.event_name == 'pull_request' | |
id: changed-files-yaml | |
uses: tj-actions/changed-files@v44 | |
with: | |
files_yaml: | | |
cli_tests: | |
- 'cli-tests/**' | |
- '.github/actions/cli-tests/**' | |
- name: Prepare Windows env | |
if: runner.os == 'Windows' | |
uses: matter-labs/era-compiler-ci/.github/actions/prepare-msys@v1 | |
- name: Build LLVM | |
if: steps.changed-files-yaml.outputs.cli_tests_only_changed != 'true' | |
uses: matter-labs/era-compiler-ci/.github/actions/build-llvm@v1 | |
with: | |
target-env: ${{ contains(matrix.target, 'musl') && 'musl' || 'gnu' }} | |
enable-assertions: 'false' | |
enable-coverage: ${{ matrix.enable-coverage || 'false' }} | |
- name: Build zksolc | |
if: steps.changed-files-yaml.outputs.cli_tests_only_changed != 'true' | |
uses: ./.github/actions/build | |
with: | |
target: ${{ matrix.target || '' }} | |
enable-coverage: ${{ matrix.enable-coverage || 'false' }} | |
- name: Install solc compiler | |
uses: ./.github/actions/install-solc | |
- name: Run tests | |
if: steps.changed-files-yaml.outputs.cli_tests_only_changed != 'true' | |
uses: ./.github/actions/unit-tests | |
with: | |
target: ${{ matrix.target || '' }} | |
enable-coverage: ${{ matrix.enable-coverage || 'false' }} | |
coverage-token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Run CLI tests | |
uses: ./.github/actions/cli-tests | |
with: | |
use-prebuilt-zksolc: ${{ steps.changed-files-yaml.outputs.cli_tests_only_changed }} | |
zksolc-version: ${{ github.event.inputs.zksolc-version }} |