ci: Use lockfile as cache key
This ensures we don't keep stale builds of dependencies around.
This commit is contained in:
parent
2301b45887
commit
0388aa282e
1 changed files with 16 additions and 4 deletions
|
|
@ -1,13 +1,22 @@
|
|||
variables:
|
||||
CARGO_HOME: $CI_PROJECT_DIR/cargo
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- $CARGO_HOME
|
||||
- target/
|
||||
# Default cache for Rust jobs - keyed on Cargo.lock to prune stale dependencies
|
||||
.rust_cache: &rust_cache
|
||||
cache:
|
||||
key:
|
||||
files:
|
||||
- Cargo.lock
|
||||
paths:
|
||||
- $CARGO_HOME/bin/
|
||||
- $CARGO_HOME/registry/index/
|
||||
- $CARGO_HOME/registry/cache/
|
||||
- $CARGO_HOME/git/db/
|
||||
- target/
|
||||
|
||||
build-release:
|
||||
image: rust:latest
|
||||
<<: *rust_cache
|
||||
script:
|
||||
- cargo build --verbose --release
|
||||
artifacts:
|
||||
|
|
@ -17,17 +26,20 @@ build-release:
|
|||
|
||||
test:
|
||||
image: rust:latest
|
||||
<<: *rust_cache
|
||||
script:
|
||||
- cargo test --verbose --release
|
||||
|
||||
format_check:
|
||||
image: rust:latest
|
||||
<<: *rust_cache
|
||||
script:
|
||||
- rustup component add rustfmt
|
||||
- cargo fmt -- --check
|
||||
|
||||
clippy:
|
||||
image: rust:latest
|
||||
<<: *rust_cache
|
||||
script:
|
||||
- rustup component add clippy
|
||||
- cargo clippy -- -D warnings
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue