diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1e99d1c55..0a4989778 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,35 +23,41 @@ variables: .shared_caches: # Cache for front related jobs - front_cache: &front_cache - - key: front-yarn - paths: [$YARN_CACHE_FOLDER] - - key: - prefix: front-node_modules - files: [front/yarn.lock] - paths: [front/node_modules] - - key: - prefix: front-lint - files: - - front/.eslintcache - - front/tsconfig.tsbuildinfo + yarn_cache: &yarn_cache + key: front-yarn-$CI_COMMIT_REF_SLUG + paths: [$YARN_CACHE_FOLDER] + node_cache: &node_cache + key: + prefix: front-node_modules-$CI_COMMIT_REF_SLUG + files: [front/yarn.lock] + paths: [front/node_modules] + lint_cache: &lint_cache + key: + prefix: front-lint-$CI_COMMIT_REF_SLUG + files: + - front/.eslintcache + - front/tsconfig.tsbuildinfo + cypress_cache: &cypress_cache + key: cypress-cache-$CI_COMMIT_REF_SLUG + paths: + - /root/.cache/Cypress # Cache for api related jobs # Include the python version to prevent loosing caches in the test matrix api_cache: &api_cache - - key: api-pip-$PYTHON_VERSION + - key: api-pip-$CI_COMMIT_REF_SLUG paths: [$PIP_CACHE_DIR] - key: - prefix: api-venv-$PYTHON_VERSION + prefix: api-venv-$CI_COMMIT_REF_SLUG files: [api/poetry.lock] paths: [api/.venv] # Cache for docs related jobs docs_cache: &docs_cache - - key: docs-pip + - key: docs-pip-$CI_COMMIT_REF_SLUG paths: [$PIP_CACHE_DIR] - key: - prefix: docs-venv + prefix: docs-venv-$CI_COMMIT_REF_SLUG files: [docs/poetry.lock] paths: [docs/.venv] @@ -97,7 +103,10 @@ review_front: environment: name: review/front/$CI_COMMIT_REF_NAME url: http://$CI_PROJECT_NAMESPACE.pages.funkwhale.audio/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/front-review/index.html - cache: *front_cache + cache: + - *yarn_cache + - *node_cache + - *lint_cache before_script: - mkdir front-review - cd front @@ -191,7 +200,10 @@ lint_front: - changes: [front/**/*] image: $CI_REGISTRY/funkwhale/ci/node-python:18 - cache: *front_cache + cache: + - *yarn_cache + - *node_cache + - *lint_cache before_script: - cd front - yarn install --frozen-lockfile @@ -276,7 +288,10 @@ test_front: - changes: [front/**/*] image: $CI_REGISTRY/funkwhale/ci/node-python:18 - cache: *front_cache + cache: + - *yarn_cache + - *node_cache + - *lint_cache before_script: - cd front - yarn install --frozen-lockfile @@ -317,10 +332,11 @@ test_integration: name: cypress/included:13.6.4 entrypoint: [''] cache: - - *front_cache - - key: - paths: - - /root/.cache/Cypress + - *yarn_cache + - *node_cache + - *lint_cache + - *cypress_cache + before_script: - cd front - yarn install @@ -402,7 +418,10 @@ build_front: variables: <<: *keep_git_files_permissions NODE_OPTIONS: --max-old-space-size=4096 - cache: *front_cache + cache: + - *yarn_cache + - *node_cache + - *lint_cache before_script: - cd front - yarn install --frozen-lockfile