Skip to content

refactor: Brush up repo for publishing (pt. 2) #366

refactor: Brush up repo for publishing (pt. 2)

refactor: Brush up repo for publishing (pt. 2) #366

Workflow file for this run

name: CI
on:
push:
branches:
- master
pull_request:
merge_group:
env:
CARGO_TERM_COLOR: always
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt, clippy, rust-src
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Install cargo-afl
run: cargo install cargo-afl --version=^0.15 --force
- name: Build project
run: |
# AFL fuzzing requires a separate command
cargo build --workspace --all-targets --exclude zksync_vm2_afl_fuzz
- name: Build fuzzer
run: cargo afl build -p zksync_vm2_afl_fuzz
# Two runs are needed. One for normal VM, another for the mocked version
- name: Run clippy
run: |
# Check the main library with non-test features (needs to be tested in isolation since the fuzzing crate enables test features)
cargo clippy -p zksync_vm2 --all-targets -- -D warnings
# The benches in `vm2` don't compile with fuzzing enabled
cargo clippy --workspace --all-features --lib --bins --tests -- -D warnings
- name: Check formatting
run: |
cargo fmt --check -- --config imports_granularity=Crate --config group_imports=StdExternalCrate
- name: Run tests
run: |
cargo test -p zksync_vm2_interface -p zksync_vm2 --all-targets
- name: Run doc tests
run: cargo test --workspace --doc
- name: Run fuzzer for a bit
run: |
AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES=1 \
cargo afl fuzz -i tests/afl-fuzz/in -o tests/afl-fuzz/out -V 60 target/debug/zksync_vm2_afl_fuzz