fix cache to work as intended by using shared-key #74
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Cargo Build, Test and Bench | |
on: | |
push: | |
paths-ignore: | |
- "*.md" | |
- ".gitignore" | |
pull_request: | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build_and_test: | |
name: ${{ matrix.os }} ${{ matrix.toolchain }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
toolchain: | |
- stable | |
- beta | |
- nightly | |
os: | |
- ubuntu-latest | |
- windows-latest | |
- macos-latest | |
- macos-13 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Rustup update | |
if: matrix.os != 'windows-latest' | |
run: rustup update ${{ matrix.toolchain }} | |
- run: rustup default ${{ matrix.toolchain }} | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-all-crates: true | |
shared-key: ${{ runner.os }}-${{ matrix.toolchain }} | |
- run: cargo build --verbose | |
- run: cargo test --verbose | |
- name: Create measurements | |
run: cargo r --quiet --bin create_measurements --features=generate --release 1_000_000_000 | |
- run: cargo install hyperfine | |
- name: Build release | |
run: cargo build --release | |
- name: Benchmark | |
if: matrix.os != 'windows-latest' | |
run: | | |
python -c "import platform, os; print('OS:', platform.system(), platform.release(), 'Architecture:', platform.machine(), 'CPU threads:', os.cpu_count())" | |
hyperfine --warmup 0 --runs 5 "./target/release/brc-rs" | |
- name: Benchmark | |
if: matrix.os == 'windows-latest' | |
run: | | |
python -c "import platform, os; print('OS:', platform.system(), platform.release(), 'Architecture:', platform.machine(), 'CPU threads:', os.cpu_count())" | |
hyperfine --warmup 0 --runs 5 "target\release\brc-rs.exe" |