From 1b10ee20acff1c0e3a3ed23c297f9da5fa049de4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sp=C3=B6ttel?= <1682504+fspoettel@users.noreply.github.com> Date: Sat, 21 Oct 2023 21:22:31 +0200 Subject: [PATCH] ci: enable caching for cargo (#31) --- .github/workflows/ci.yml | 43 ++++++++++++++++++---------------------- src/template/runner.rs | 2 +- 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7cfbf87..5b7b012 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,33 +6,28 @@ env: CARGO_TERM_COLOR: always jobs: - check: - runs-on: ubuntu-latest - name: Check - steps: - - uses: actions/checkout@v3 - - name: cargo check - run: cargo check test: runs-on: ubuntu-latest - name: Test + name: CI steps: - uses: actions/checkout@v3 + - name: Set up cargo cache + uses: actions/cache@v3 + continue-on-error: false + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- - name: cargo test run: cargo test - # uncomment to enable clippy lints - # clippy: - # runs-on: ubuntu-latest - # name: Lint (clippy) - # steps: - # - uses: actions/checkout@v3 - # - name: cargo clippy - # run: cargo clippy -- -D warnings - # uncoment to enable format checking - # fmt: - # runs-on: ubuntu-latest - # name: Format - # steps: - # - uses: actions/checkout@v3 - # - name: cargo fmt - # run: cargo fmt --check +# uncomment to enable clippy linter + # - name: cargo clippy + # run: cargo clippy -- -D warnings +# uncomment to enable format linter + # - name: cargo fmt + # run: cargo fmt --check diff --git a/src/template/runner.rs b/src/template/runner.rs index 5e407eb..5ccde99 100644 --- a/src/template/runner.rs +++ b/src/template/runner.rs @@ -69,7 +69,7 @@ fn bench(func: impl Fn(I) -> T, input: I, base_time: &Duration) -> ( Duration::from_nanos(average_duration(&timers) as u64), - bench_iterations as u128, + bench_iterations, ) }