Skip to content

Commit e59041c

Browse files
authored
ci: improve CI & tests (#4)
* ci: improve CI & tests * chore: Switch to lurk-lab fork of abomonation_derive - Updated the repository source for the `abomonation_derive` dependency in the Cargo.toml file - Switched from `winston-h-zhang` repository to `lurk-lab` for more updated and maintained versions * chore: add dependabot config
1 parent 76aa073 commit e59041c

7 files changed

Lines changed: 94 additions & 28 deletions

File tree

.config/nextest.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[profile.ci]
2+
# Print out output for failing tests as soon as they fail, and also at the end
3+
# of the run (for easy scrollability).
4+
failure-output = "immediate-final"
5+
# Show skipped tests in the CI output.
6+
status-level = "skip"
7+
# Do not cancel the test run on the first failure.
8+
fail-fast = false
9+
# Mark tests as slow after 5mins, kill them after 20mins
10+
slow-timeout = { period = "300s", terminate-after = 4 }
11+
# Retry failed tests once, marked flaky if test then passes
12+
retries = 1

.github/dependabot.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: cargo
4+
directory: /
5+
pull-request-branch-name:
6+
separator: "-"
7+
schedule:
8+
interval: weekly
9+
groups:
10+
rust-dependencies:
11+
patterns:
12+
- "*"
13+
open-pull-requests-limit: 5
14+
15+
- package-ecosystem: "github-actions"
16+
directory: "/"
17+
schedule:
18+
interval: "weekly"

.github/workflows/rust.yml

Lines changed: 50 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,62 @@
11
name: Build and Test Nova
22

33
on:
4+
merge_group:
45
push:
5-
branches: [ main ]
6+
branches: [ dev ]
67
pull_request:
7-
branches: [ main ]
8+
types: [opened, synchronize, reopened, ready_for_review]
9+
branches: [ dev ]
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
CARGO_INCREMENTAL: 0
14+
CARGO_NET_RETRY: 10
15+
RUSTUP_MAX_RETRIES: 10
16+
RUST_BACKTRACE: short
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
20+
cancel-in-progress: true
821

922
jobs:
1023
build:
1124
runs-on: ubuntu-latest
25+
env:
26+
RUSTFLAGS: -D warnings
1227
steps:
1328
- uses: actions/checkout@v2
14-
- name: Install
15-
run: rustup default stable
16-
- name: Install rustfmt Components
17-
run: rustup component add rustfmt
18-
- name: Install clippy
19-
run: rustup component add clippy
20-
- name: Install Wasm target
21-
run: rustup target add wasm32-unknown-unknown
22-
- name: Build
23-
run: cargo build --verbose
24-
- name: Wasm build
25-
run: cargo build --target wasm32-unknown-unknown
26-
- name: Build examples
27-
run: cargo build --examples --verbose
28-
- name: Build benches
29-
run: cargo build --benches --verbose
30-
- name: Run tests
31-
run: cargo +stable test --release --verbose
32-
- name: Check Rustfmt Code Style
33-
run: cargo fmt --all -- --check
34-
- name: Check clippy warnings
35-
run: cargo clippy --all-targets -- -D warnings
29+
- name: Setup Rust
30+
uses: actions-rs/toolchain@v1
31+
- uses: taiki-e/install-action@nextest
32+
- uses: Swatinem/rust-cache@v2
33+
- name: Build, with benches & examples
34+
run: cargo build --profile dev-ci --benches --examples
35+
- name: Linux Tests in parallel, with nextest profile ci and cargo profile dev-ci
36+
run: |
37+
cargo nextest run --profile ci --workspace --cargo-profile dev-ci
3638
39+
misc:
40+
runs-on: ubuntu-latest
41+
strategy:
42+
fail-fast: false
43+
env:
44+
RUSTFLAGS: -D warnings
45+
steps:
46+
- uses: actions/checkout@v2
47+
- uses: actions-rs/toolchain@v1
48+
with:
49+
components: rustfmt, clippy
50+
- uses: Swatinem/rust-cache@v2
51+
- run: rustup target add wasm32-unknown-unknown
52+
- name: Wasm build
53+
run: cargo build --target wasm32-unknown-unknown
54+
- name: Check Rustfmt Code Style
55+
uses: actions-rs/cargo@v1
56+
with:
57+
command: fmt
58+
args: --all -- --check
59+
- name: Check clippy warnings
60+
run: cargo clippy --all-targets -- -D warnings
61+
- name: Doctests
62+
run: cargo test --doc --workspace

Cargo.toml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ halo2curves = { version = "0.4.0", features = ["derive_serde"] }
3636
group = "0.13.0"
3737
log = "0.4.17"
3838
abomonation = "0.7.3"
39-
abomonation_derive = { git = "https://github.com/winston-h-zhang/abomonation_derive.git" }
39+
abomonation_derive = { git = "https://github.com/lurk-lab/abomonation_derive.git" }
4040

4141
[target.'cfg(any(target_arch = "x86_64", target_arch = "aarch64"))'.dependencies]
4242
pasta-msm = { git="https://github.com/lurk-lab/pasta-msm", branch="dev", version = "0.1.4" }
@@ -88,3 +88,11 @@ supernova = []
8888
# This is needed to ensure halo2curves, which imports pasta-curves, uses the *same* traits in bn256_grumpkin
8989
[patch.crates-io]
9090
pasta_curves = { git="https://github.com/lurk-lab/pasta_curves", branch="dev" }
91+
92+
[profile.dev-ci]
93+
inherits = "dev"
94+
# By compiling dependencies with optimizations, performing tests gets much faster.
95+
opt-level = 3
96+
lto = "thin"
97+
incremental = false
98+
codegen-units = 16

examples/minroot_serde.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ unsafe fn entomb_F<F: PrimeField, W: Write>(f: &F, bytes: &mut W) -> std::io::Re
3636
}
3737

