From 6b37b255636117d0ba85232fbcb2c82cd7bd7bc7 Mon Sep 17 00:00:00 2001 From: Henry de Valence Date: Thu, 28 Jan 2021 11:20:20 -0800 Subject: [PATCH 1/3] Add Github Actions This replaces the Travis CI workflows. (cherry picked from commit d66a5a81f87dae29d0bb1a41bec26c57e6909c28) Signed-off-by: Isis Lovecruft I discarded the portion of the original commit which removed TravisCI. --- .github/workflows/rust.yml | 102 +++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 .github/workflows/rust.yml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..09708d3 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,102 @@ +name: Rust + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +env: + CARGO_TERM_COLOR: always + +jobs: + test-u32: + name: Test u32 backend + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: actions-rs/cargo@v1 + with: + command: test + args: --no-default-features --features "std u32_backend" + + test-u64: + name: Test u64 backend + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: actions-rs/cargo@v1 + with: + command: test + args: --no-default-features --features "std u64_backend" + + test-simd: + name: Test simd backend (nightly) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + - uses: actions-rs/cargo@v1 + with: + command: test + args: --no-default-features --features "std simd_backend" + + test-defaults-serde: + name: Test default feature selection and serde + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: actions-rs/cargo@v1 + with: + command: test + args: --features "serde" + + test-alloc-u32: + name: Test no_std+alloc with u32 backend + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: actions-rs/cargo@v1 + with: + command: test + args: --lib --no-default-features --features "alloc u32_backend" + + bench: + name: Check that benchmarks compile + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: actions-rs/cargo@v1 + with: + command: bench + # This filter selects no benchmarks, so we don't run any, only build them. + args: "DONTRUNBENCHMARKS" From 897f526d42a1f55e56e412cc824771cd484b786d Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Wed, 4 Aug 2021 01:20:15 +0000 Subject: [PATCH 2/3] Run Github actions on any push, and PRs to main and develop. --- .github/workflows/rust.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 09708d3..db237a8 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -2,9 +2,9 @@ name: Rust on: push: - branches: [ main ] + branches: [ '*' ] pull_request: - branches: [ main ] + branches: [ main, develop ] env: CARGO_TERM_COLOR: always From 076cf347bad857c4b237dc9ebbe38ed144ec5af9 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Tue, 17 Aug 2021 00:14:00 +0000 Subject: [PATCH 3/3] Fix non-unique benchmark IDs for newer criterion versions. --- Cargo.toml | 2 +- benches/dalek_benchmarks.rs | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b6ccc62..cd0a4f9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,7 @@ travis-ci = { repository = "dalek-cryptography/curve25519-dalek", branch = "mast [dev-dependencies] sha2 = { version = "0.9", default-features = false } bincode = "1" -criterion = "0.3.0" +criterion = { version = "0.3.0", features = ["html_reports"] } hex = "0.4.2" rand = "0.7" diff --git a/benches/dalek_benchmarks.rs b/benches/dalek_benchmarks.rs index 136d0e7..308545c 100644 --- a/benches/dalek_benchmarks.rs +++ b/benches/dalek_benchmarks.rs @@ -180,12 +180,12 @@ mod multiscalar_benches { dynamic_fraction: f64, ) { for multiscalar_size in &MULTISCALAR_SIZES { - c.bench_with_input( - BenchmarkId::new( - "Variable-time mixed-base multiscalar multiplication ({:.0}pct dyn)", - format!("({:.0}pct dyn)", 100.0 * dynamic_fraction), - ), - &multiscalar_size, + let bench_id = BenchmarkId::new( + "Variable-time mixed-base", + format!("(size: {:?}), ({:.0}pct dyn)", multiscalar_size, 100.0 * dynamic_fraction), + ); + + c.bench_with_input(bench_id, &multiscalar_size, move |b, &&total_size| { let dynamic_size = ((total_size as f64) * dynamic_fraction) as usize; let static_size = total_size - dynamic_size; @@ -221,16 +221,18 @@ mod multiscalar_benches { } fn multiscalar_multiplications(c: &mut Criterion) { - let mut group: BenchmarkGroup<_> = c.benchmark_group("Multiscalar muls"); + let mut group: BenchmarkGroup<_> = c.benchmark_group("Multiscalar multiplications"); consttime_multiscalar_mul(&mut group); vartime_multiscalar_mul(&mut group); vartime_precomputed_pure_static(&mut group); let dynamic_fracs = [0.0, 0.2, 0.5]; + for frac in dynamic_fracs.iter() { vartime_precomputed_helper(&mut group, *frac); } + group.finish(); }