-
Notifications
You must be signed in to change notification settings - Fork 5
/
.gitlab-ci.yml
98 lines (90 loc) · 2.17 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
stages:
- build
- test
- deploy
variables:
POSTGRES_DB: klimaathelpdesk
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
paths:
- .cache/pip
- ~/.cache/pip/
build_frontend:
stage: build
image: node:18-alpine
script:
- yarn --frozen-lockfile
- yarn lint
- yarn build
artifacts:
paths:
- apps/frontend/static
test:
stage: test
image: python:3.10-buster
needs:
- build_frontend
dependencies:
- build_frontend
services:
- postgres:latest
before_script:
- python -V
- pip install --upgrade pip wheel setuptools
- pip install -r requirements/development.txt
script:
- make test ARGS="--ds=settings.gitlab --cov-report term"
coverage: '/TOTAL.*\s+(\d+%)$/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
paths:
- htmlcov/
interruptible: true
.drone_deploy:
image: docker-registry.fourdigits.nl/fourdigits-public/docker-pipeline:latest
stage: deploy
services:
- docker:dind
needs:
- test
script:
- python3 -m fourdigits_cli docker build --push --version=$DEPLOY_VERSION --file=Dockerfile --target=production $DEPLOY_NAME
- python3 -m fourdigits_cli exonet deploy $DEPLOY_NAME $DEPLOY_VERSION
drone_deploy_tst:
extends: .drone_deploy
variables:
DEPLOY_NAME: tst
DEPLOY_VERSION: $CI_COMMIT_SHORT_SHA
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
environment:
name: test
url: https://klimaathelpdesk.tst.fourdigits.dev
drone_deploy_acc:
extends: .drone_deploy
variables:
DEPLOY_NAME: acc
DEPLOY_VERSION: $CI_COMMIT_TAG
rules:
# Only deploy for semver rc release: X.X.XrcX
- if: $CI_COMMIT_TAG =~ /.*rc\d+$/
environment:
name: acceptation
url: https://klimaathelpdesk.acc.fourdigits.dev
drone_deploy_prd:
extends: .drone_deploy
when: manual
variables:
DEPLOY_NAME: prd
DEPLOY_VERSION: $CI_COMMIT_TAG
rules:
# Only deploy on complete semver X.X.X
- if: $CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/
environment:
name: production
url: https://klimaathelpdesk.prd.fourdigits.dev