Skip to content

Commit

Permalink
fix(ci): share GitHub runner caches between branches (#4149)
Browse files Browse the repository at this point in the history
* Use shared caches for the CI job

* Fix shared lint Rust caches
  • Loading branch information
teor2345 authored Apr 21, 2022
1 parent e5f00c5 commit 5575b7a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 20 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 5575b7a

Please sign in to comment.