Skip to content

Commit

Permalink
.github: Only test benchmarks, don't run them (#2042)
Browse files Browse the repository at this point in the history
Instead of fully executing benchmarks, i.e. running multiple iterations,
each measured and recorded, only test that they compile and run them
with a single execution to make sure they work. The benefit is a reduced
CI runtime.

Flag documentation:

> To test that the benchmarks run successfully without performing the
measurement or analysis (eg. in a CI setting), use cargo test --benches.

https://bheisler.github.io/criterion.rs/book/user_guide/command_line_options.html

The above assumes that (a) the benchmark results from CI are likely
noisy and thus (b) no one actually looks at the benchmark results.
  • Loading branch information
mxinden committed Apr 10, 2021
1 parent 2d995a6 commit de261d5
Showing 1 changed file with 3 additions and 35 deletions.
38 changes: 3 additions & 35 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ jobs:
- name: Run tests, with all features
run: cargo test --workspace --all-features

- name: Run benches, with all features
run: cargo test --workspace --benches --all-features

test-wasm:
name: Build on WASM
runs-on: ubuntu-latest
Expand Down Expand Up @@ -140,41 +143,6 @@ jobs:
command: clippy
args: -- -A clippy::type_complexity -A clippy::pedantic -A clippy::style

run-benchmarks:
runs-on: ubuntu-latest
steps:

- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.8.0
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- name: Cache CARGO_HOME
uses: actions/cache@v2.1.4
with:
path: ~/.cargo
key: cargo-home-${{ hashFiles('Cargo.toml') }}

- name: Cache cargo build
uses: actions/cache@v2.1.4
with:
path: target
key: cargo-build-target-${{ hashFiles('Cargo.toml') }}

- name: Run cargo bench
uses: actions-rs/cargo@v1
with:
command: bench
args: --workspace

integration-test:
name: Integration tests
runs-on: ubuntu-latest
Expand Down

0 comments on commit de261d5

Please sign in to comment.