ci: aggressive caching for api related jobs

Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2286>
environments/review-docs-poetr-umn39l/deployments/16928
jo 2023-01-18 23:51:40 +01:00
rodzic f027c8d04b
commit 7ff81e35f3
1 zmienionych plików z 13 dodań i 6 usunięć

Wyświetl plik

@ -12,6 +12,7 @@ variables:
PIP_CACHE_DIR: $CI_PROJECT_DIR/.cache/pip
YARN_CACHE_FOLDER: $CI_PROJECT_DIR/.cache/yarn
POETRY_VIRTUALENVS_IN_PROJECT: "true"
.shared_variables:
# Keep the git files permissions during job setup
@ -30,6 +31,16 @@ variables:
files: [front/yarn.lock]
paths: [front/node_modules]
# 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
paths: [$PIP_CACHE_DIR]
- key:
prefix: api-venv-$PYTHON_VERSION
files: [api/poetry.lock]
paths: [api/.venv]
default:
tags:
- docker
@ -195,8 +206,7 @@ test_api:
services:
- postgres:15-alpine
- redis:7-alpine
cache:
paths: ["$PIP_CACHE_DIR"]
cache: *api_cache
variables:
DATABASE_URL: "postgresql://postgres@postgres/postgres"
FUNKWHALE_URL: "https://funkwhale.ci"
@ -255,10 +265,7 @@ build_api_schema:
services:
- postgres:15-alpine
- redis:7-alpine
cache:
key: "$CI_PROJECT_ID__pip_cache"
paths:
- "$PIP_CACHE_DIR"
cache: *api_cache
variables:
DATABASE_URL: "postgresql://postgres@postgres/postgres"
FUNKWHALE_URL: "https://funkwhale.ci"