-
Notifications
You must be signed in to change notification settings - Fork 6
/
.gitlab-ci.yml
149 lines (125 loc) · 2.76 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
stages:
- test
- build
- deploy
lint:
image: python:3.8
stage: test
rules:
# skip when building gitlab pages
- if: '$LANDING == null'
when: on_success
- when: never
before_script:
- pip install pre-commit
script:
- pre-commit run -a
tests:
stage: test
image: registry.gitlab.com/scripta/escriptorium/base:kraken529
# Skip tests for base tags since the tests are likely to fail if any api
# of one of the modules changed
# and the tests will be run on the actual build anyway
rules:
- if: '$CI_COMMIT_TAG !~ /^base-.*/ && $LANDING == null'
when: on_success
- when: never
services:
- postgres:15
- redis:alpine
variables:
# Databases settings
REDIS_HOST: redis
REDIS_PORT: 6379
SQL_HOST: postgres
POSTGRES_DB: escriptorium
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
# Pip cache
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
paths:
- .cache/pip
# except:
# - schedules
script:
- pip install -r app/requirements.txt
- python app/manage.py test -v 2 users api versioning imports core
build:
stage: build
image: node:12-alpine
rules:
# skip when building gitlab pages
- if: '$LANDING == null'
when: on_success
- when: never
artifacts:
paths:
- front/dist
expire_in: 2 weeks
before_script:
- cd front
- npm ci
script:
- npm run production
.docker-build:
stage: build
image: docker:19.03.1
rules:
# skip when building gitlab pages
- if: '$LANDING == null'
when: on_success
- when: never
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker:2375/
docker-build-app:
extends: .docker-build
rules:
# skip when building gitlab pages
- if: '$LANDING == null'
when: on_success
- when: never
script:
- ci/build.sh app
docker-build-exim:
extends: .docker-build
rules:
# skip when building gitlab pages
- if: '$LANDING == null'
when: on_success
- when: never
script:
- ci/build.sh exim
docker-build-nginx:
extends: .docker-build
rules:
# skip when building gitlab pages
- if: '$LANDING == null'
when: on_success
- when: never
script:
- ci/build.sh nginx
docker-build-base:
extends: .docker-build
# Run this only on base tags
rules:
- if: '$CI_COMMIT_TAG =~ /^base-.*/'
when: on_success
- when: never
script:
- ci/build-base.sh
pages:
stage: deploy
image: busybox
rules:
# run this job only on manual trigger in GitLab web ui
- if: '$CI_PIPELINE_SOURCE == "web"'
script:
# install npm deps and build storybook
- echo "The site will be deployed to $CI_PAGES_URL"
artifacts:
paths:
- public