diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ac33269a6..da25ac9ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 185db3e74..5a90a5573 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -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: