-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy path.gitlab-ci.yml
148 lines (128 loc) · 3.42 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
# You can also use the fallback image from docker hub: thorgate/django-template-base-ci:latest
image: registry.gitlab.com/thorgate-public/django-project-template/base-ci:latest
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay2
DOCKER_BUILDKIT: "1"
COMPOSE_DOCKER_CLI_BUILD: "1"
POETRY_VIRTUALENVS_CREATE: "1"
before_script:
- poetry config cache-dir ${CI_PROJECT_DIR}/.cache
- git config --global user.email "[email protected]"
- git config --global user.name "Foo Bar"
- git config --global init.defaultBranch master
# See the following issue for reasoning: https://gitlab.com/gitlab-org/gitlab-ce/issues/41227
- export SHARED_PATH="$(dirname ${CI_PROJECT_DIR})/shared"
- export TPL_PLAYGROUND="${SHARED_PATH}/tpl-playground"
- mkdir -p $TPL_PLAYGROUND
stages:
- test
# Since CI image publish job only runs from protected branches then new changes to CI
# docker image must be introduced separately from other features. We could move it
# to be the first stage but that would only work for changes merged into the main
# branches.
#
# Note: When you do change the order here consider that:
# - publish-ci-image.sh always tags the image as latest
# - you might need to run publish_ci_image for all branches
- publish_ci_image
.test_tag:
stage: test
except:
- schedules
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- poetry install
- export ENV_FOLDER=`poetry env list | cut -f 1 -d ' '`
- export VIRTUAL_ENV="${CI_PROJECT_DIR}/.cache/virtualenvs/${ENV_FOLDER}"
- export PATH="${VIRTUAL_ENV}/bin:${PATH}"
- pytest -E ${TEST_TAG} --maxfail=1 -vvv
cache:
key: ci-python-cache
paths:
- ${CI_PROJECT_DIR}/.cache/virtualenvs
test_main:
extends: .test_tag
variables:
TEST_TAG: main
test_CELERY:
extends: .test_tag
variables:
TEST_TAG: CELERY
test_STORYBOOK:
extends: .test_tag
variables:
TEST_TAG: STORYBOOK
test_SPA:
extends: .test_tag
variables:
TEST_TAG: SPA
test_debian_SPA:
extends: .test_tag
variables:
TEST_TAG: DEBIAN_SPA
test_debian_WEBAPP:
extends: .test_tag
variables:
TEST_TAG: DEBIAN_WEBAPP
test_mypy_WEBAPP:
extends: .test_tag
variables:
TEST_TAG: MYPY_WEBAPP
test_mypy_SPA:
extends: .test_tag
variables:
TEST_TAG: MYPY_SPA
test_cypress_spa:
extends: .test_tag
variables:
TEST_TAG: CYPRESS_SPA
test_cypress_webapp:
extends: .test_tag
variables:
TEST_TAG: CYPRESS_WEBAPP
test_auto_deploy_generation:
extends: .test_tag
variables:
TEST_TAG: AUTO_DEPLOY
test_frontend_codemods:
stage: test
image: node:12
except:
- schedules
before_script: []
cache:
key:
files:
- codemods/frontend/package.json
paths:
- codemods/frontend/node_modules
script:
- cd codemods/frontend
- yarn install
- yarn test
publish_ci_image:
stage: publish_ci_image
image: docker:latest
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- apk add bash
only:
- master
- spa
- schedules
script:
- ./utils/publish-ci-image.sh ci Dockerfile-ci
publish_base_ci_image:
stage: publish_ci_image
image: docker:latest
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- apk add bash
only:
- master
- spa
- schedules
script:
- ./utils/publish-ci-image.sh base-ci Dockerfile-base-ci