3838
/// this is **incredibly, INCREDIBLY** dangerous
39-
unsafe fn exhume_F<'a, 'b, F: PrimeField>(f: &mut F, bytes: &'a mut [u8]) -> Option<&'a mut [u8]> {
39+
unsafe fn exhume_F<'a, F: PrimeField>(f: &mut F, bytes: &'a mut [u8]) -> Option<&'a mut [u8]> {
4040
let (mine, rest) = bytes.split_at_mut(size_of::<F>());
4141
let mine = (mine as *const [u8]) as *const F;
4242
std::ptr::write(f, std::ptr::read(mine));
@@ -60,7 +60,7 @@ impl<F: PrimeField> abomonation::Abomonation for MinRootIteration<F> {
6060
Ok(())
6161
}
6262

63-
unsafe fn exhume<'a, 'b>(&'a mut self, bytes: &'b mut [u8]) -> Option<&'b mut [u8]> {
63+
unsafe fn exhume<'b>(&mut self, bytes: &'b mut [u8]) -> Option<&'b mut [u8]> {
6464
let bytes = exhume_F(&mut self.x_i, bytes)?;
6565
let bytes = exhume_F(&mut self.y_i, bytes)?;
6666
let bytes = exhume_F(&mut self.x_i_plus_1, bytes)?;
@@ -195,7 +195,7 @@ fn main() {
195195
TrivialTestCircuit<<G2 as Group>::Scalar>,
196196
>::setup(&circuit_primary, &circuit_secondary);
197197
assert!(result.clone() == pp, "not equal!");
198-
assert!(remaining.len() == 0);
198+
assert!(remaining.is_empty());
199199
} else {
200200
println!("Something terrible happened");
201201
}

rust-toolchain

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.70.0

src/gadgets/r1cs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ pub fn conditionally_select_alloc_relaxed_r1cs<
385385
Ok(c)
386386
}
387387

388+
#[allow(dead_code)]
388389
/// c = cond ? a: b, where a, b: vec[AllocatedRelaxedR1CSInstance]
389390
pub fn conditionally_select_vec_allocated_relaxed_r1cs_instance<
390391
G: Group,

0 commit comments

Comments
 (0)