Skip to content

Commit

Permalink
chore: improve CI and use cargo nextest (#490)
Browse files Browse the repository at this point in the history
* chore: make field_extension_air_test faster

* chore: faster poseidon2_negative_test

* chore: switch to O1 optimization for profile=fast

* chore: skip separate build in CI

tests already run build

* feat(ci): use cargo nextest

* switch to arm64 github runner

* solc has no arm binary
  • Loading branch information
jonathanpwang authored Oct 2, 2024
1 parent 4c42855 commit 640460e
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 27 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,20 @@ env:

jobs:
tests:
runs-on: ubuntu-latest-16core-64ram
runs-on: ubuntu-arm64-16core-64ram

steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- uses: taiki-e/install-action@nextest

- name: Run DB unit tests
working-directory: db/page
run: |
cargo t --features parallel --profile=fast
cargo nextest run --cargo-profile=fast --features parallel
benchmark-rw:
uses: ./.github/workflows/benchmark-call.yml
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/ecc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,17 @@ env:

jobs:
tests:
runs-on: ubuntu-latest-16core-64ram
runs-on: ubuntu-arm64-16core-64ram

steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- uses: taiki-e/install-action@nextest

- name: Run ecc-lib crate tests
working-directory: ecc/lib
run: |
cargo test --profile=fast --features parallel
cargo nextest run --cargo-profile=fast --features parallel
5 changes: 1 addition & 4 deletions .github/workflows/lints.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Lint and Build Workspace
name: Lint Workspace

on:
push:
Expand Down Expand Up @@ -28,6 +28,3 @@ jobs:
- name: Run clippy
run: cargo clippy --all-targets --all -- -D warnings

- name: Build
run: cargo build
7 changes: 4 additions & 3 deletions .github/workflows/primitives.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,22 @@ env:

jobs:
build:
runs-on: ubuntu-latest-16core-64ram
runs-on: ubuntu-arm64-16core-64ram

steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- uses: taiki-e/install-action@nextest

- name: Run tests for primitives
working-directory: primitives
run: |
cargo test --features parallel --profile=fast
cargo nextest run --cargo-profile fast --features parallel
- name: Run tests for poseidon2-air
working-directory: poseidon2-air
run: |
cargo test --features parallel --profile=fast
cargo nextest run --cargo-profile fast --features parallel
7 changes: 4 additions & 3 deletions .github/workflows/recursion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ env:

jobs:
tests:
runs-on: ubuntu-latest-16core-64ram
runs-on: ubuntu-latest-16core-64ram # must use x86 because solc has no arm64 linux binary...

steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- uses: taiki-e/install-action@nextest
- name: get solc
uses: pontem-network/get-solc@master
with:
Expand All @@ -38,5 +39,5 @@ jobs:
- name: Run recursion crate tests
working-directory: recursion
run: |
cargo test --profile=fast --features parallel
cargo test --profile=fast --features parallel,static-verifier -- halo2::tests
cargo nextest run --cargo-profile=fast --features parallel
cargo nextest run --cargo-profile=fast --features parallel,static-verifier -- halo2::tests
3 changes: 2 additions & 1 deletion .github/workflows/stark-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- uses: taiki-e/install-action@nextest

- name: Run tests
working-directory: stark-backend
run: |
cargo test --features parallel
cargo nextest run --features parallel
7 changes: 4 additions & 3 deletions .github/workflows/vm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,22 @@ env:

jobs:
tests:
runs-on: ubuntu-latest-16core-64ram
runs-on: ubuntu-arm64-16core-64ram

steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- uses: taiki-e/install-action@nextest

- name: Run vm crate tests
working-directory: vm
run: |
cargo test --profile=fast --features parallel
cargo nextest run --cargo-profile=fast --features parallel
- name: Run compiler crate tests
working-directory: compiler
run: |
cargo test --profile=fast --features parallel
cargo nextest run --cargo-profile=fast --features parallel
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ inherits = "release"
lto = "fat"
codegen-units = 1

# For O3 optimization but still fast(ish) compile times
# For O1 optimization but still fast(ish) compile times
[profile.fast]
inherits = "dev"
opt-level = 3
opt-level = 1
debug-assertions = true
# better recompile times
incremental = true
Expand Down
9 changes: 3 additions & 6 deletions vm/src/field_extension/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{
ops::{Add, Div, Mul, Sub},
};

use afs_stark_backend::{prover::USE_DEBUG_BUILDER, verifier::VerificationError};
use afs_stark_backend::{utils::disable_debug_builder, verifier::VerificationError};
use ax_sdk::utils::create_seeded_rng;
use p3_baby_bear::BabyBear;
use p3_field::{extension::BinomialExtensionField, AbstractExtensionField, AbstractField};
Expand Down Expand Up @@ -66,12 +66,9 @@ fn field_extension_air_test() {
let mut tester = tester.build().load(chip).finalize();
tester.simple_test().expect("Verification failed");

USE_DEBUG_BUILDER.with(|debug| {
*debug.lock().unwrap() = false;
});

disable_debug_builder();
// negative test pranking each IO value
for height in 0..num_ops {
for height in [0, num_ops - 1] {
// TODO: better way to modify existing traces in tester
let extension_trace = &mut tester.traces[2];
let original_trace = extension_trace.clone();
Expand Down
3 changes: 2 additions & 1 deletion vm/src/hashes/poseidon2/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ fn poseidon2_negative_test() {
tester.test(get_engine).expect("Verification failed");

disable_debug_builder();
for _ in 0..10 {
// test is slow, avoid too many repetitions
for _ in 0..5 {
// TODO: better way to modify existing traces in tester
let trace = &mut tester.traces[2];
let original_trace = trace.clone();
Expand Down

0 comments on commit 640460e

Please sign in to comment.