Commit 0bb71987 authored by Alfredo Di Napoli's avatar Alfredo Di Napoli

CI cache optimisation

parent 77da92ae
Pipeline #4351 failed
# Thanks to:
# https://vadosware.io/post/zero-to-continuous-integrated-testing-a-haskell-project-with-gitlab/
#
#
image: adinapoli/gargantext:v2
# Optimising CI speed by using tips from https://blog.nimbleways.com/let-s-make-faster-gitlab-ci-cd-pipelines/
image: adinapoli/gargantext:v2.1
variables:
STACK_ROOT: "${CI_PROJECT_DIR}/.stack-root"
STACK_OPTS: "--system-ghc"
CABAL_STORE_DIR: "${CI_PROJECT_DIR}/.cabal"
#before_script:
#- apt-get update
#- apt-get install make xz-utils
FF_USE_FASTZIP: "true"
ARTIFACT_COMPRESSION_LEVEL: "fast"
CACHE_COMPRESSION_LEVEL: "fast"
stages:
- stack
......@@ -22,45 +18,30 @@ stages:
stack:
stage: stack
cache:
# cache per branch name
# key: ${CI_COMMIT_REF_SLUG}
key:
files:
- stack.yaml
paths:
- .stack-root/
- .stack-work/
- target
- dist-newstyle/
- .cabal/
script:
- echo "Building the project from '$CI_PROJECT_DIR'"
- nix-shell --run "stack build --no-terminal --haddock --no-haddock-deps --only-dependencies --fast --dry-run"
docs:
stage: docs
cache:
# cache per branch name
# key: ${CI_COMMIT_REF_SLUG}
paths:
- .stack-root/
- .stack-work/
- target
script:
- nix-shell --run "stack build --no-terminal --haddock --no-haddock-deps --fast --dry-run"
- cp -R "$(stack path --local-install-root)"/doc ./output
artifacts:
paths:
- ./output
expire_in: 1 week
allow_failure: true
- nix-shell --run "stack build --no-terminal --fast --dry-run"
cabal:
stage: cabal
cache:
# cache per branch name
# key: ${CI_COMMIT_REF_SLUG}
key:
files:
- cabal.project
paths:
- .stack-root/
- .stack-work/
- dist-newstyle/
- target
- .cabal/
policy: pull-push
script:
- nix-shell --run "./bin/update-cabal-project $CABAL_STORE_DIR && cabal --store-dir=$CABAL_STORE_DIR v2-build"
allow_failure: false
......@@ -68,14 +49,35 @@ cabal:
test:
stage: test
cache:
# cache per branch name
# key: ${CI_COMMIT_REF_SLUG}
key:
files:
- gargantext.cabal
paths:
- .stack-root/
- .stack-work/
- dist-newstyle/
- target
- .cabal/
policy: pull
script:
- nix-shell --run "./bin/update-cabal-project $CABAL_STORE_DIR && cabal --store-dir=$CABAL_STORE_DIR v2-test --test-show-details=streaming"
docs:
stage: docs
cache:
paths:
- .stack-root/
- .stack-work/
- dist-newstyle/
- .cabal/
- target
policy: pull
script:
- nix-shell --run "stack build --no-terminal --haddock --no-haddock-deps --fast --dry-run"
- cp -R "$(stack path --local-install-root)"/doc ./output
rules:
- if: '$CI_MERGE_REQUEST_IID' # Run job on Merge Requests
artifacts:
paths:
- ./output
expire_in: 1 week
allow_failure: true
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment