-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
190 lines (179 loc) · 3.74 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
188
189
190
image: node:14
stages:
- build
- test
- deploy
- e2e
## Set environment variables for folders in "cache" job settings for npm modules and Cypress binary
variables:
npm_config_cache: '$CI_PROJECT_DIR/.npm'
CYPRESS_CACHE_FOLDER: '$CI_PROJECT_DIR/cache/Cypress'
# cache:
# # Define a cache with the key: ${CI_COMMIT_REF_SLUG} so that jobs of each branch always use the same cache
# key: ${CI_COMMIT_REF_SLUG}
# paths:
# # - cache/Cypress
# - ./src/client/node_modules/
# - ./src/functions/node_modules/
# - ./src/remoteCodeExecution/node_modules/
build-frontend:
stage: build
cache:
key: frontend-cache
paths:
- ./src/client/node_modules/
script:
- cd src/client
- yarn
- yarn build
artifacts:
expire_in: 1 mos
paths:
- ./src/client/build/
only:
changes:
- src/client/**/*
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
test-frontend:
stage: test
cache:
key: frontend-cache
paths:
- ./src/client/node_modules/
policy: pull
script:
- cd src/client
- yarn
- yarn test --watchAll=false
only:
changes:
- src/client/**/*
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
test-backend:
stage: test
cache:
key: backend-cache
paths:
- ./src/functions/node_modules/
script:
- cd src/functions
- npm i
- npm run test:unit
only:
changes:
- src/functions/**/*
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
test-backend-integration:
stage: test
services:
- mongo
cache:
key: backend-cache
paths:
- ./src/functions/node_modules/
script:
- cd src/functions
- npm i
- npm run test:integration
only:
changes:
- src/functions/**/*
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
test-RCE:
stage: test
cache:
key: rce-cache
paths:
- ./src/remoteCodeExecution/node_modules/
script:
- cd src/remoteCodeExecution
- npm i
- npm run test:unit
only:
changes:
- src/remoteCodeExecution/**/*
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
deploy-backend:
stage: deploy
before_script:
- npm i -g firebase-tools
script:
- cd src/functions
- npm i --production # don't install dev dependencies
- firebase deploy --only functions --token $FIREBASE_TOKEN
cache: {} # Disable globally defined cache
dependencies: [] # Don't download artifacts
only:
refs:
- master
changes:
- src/functions/**/*
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
deploy-frontend:
stage: deploy
before_script:
- npm i -g firebase-tools
script:
- cd src/client
- yarn install --prod # don't install dev dependencies
- yarn build
- firebase deploy --only hosting --token $FIREBASE_TOKEN
cache: {} # Disable globally defined cache
dependencies: [] # Don't download artifacts
only:
refs:
- master
changes:
- src/client/**/*
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
prod-e2e:
image: cypress/browsers:node14.16.0-chrome89-ff86
stage: e2e
script:
- cd src/e2e
- cypress run --browser chrome
when: delayed
start_in: 10 minutes
cache: {} # Disable globally defined cache
dependencies: [] # Don't download artifacts
only:
refs:
- master
changes:
- src/remoteCodeExecution/**/*
- src/functions/**/*
- src/client/**/*
- src/e2e/**/*
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure