diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 111597ee361294cdc2cff5b3f3492f8a84f1f012..b2ad84ad0429a1da20316f05da61e2a9d3b506cb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,13 +6,15 @@ stages: - build - deploy +# get a cache before each stage cache: - untracked: true # In key name, include Docker image to explicit Python version. Ref slug for branch or tag name. key: cache-${CI_JOB_IMAGE}-${CI_COMMIT_REF_SLUG} paths: - .venv/ - ./dist + # add the untracked files to the cache.zip + untracked: true before_script: @@ -23,6 +25,9 @@ dependencies: # Prevent call of before_script because it will fail before_script: - '' + tags: + # run only on runners automatically sharing cache (with 'leximpact-shared-cache' tag) + - leximpact-shared-cache script: - python -m venv .venv - source .venv/bin/activate @@ -31,12 +36,16 @@ dependencies: check-style: stage: test needs: ["dependencies"] + tags: + - leximpact-shared-cache script: - make check-style test: stage: test needs: ["dependencies"] + tags: + - leximpact-shared-cache script: - make test-ci @@ -57,6 +66,7 @@ validate_yaml: check_version: stage: test + # TODO check if this job really needs "dependencies" and explicit why needs: ["dependencies"] script: # Check for functional changes and version number @@ -66,6 +76,8 @@ check_version: build: stage: build + tags: + - leximpact-shared-cache script: - make build @@ -73,6 +85,8 @@ build: # release needed to bypass 'git tag' access rights configuration limited by annual token release-and-tag: stage: deploy + tags: + - leximpact-shared-cache needs: ["build"] # use release-cli to get release name from variable image: registry.gitlab.com/gitlab-org/release-cli:latest @@ -93,6 +107,8 @@ release-and-tag: deploy-wheel: stage: deploy needs: ["build"] + tags: + - leximpact-shared-cache script: - if ! .gitlab/ci/has-functional-changes.sh ; then exit 0 ; fi # publish the wheel knowing that artifacts from all previous stages are passed by default