diff --git a/.github/workflows/test-and-upload-coverage.yml b/.github/workflows/test-and-upload-coverage.yml index f20860bb7c..64d05cfb87 100644 --- a/.github/workflows/test-and-upload-coverage.yml +++ b/.github/workflows/test-and-upload-coverage.yml @@ -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