diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c58098212d..2f478d406d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -155,6 +155,7 @@ jobs: - run: sh mk/package.sh shell: bash + # Intentionally excludes benchmarks for build performance reasons. test: # Don't run duplicate `push` jobs for the repo owner's PRs. if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository @@ -322,6 +323,28 @@ jobs: (!contains(matrix.host_os, 'macos') || matrix.mode != '--release') }} run: mk/check-symbol-prefixes.sh --target=${{ matrix.target }} + test-bench: + # Don't run duplicate `push` jobs for the repo owner's PRs. + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository + + runs-on: ubuntu-22.04 + + steps: + - run: sudo apt-get update -y + + - uses: briansmith/actions-checkout@v2 + with: + persist-credentials: false + + - run: mk/install-build-tools.sh --target=x86_64-unknown-linux-gnu + + - uses: briansmith/actions-rs-toolchain@v1 + with: + override: true + toolchain: stable + + - run: cargo test -p ring-bench --all-features --all-targets + # XXX: GitHub Actions won't let us test all the combinations of features in # the "test" matrix because the resultant matrix would be larger than the # maximum they allow. diff --git a/Cargo.toml b/Cargo.toml index cd6c608612..676a3e36df 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -192,9 +192,6 @@ libc = { version = "0.2.100", default-features = false } [build-dependencies] cc = { version = "1.0.69", default-features = false } -[dev-dependencies] -criterion = { version = "0.4", default-features = false } - [features] # These features are documented in the top-level module's documentation. default = ["alloc", "dev_urandom_fallback"] @@ -225,10 +222,9 @@ lto = true debug-assertions = false codegen-units = 1 -[[bench]] -name = "aead" -harness = false - -[[bench]] -name = "x25519" -harness = false +[workspace] +members = [ + # intentionally not a default member so that `cargo test` doesn't cause criterion.rs and all its + # dependencies to get built. + "bench", +] diff --git a/bench/Cargo.toml b/bench/Cargo.toml new file mode 100644 index 0000000000..3beccd2f5a --- /dev/null +++ b/bench/Cargo.toml @@ -0,0 +1,21 @@ +[package] +edition = "2021" +name = "ring-bench" +publish = false +version = "0.1.0" + +[dependencies] +ring = { path = "../" } + +[dev-dependencies] +criterion = { version = "0.4", default-features = false } + +[[bench]] +name = "aead" +harness = false +path = "aead.rs" + +[[bench]] +name = "x25519" +harness = false +path = "x25519.rs" diff --git a/benches/aead.rs b/bench/aead.rs similarity index 100% rename from benches/aead.rs rename to bench/aead.rs diff --git a/benches/x25519.rs b/bench/x25519.rs similarity index 100% rename from benches/x25519.rs rename to bench/x25519.rs