Skip to content

Commit

Permalink
PR: Try caching rust and go builds
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzadlone committed Jun 17, 2024
1 parent 38f9b9f commit d9f54c3
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/test-and-upload-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,45 @@ jobs:
go-version: "1.21"
check-latest: true

- name: Set cache paths
id: cache-paths
shell: bash
run: |
echo "GO_CACHE=$(go env GOCACHE)" >> "${GITHUB_OUTPUT}"
echo "GO_MODCACHE=$(go env GOMODCACHE)" >> "${GITHUB_OUTPUT}"
echo "CARGO_CACHE=~/.cargo" >> "${GITHUB_OUTPUT}"
- name: Go cache/restore
uses: actions/cache@v4
with:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.mod') }}
path: |
${{ steps.cache-paths.outputs.GO_CACHE }}
${{ steps.cache-paths.outputs.GO_MODCACHE }}
- name: Cargo cache/restore
# A very cool post: https://blog.arriven.wtf/posts/rust-ci-cache
uses: actions/cache@v4
with:
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
# Here are some directories we shouldn't forget about:
# ~/.cargo/.*
# ~/.cargo/bin/
# ~/.cargo/git/db/
# ~/.cargo/registry/cache/
# ~/.cargo/registry/index/
# **/target/*/*.d
# **/target/*/*.rlib
# **/target/*/.fingerprint
# **/target/*/build
# **/target/*/deps
path: |
${{ steps.cache-paths.outputs.CARGO_CACHE }}
**/target/
- name: Restore modified time
uses: chetan/git-restore-mtime-action@v2

- name: Build dependencies
run: |
make deps:modules
Expand Down

0 comments on commit d9f54c3

Please sign in to comment.