Skip to content

Commit

Permalink
ci: dedicated profile for release + debug_assert
Browse files Browse the repository at this point in the history
We want to use the `--release` behavior, but doing so directly would
disable evaluation of `debug_assert` lines, so we'll selectively
override that one option.

Updates the "check" and "test" jobs to use the `--profile ci`.
Also ensures that "check" covers all targets, including benchmarks,
and accordingly cleans up an unused import in same.
  • Loading branch information
conorsch authored and cronokirby committed Jan 31, 2024
1 parent 1bd0ef2 commit da391d6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
4 changes: 4 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[profile.ci]
# Using recommended settings from https://nexte.st/book/configuration.html#profiles
failure-output = "immediate-final"
fail-fast = false
20 changes: 10 additions & 10 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: check
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Load rust cache
uses: astriaorg/[email protected]
- name: Run cargo check, failing on warnings
run: cargo check --profile ci --all-targets
# It'd be nice to fail on warnings, but we're not ready for that.
# env:
# RUSTFLAGS: "-D warnings"

test:
name: Test Suite
Expand All @@ -36,7 +36,7 @@ jobs:
- name: Load rust cache
uses: astriaorg/[email protected]
- name: Run tests with nextest
run: cargo nextest run --features ${{ matrix.backend }}
run: cargo nextest run --cargo-profile ci --profile ci --features ${{ matrix.backend }}
env:
CARGO_TERM_COLOR: always

Expand Down
6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,9 @@ required-features = ["arkworks"]
name = "sqrt"
harness = false
required-features = ["arkworks"]

# Create profile for running checks in CI that are mostly "release" mode,
# but also checking the `debug_assert `lines.
[profile.ci]
inherits = "release"
debug-assertions = true
2 changes: 1 addition & 1 deletion benches/sqrt.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use ark_ff::{Field, PrimeField, Zero};
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
use decaf377::Fq;
use decaf377::{SqrtRatioZeta, ZETA};
use decaf377::ZETA;
use rand_chacha::ChaChaRng;
use rand_core::{RngCore, SeedableRng};

Expand Down

0 comments on commit da391d6

Please sign in to comment.