Skip to content

Commit

Permalink
chore: better rust build caching (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanielc authored Sep 15, 2023
1 parent 826bfc8 commit e8e9c26
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
30 changes: 23 additions & 7 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,40 @@ on:

env:
CARGO_TERM_COLOR: always
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"

jobs:
build:

check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
# Cache rust/cargo build steps
- uses: Swatinem/rust-cache@v2
with:
# The prefix cache key, this can be changed to start a new cache manually.
# default: "v0-rust"
prefix-key: "v2"
- name: Build
run: make build
prefix-key: v0
# Cache only the cargo registry
cache-targets: false
- uses: mozilla-actions/[email protected]
- name: Check fmt
run: make check-fmt
- name: Check clippy
run: make check-clippy

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
# The prefix cache key, this can be changed to start a new cache manually.
# default: "v0-rust"
prefix-key: v0
# Cache only the cargo registry
cache-targets: false
- uses: mozilla-actions/[email protected]
- name: Build
run: make build
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ check-fmt:
.PHONY: check-clippy
check-clippy:
# Check with default features
cargo clippy --workspace --all-targets -- -D warnings
cargo clippy --workspace -- -D warnings
# Check with all features
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo clippy --workspace --all-features -- -D warnings

.PHONY: publish-docker
publish-docker:
Expand Down

0 comments on commit e8e9c26

Please sign in to comment.