Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add caching w/ actions/cache@v3 #172

Merged
merged 1 commit into from
Oct 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
$VCPKG_DEFAULT_BINARY_CACHE
key: ${{ runner.os }}-cargo-stable-${{ hashFiles('Cargo.lock') }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to only notice this now but you probably want a separate restore-key here to use the cache even if Cargo.lock changes otherwise every dependency bump will completely invalidate the cache.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I'm fine with invalidating the cache a little bit too often rather than too rarely. Also, Cargo.lock is ideally only touched very rarely. I.e. I don't want to set up dependabot or run cargo update too regularly. It's just for testing and development purposes.

- uses: egor-tensin/vs-shell@v2
with:
arch: amd64
Expand Down Expand Up @@ -105,6 +115,15 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{matrix.toolchain}}-${{ hashFiles('Cargo.lock') }}
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
Expand All @@ -126,6 +145,15 @@ jobs:
uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-stable-${{ hashFiles('Cargo.lock') }}
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Install rust toolchain
Expand Down