Skip to content

7 action cache

7 action cache #21

Workflow file for this run

name: Rust
on:
push:
branches: ["dev"]
pull_request:
branches: ["dev"]
env:
CARGO_TERM_COLOR: always
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Extract version
id: extract-version
run: echo "version=$(grep -oP '^version = "\K[^"]+' Cargo.toml | awk '{$1=$1;print}')" >> $GITHUB_OUTPUT
- name: Cache restore
uses: actions/cache/restore@v3
id: cache-cargo-restore
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ steps.extract-version.outputs.version }}
- name: Run clippy
run: cargo clippy --all-features --all-targets -- -D warnings
- name: Build
run: cargo build
- name: Run tests
run: cargo test
- name: Cache save
if: steps.cache-cargo-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
id: cache-cargo-save
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ steps.cache-cargo-restore.outputs.cache-primary-key }}