Skip to content
Snippets Groups Projects
Commit 0fcadef3 authored by Eduardo Trujillo's avatar Eduardo Trujillo
Browse files

CI: Only push to cache when needed

parent fbb67cfc
No related branches found
No related tags found
1 merge request!1Rust Rewrite
......@@ -6,11 +6,6 @@ stages:
- image
.rust_template: &rust_template
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- cargo/
- target/
before_script:
- export CARGO_HOME="$CI_PROJECT_DIR/cargo"
- rustup --version
......@@ -20,6 +15,11 @@ stages:
rust-nightly:
stage: build
image: rustlang/rust:nightly
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- cargo/
- target/
<<: *rust_template
script:
- cargo build --verbose
......@@ -27,6 +27,12 @@ rust-nightly:
rust-nightly-test:
stage: test
image: rustlang/rust:nightly
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- cargo/
- target/
policy: pull
<<: *rust_template
script:
- cargo test --verbose -j 1
......@@ -34,6 +40,12 @@ rust-nightly-test:
rust-nightly-fmt:
stage: format
image: rustlang/rust:nightly
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- cargo/
- target/
policy: pull
<<: *rust_template
script:
- cargo fmt --all --verbose -- --check
......@@ -41,6 +53,11 @@ rust-nightly-fmt:
rust-nightly-clippy:
stage: lint
image: rustlang/rust:nightly
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- cargo/
- target/
<<: *rust_template
script:
- cargo clippy --all --verbose -- -D warnings
......@@ -50,6 +67,12 @@ rust-nightly-docker:
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- cargo/
- target/
policy: pull
script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment