Skip to content

Commit

Permalink
GHA workflow: improve caching, clippy
Browse files Browse the repository at this point in the history
* cache ~/.cargo, rather than just the git/ and registry/ subdirectories,
  which should get us ~/.cargo/bin where e.g. cargo-audit lives, so we won't
  rebuild it each time
* fix the cache key names to be properly distinct, and not depend upon
  missing variables (matrix.rust is only present in the 'test' jobs)
* clippy job: use actions-rs/toolchain to get us rustc 'stable', since the
  ubuntu image we're using is out of date (it has 1.40, current stable is
  1.41). It costs 10-20s to install stable=1.41 .
* name the output of the clippy step "clippy results" to reduce the
  irritation of a bug where the results get added as an annotation to a
  random job (sometimes the 'audit' workflow gets a 'clippy' step with the
  results, so now it at least won't look like we're running a duplicate step)
  • Loading branch information
warner committed Feb 6, 2020
1 parent d6f364b commit 8f72cf1
Showing 1 changed file with 18 additions and 28 deletions.
46 changes: 18 additions & 28 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: rustup component add clippy
- name: Cache cargo registry
- name: Cache ~/.cargo
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-clippy-cargo-registry-${{ matrix.rust }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-clippy-cargo-index-${{ matrix.rust }}
path: ~/.cargo
key: ${{ runner.os }}-clippy-dotcargo
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-clippy-cargo-build-target-${{ matrix.rust }}
key: ${{ runner.os }}-clippy-cargo-build-target
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
override: true
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
name: clippy results
test:
runs-on: ubuntu-latest
strategy:
Expand All @@ -48,21 +48,16 @@ jobs:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- name: Cache cargo registry
- name: Cache ~/.cargo
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ matrix.rust }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ matrix.rust }}
path: ~/.cargo
key: ${{ runner.os }}-test-dotcargo-${{ matrix.rust }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ matrix.rust }}
key: ${{ runner.os }}-test-build-target-${{ matrix.rust }}
- name: build --all-targets
uses: actions-rs/cargo@v1
with:
Expand All @@ -81,21 +76,16 @@ jobs:
with:
toolchain: nightly
override: true
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-coverage-cargo-registry-${{ matrix.rust }}
- name: Cache cargo index
- name: Cache ~/.cargo
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-coverage-cargo-index-${{ matrix.rust }}
path: ~/.cargo
key: ${{ runner.os }}-coverage-dotcargo
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-coverage-cargo-build-target-${{ matrix.rust }}
key: ${{ runner.os }}-coverage-cargo-build-target
- uses: actions-rs/tarpaulin@v0.1
- name: upload coverage
uses: codecov/codecov-action@v1
Expand Down

0 comments on commit 8f72cf1

Please sign in to comment.