2022-06-10 16:45:04 +01:00
|
|
|
stages:
|
|
|
|
- build
|
|
|
|
- test
|
|
|
|
|
|
|
|
static:
|
|
|
|
image: node:alpine
|
|
|
|
stage: build
|
|
|
|
cache:
|
2022-06-10 16:56:07 +01:00
|
|
|
key: npm-$CI_COMMIT_REF_SLUG
|
2022-06-10 16:45:04 +01:00
|
|
|
paths:
|
2022-06-10 16:56:07 +01:00
|
|
|
- "$CI_PROJECT_DIR/.npm-cache"
|
2022-06-12 19:42:15 +01:00
|
|
|
before_script:
|
|
|
|
- apk add --no-cache bash
|
2022-06-10 16:45:04 +01:00
|
|
|
script:
|
2022-06-10 16:56:07 +01:00
|
|
|
- npm ci --cache .npm-cache --prefer-offline
|
2022-06-10 16:45:04 +01:00
|
|
|
- npm run build
|
|
|
|
artifacts:
|
|
|
|
name: '$CI_JOB_ID-node_modules'
|
|
|
|
paths:
|
|
|
|
- ./node_modules
|
|
|
|
- ./static/build
|
|
|
|
expire_in: 30 mins
|
|
|
|
|
|
|
|
pip:
|
2022-07-28 23:20:06 +01:00
|
|
|
image: python:3.10
|
2022-06-10 16:45:04 +01:00
|
|
|
stage: build
|
2022-06-10 16:56:07 +01:00
|
|
|
variables:
|
|
|
|
PIP_CACHE_DIR: $CI_PROJECT_DIR/.pip-cache
|
|
|
|
cache:
|
|
|
|
key: pip-$CI_COMMIT_REF_SLUG
|
|
|
|
paths:
|
|
|
|
- "$CI_PROJECT_DIR/.pip-cache"
|
2022-06-10 16:45:04 +01:00
|
|
|
script:
|
|
|
|
- python -m venv env
|
|
|
|
- source env/bin/activate
|
2022-07-28 18:55:47 +01:00
|
|
|
- pip install -r requirements/dev.txt
|
2022-06-10 16:45:04 +01:00
|
|
|
artifacts:
|
|
|
|
name: 'pip-$CI_JOB_ID'
|
|
|
|
paths:
|
|
|
|
- ./env/
|
|
|
|
expire_in: 30 mins
|
|
|
|
|
2022-07-28 14:42:12 +01:00
|
|
|
container:
|
|
|
|
image: docker:stable
|
2022-07-28 17:25:13 +01:00
|
|
|
services:
|
|
|
|
- docker:dind
|
|
|
|
variables:
|
|
|
|
DOCKER_BUILDKIT: 1
|
2022-08-03 22:52:51 +01:00
|
|
|
dependencies: []
|
2022-07-28 14:42:12 +01:00
|
|
|
stage: test
|
|
|
|
script:
|
2022-08-03 22:39:11 +01:00
|
|
|
- docker build -t website --target production .
|
2022-07-28 14:42:12 +01:00
|
|
|
|
2022-06-10 17:14:30 +01:00
|
|
|
.python_test_template: &python_test_template
|
2022-07-28 23:20:06 +01:00
|
|
|
image: python:3.10
|
2022-06-10 16:45:04 +01:00
|
|
|
stage: test
|
|
|
|
dependencies:
|
|
|
|
- pip
|
|
|
|
before_script:
|
|
|
|
- source env/bin/activate
|
2022-06-10 16:56:25 +01:00
|
|
|
variables:
|
|
|
|
SECRET_KEY: super-secret
|
2022-06-10 17:14:30 +01:00
|
|
|
|
|
|
|
test_python:
|
2022-07-28 20:41:30 +01:00
|
|
|
services:
|
|
|
|
- postgres:13-alpine
|
|
|
|
variables:
|
|
|
|
DATABASE_URL: postgres://postgres@postgres/postgres
|
2022-06-10 17:14:30 +01:00
|
|
|
script:
|
2022-06-12 15:58:06 +01:00
|
|
|
- ./manage.py collectstatic --noinput --clear
|
2022-06-10 16:45:04 +01:00
|
|
|
- ./manage.py test
|
2022-07-28 20:41:30 +01:00
|
|
|
<<: *python_test_template
|
2022-08-03 22:39:28 +01:00
|
|
|
dependencies:
|
|
|
|
- pip
|
|
|
|
- static
|
2022-06-10 17:14:30 +01:00
|
|
|
|
|
|
|
django_checks:
|
|
|
|
<<: *python_test_template
|
|
|
|
script:
|
|
|
|
- ./manage.py check
|
|
|
|
- ./manage.py makemigrations --check --noinput
|
2022-06-12 15:17:28 +01:00
|
|
|
|
2022-06-12 15:52:45 +01:00
|
|
|
black:
|
|
|
|
<<: *python_test_template
|
|
|
|
script:
|
2022-07-29 08:46:44 +01:00
|
|
|
- black --check .
|
2022-06-12 15:52:45 +01:00
|
|
|
|
|
|
|
isort:
|
|
|
|
<<: *python_test_template
|
|
|
|
script:
|
2022-07-29 08:46:44 +01:00
|
|
|
- isort --check .
|
2022-06-12 15:52:45 +01:00
|
|
|
|
|
|
|
flake8:
|
|
|
|
<<: *python_test_template
|
|
|
|
script:
|
2022-07-29 08:46:44 +01:00
|
|
|
- flake8
|
2022-06-12 15:52:45 +01:00
|
|
|
|
|
|
|
mypy:
|
2022-06-12 15:17:28 +01:00
|
|
|
<<: *python_test_template
|
|
|
|
script:
|
2022-07-29 08:46:44 +01:00
|
|
|
- mypy .
|
2022-06-12 19:35:06 +01:00
|
|
|
|
2022-08-03 20:22:02 +01:00
|
|
|
curlylint:
|
|
|
|
<<: *python_test_template
|
|
|
|
script:
|
|
|
|
- curlylint .
|
|
|
|
|
2022-08-03 20:37:34 +01:00
|
|
|
djhtml:
|
|
|
|
<<: *python_test_template
|
|
|
|
script:
|
|
|
|
- git ls-files '*.html' | xargs djhtml --check --tabwidth 2
|
|
|
|
|
2022-08-03 20:55:09 +01:00
|
|
|
npm_lint:
|
2022-08-03 22:35:55 +01:00
|
|
|
image: node:alpine
|
|
|
|
stage: test
|
|
|
|
dependencies:
|
|
|
|
- static
|
2022-06-12 19:35:06 +01:00
|
|
|
script:
|
|
|
|
- npm run lint
|
2022-07-28 18:55:47 +01:00
|
|
|
|
|
|
|
pip_tools:
|
|
|
|
<<: *python_test_template
|
|
|
|
script:
|
|
|
|
- ./scripts/compile-requirements.sh
|
|
|
|
- git diff
|
|
|
|
- git diff-index --quiet HEAD --
|