From 2457e95f0ed6c0a121151dc58cea240ba05c443d Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Sun, 18 Mar 2018 05:59:35 +0200 Subject: [PATCH] gitlabci: Improve caching --- .gitlab-ci.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 205bb1a..5ab3a25 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,6 +13,11 @@ stages: before_script: - apt-get update -yqq - apt-get install -yqq --no-install-recommends build-essential libgtk-3-dev meson + + - mkdir -p .cargo_cache + # Only stuff inside the repo directory can be cached + # Override the CARGO_HOME variable to force it location + - export CARGO_HOME="${PWD}/.cargo_cache" script: - rustc -Vv && cargo -Vv # Force regeneration of gresources regardless of artifacts chage @@ -21,6 +26,14 @@ stages: - cargo build - cargo test -- --test-threads=1 - cargo test -- --test-threads=1 --ignored + cache: + # JOB_NAME - Each job will have it's own cache + # COMMIT_REF_SLUG = Lowercase name of the branch + # ^ Keep diffrerent caches for each branch + key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" + paths: + - target/ + - .cargo_cache/ stable:test: # https://hub.docker.com/_/rust/ @@ -50,6 +63,7 @@ flatpak: key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" paths: - .flatpak-builder/cache/ + - target/ # Configure and run rustfmt on nightly # Exits and builds fails if on bad format