-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
187 lines (168 loc) · 3.67 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
include:
- project: 'makeorg/infrastructure/pipeline/templates'
file: 'pipelines/monorepo.yml'
# Stage
stages:
- check
- build
- deploy
- migrate
- merge
# Workflow
workflow:
rules:
- !reference [.rules, on-merge-request]
- !reference [.rules, on-protected-branch]
# Rule
.rules-apps:
on-front-changes:
changes:
- .gitlab-ci.yml
- package/**/*
- package.json
- yarn.lock
- apps/front/**/*
- cypress/integration/front/*.feature
- cypress/integration/common/*.feature
- cypress/integration/*.feature
- cypress/support/**
variables:
APP_NAME: make-front
APP_WORKSPACE: '@make.org/front'
APP_CYPRESS_TASK: ci:cypress:front
IMAGE_NAME: $NEXUS_URL/make-front
IMAGE_APP_TARGET: app-production
IMAGE_APP_PATH: apps/front/Dockerfile
RUNDECK_JOB_ID: $RUNDECK_FRONT_JOB_ID
on-widget-changes:
changes:
- .gitlab-ci.yml
- package/**/*
- package.json
- yarn.lock
- apps/widget/**/*
- cypress/integration/widget/*.feature
- cypress/integration/common/*.feature
- cypress/integration/*.feature
- cypress/support/**
variables:
APP_NAME: make-widget
APP_WORKSPACE: '@make.org/widget'
APP_CYPRESS_TASK: ci:cypress:widget
IMAGE_NAME: $NEXUS_URL/make-widget
IMAGE_APP_TARGET: widget-production
IMAGE_APP_PATH: apps/widget/Dockerfile
RUNDECK_JOB_ID: $RUNDECK_WIDGET_JOB_ID
# Template
.on-front-merge-request:
rules:
- !reference [.rules, never-on-protected-branch]
- !reference [.rules-apps, on-front-changes]
.on-widget-merge-request:
rules:
- !reference [.rules, never-on-protected-branch]
- !reference [.rules-apps, on-widget-changes]
.front:
rules:
- !reference [.rules, never-if-environment-mismatch-branch]
- !reference [.rules-apps, on-front-changes]
.widget:
rules:
- !reference [.rules, never-if-environment-mismatch-branch]
- !reference [.rules-apps, on-widget-changes]
.check:
stage: check
extends: .on-merge-request
tags:
- large
variables:
YARN_VERSION: '3.2.3'
image: node:18.17-alpine
before_script:
- node -v
- corepack enable yarn
- corepack prepare
- yarn install
.integration:
extends: .check
image: cypress/browsers:node-18.16.0-chrome-114.0.5735.133-1-ff-114.0.2-edge-114.0.1823.51-1
variables:
CYPRESS_CACHE_FOLDER: '$CI_PROJECT_DIR/cache_cypress'
script:
- yarn workspace "$APP_WORKSPACE" build
- yarn "$APP_CYPRESS_TASK"
artifacts:
expire_in: 1 week
when: always
paths:
- cypress/screenshots
- cypress/videos
- cypress/coverage
# Check
lint:
extends: .check
script:
- yarn eslint ./
check-types:
extends: .check
script:
- yarn tsc --noEmit
test:
extends: .check
script:
- yarn jest --coverage
artifacts:
expire_in: 1 week
when: always
paths:
- coverage
jscpd:
extends: .check
script:
- yarn jscpd
artifacts:
expire_in: 1 week
when: always
paths:
- reports
integration-front:
extends:
- .integration
- .on-front-merge-request
integration-widget:
extends:
- .integration
- .on-widget-merge-request
# Build
build-make-front:
extends:
- .build
- .front
build-make-widget:
extends:
- .build
- .widget
# Deploy
deploy-preproduction-front:
extends:
- .deploy
- .preprod
- .front
deploy-preproduction-widget:
extends:
- .deploy
- .preprod
- .widget
deploy-production-front:
extends:
- .deploy
- .prod
- .front
deploy-production-widget:
extends:
- .deploy
- .prod
- .widget
# Merge
merge-to-prod:
extends: .merge