fix(ci): share GitHub runner caches between branches (#4149)

* Use shared caches for the CI job

* Fix shared lint Rust caches
This commit is contained in:
teor 2022-04-21 10:33:08 +10:00 committed by GitHub
parent e5f00c5902
commit 5575b7a40e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 1 deletions

View File

@ -2,6 +2,23 @@ name: CI
on:
workflow_dispatch:
# we build Rust and Zcash parameter caches on main,
# so they can be shared by all branches:
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache
push:
branches:
- main
paths:
# production code and test code
- '**/*.rs'
# hard-coded checkpoints
# TODO: skip proptest regressions
- '**/*.txt'
# dependencies
- '**/Cargo.toml'
- '**/Cargo.lock'
# workflow definitions
- '.github/workflows/ci.yml'
pull_request:
paths:
# code and tests

View File

@ -1,6 +1,23 @@
name: Lint Rust files
on:
# we build Rust caches on main, so they can be shared by all branches:
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache
push:
branches:
- main
paths:
# production code and test code
- '**/*.rs'
# hard-coded checkpoints
# TODO: skip proptest regressions
- '**/*.txt'
# dependencies
- '**/Cargo.toml'
- '**/Cargo.lock'
# workflow definitions that change the clippy cache
- '.cargo/config.toml'
- '.github/workflows/ci.yml'
pull_request:
branches:
- 'main'
@ -41,6 +58,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: Swatinem/rust-cache@v1
- name: Run clippy action to produce annotations
uses: actions-rs/clippy-check@v1.0.7
if: ${{ steps.check_permissions.outputs.has-permission }}
@ -76,7 +95,7 @@ jobs:
components: rustfmt
override: true
- uses: Swatinem/rust-cache@v1 # TODO: No cache is being found
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1.0.3
with: