Skip to content

Commit

Permalink
Better CI caching (#81)
Browse files Browse the repository at this point in the history
This PR caches more directories on CI. These new directories are based
on the following suggestions:

* [How I speeded up my Rust builds on GitHub ~30
times](https://ectobit.com/blog/speed-up-github-actions-rust-pipelines/)
* [rust-cache Action](https://github.com/Swatinem/rust-cache)

The `rust-cache` explains some more details on why some directories
should be cached and not others.

Probably in the future, we will use `rust-cache` directly. But for now,
I believe it should be good enough to just cache extra few directories.

I've noticed that `cargo` spends lots of time downloading the registry
and sometimes even fails with spurious network errors. I believe this
caching should address this problem.
  • Loading branch information
chshersh authored Sep 13, 2022
1 parent 4341cc7 commit 56168b1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,14 @@ jobs:
- uses: actions/checkout@v3

- uses: actions/cache@v3
name: Cache ./target
name: Cache cargo
with:
path: target
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target
key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}

- name: Build
Expand Down

0 comments on commit 56168b1

Please sign in to comment.