Skip to content

Commit

Permalink
Improve Fuzz GitHub Actions CI (#1080)
Browse files Browse the repository at this point in the history
* add separate fuzz build step

* improve fuzz caching

* separate build and test phases in CI

* properly build only tests

* separate build and test commands in ASAN test job

* remove second '--tests' arg
  • Loading branch information
Robbepop authored Jun 20, 2024
1 parent ae84917 commit c1c5af9
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ jobs:
run: rustup show
- name: "Add Rust Component: `rust-src`"
run: rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
- name: Build Tests
env:
RUSTFLAGS: "--cfg debug_assertions -Zsanitizer=address"
run: cargo build --tests --workspace -Zbuild-std --target x86_64-unknown-linux-gnu
- name: Test
env:
RUSTFLAGS: "--cfg debug_assertions -Zsanitizer=address"
Expand Down Expand Up @@ -95,10 +99,18 @@ jobs:
restore-keys: ${{ runner.os }}-${{ github.job }}-
- name: Checkout Submodules
run: git submodule update --init --recursive
- name: Build (default features)
env:
RUSTFLAGS: "--cfg debug_assertions"
run: cargo build --tests --workspace --release
- name: Test (default features)
env:
RUSTFLAGS: "--cfg debug_assertions"
run: cargo test --workspace --release
- name: Build (all features)
env:
RUSTFLAGS: "--cfg debug_assertions"
run: cargo build --tests --workspace --release --all-features
- name: Test (all features)
env:
RUSTFLAGS: "--cfg debug_assertions"
Expand Down Expand Up @@ -200,7 +212,8 @@ jobs:
~/.cargo/registry/cache/
~/.cargo/git/db/
~/target/
~/fuzz/target/
~/target/x86_64-unknown-linux-gnu/
~/target/x86_64-unknown-linux-gnu/release/
~/fuzz/corpus/translate/
~/fuzz/curpus/translate_metered/
key: ${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/Cargo.lock') }}
Expand All @@ -212,6 +225,8 @@ jobs:
# Note: We use `|| true` because cargo install returns an error
# if cargo-udeps was already installed on the CI runner.
cargo install cargo-fuzz || true
- name: Build Fuzzing
run: cargo fuzz build translate
- name: Fuzz (Translation)
run: cargo fuzz run translate -j 2 --verbose -- -max_total_time=60 # 1 minute of fuzzing
- name: Fuzz (Translation) + fuel
Expand All @@ -233,6 +248,8 @@ jobs:
~/.cargo/registry/cache/
~/.cargo/git/db/
~/target/
~/target/x86_64-unknown-linux-gnu/
~/target/x86_64-unknown-linux-gnu/release/
~/target/release/
~/target/debug/
~/fuzz/corpus/execute/
Expand All @@ -245,6 +262,8 @@ jobs:
# Note: We use `|| true` because cargo install returns an error
# if cargo-udeps was already installed on the CI runner.
cargo install cargo-fuzz || true
- name: Build Fuzzing
run: cargo fuzz build execute
- name: Fuzz (Execution)
run: cargo fuzz run execute -j 2 --verbose -- -max_total_time=120 # 2 minutes of fuzzing

Expand All @@ -264,6 +283,8 @@ jobs:
~/.cargo/registry/cache/
~/.cargo/git/db/
~/target/
~/target/x86_64-unknown-linux-gnu/
~/target/x86_64-unknown-linux-gnu/release/
~/target/release/
~/target/debug/
~/fuzz/corpus/execute/
Expand All @@ -276,6 +297,8 @@ jobs:
# Note: We use `|| true` because cargo install returns an error
# if cargo-udeps was already installed on the CI runner.
cargo install cargo-fuzz || true
- name: Build Fuzzing
run: cargo fuzz build differential
- name: Fuzz (Differential)
run: cargo fuzz run differential -j 2 --verbose -- -max_total_time=120 # 2 minutes of fuzzing

Expand Down

0 comments on commit c1c5af9

Please sign in to comment.