forked from DataDog/browser-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
233 lines (211 loc) · 5.26 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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
variables:
APP: 'browser-sdk'
CURRENT_CI_IMAGE: 19
BUILD_STABLE_REGISTRY: '486234852809.dkr.ecr.us-east-1.amazonaws.com'
CI_IMAGE: '$BUILD_STABLE_REGISTRY/ci/$APP:$CURRENT_CI_IMAGE'
stages:
- ci-image
- test
- browserstack
- pre-deploy-notify
- deploy
- notify
ci-image:
stage: ci-image
when: manual
except: [tags, schedules]
tags: ['runner:docker', 'size:large']
image: $BUILD_STABLE_REGISTRY/docker:18.03.1
script:
- docker build --tag $CI_IMAGE .
- docker push $CI_IMAGE
format:
stage: test
tags: ['runner:main', 'size:large']
image: $CI_IMAGE
script:
- yarn
- yarn format
typecheck:
stage: test
tags: ['runner:main', 'size:large']
image: $CI_IMAGE
script:
- yarn
- yarn typecheck
build-and-lint:
stage: test
tags: ['runner:main', 'size:large']
image: $CI_IMAGE
script:
- yarn
- yarn build
- yarn lint
- scripts/cli typecheck test/app
build-bundle:
stage: test
tags: ['runner:main', 'size:large']
image: $CI_IMAGE
script:
- yarn
- yarn build:bundle
compatibility:
stage: test
tags: ['runner:main', 'size:large']
image: $CI_IMAGE
script:
- yarn
- yarn test:compat:tsc
- yarn test:compat:ssr
unit:
stage: test
tags: ['runner:main', 'size:large']
image: $CI_IMAGE
artifacts:
reports:
junit: test-report/unit/*.xml
script:
- yarn
- yarn test:unit
- ./scripts/codecov.sh
e2e:
stage: test
tags: ['runner:main', 'size:large']
image: $CI_IMAGE
artifacts:
when: always
paths:
- test-report/e2e/specs.log
reports:
junit: test-report/e2e/*.xml
script:
- yarn
- yarn test:e2e
check-licenses:
stage: test
tags: ['runner:main', 'size:large']
image: $CI_IMAGE
script:
- node --no-warnings scripts/check-licenses.js
unit-bs:
except:
refs:
- master
- tags
stage: browserstack
resource_group: browserstack
tags: ['runner:main', 'size:large']
image: $CI_IMAGE
artifacts:
reports:
junit: test-report/unit-bs/*.xml
script:
- yarn
- ./scripts/ci-bs.sh test:unit
e2e-bs:
except:
refs:
- master
- tags
stage: browserstack
resource_group: browserstack
tags: ['runner:main', 'size:large']
image: $CI_IMAGE
artifacts:
when: always
reports:
junit: test-report/e2e-bs/*.xml
paths:
- test-report/e2e-bs/specs.log
script:
- yarn
- ./scripts/ci-bs.sh test:e2e
deploy-staging:
only:
refs:
- master
stage: deploy
tags: ['runner:main', 'size:large']
image: $CI_IMAGE
script:
- yarn
- BUILD_MODE=staging yarn build:bundle
- ./scripts/deploy.sh staging
deploy-release:
only:
refs:
- tags
stage: deploy
when: manual
allow_failure: false
tags: ['runner:main', 'size:large']
image: $CI_IMAGE
script:
- yarn
- BUILD_MODE=release yarn build:bundle
- ./scripts/deploy.sh prod
########################################################################################################################
# Notify
########################################################################################################################
include: 'https://gitlab-templates.ddbuild.io/slack-notifier/v1/template.yml'
notify-feature-branch-failure:
extends: .slack-notifier.on-failure
except:
refs:
- master
- tags
notify-master-success:
extends: .slack-notifier-base
only:
refs:
- master
script:
- COMMIT_MESSAGE=`git show-branch --no-name HEAD`
- COMMIT_URL="$CI_PROJECT_URL/commits/$CI_COMMIT_SHA"
- 'MESSAGE_TEXT=":rocket: $CI_PROJECT_NAME <$COMMIT_URL|$COMMIT_MESSAGE> deployed to :datadog_staging:."'
- postmessage "#rum-deploy" "$MESSAGE_TEXT"
- postmessage "#rum-ops-stg" "$MESSAGE_TEXT"
notify-master-failure:
extends: .slack-notifier-base
when: on_failure
only:
refs:
- master
script:
- COMMIT_MESSAGE=`git show-branch --no-name HEAD`
- BUILD_URL="$CI_PROJECT_URL/pipelines/$CI_PIPELINE_ID"
- 'MESSAGE_TEXT=":host-red: $CI_PROJECT_NAME master pipeline for <$BUILD_URL|$COMMIT_MESSAGE> failed."'
- postmessage "#rum-deploy" "$MESSAGE_TEXT"
notify-release-ready:
extends: .slack-notifier-base
stage: pre-deploy-notify
only:
refs:
- tags
script:
- COMMIT_MESSAGE=`git show-branch --no-name HEAD`
- BUILD_URL="$CI_PROJECT_URL/pipelines/$CI_PIPELINE_ID"
- 'MESSAGE_TEXT=":i: $CI_PROJECT_NAME <$BUILD_URL|$COMMIT_MESSAGE> ready to be deployed to :datadog:"'
- postmessage "#rum-deploy" "$MESSAGE_TEXT"
notify-release-success:
extends: .slack-notifier-base
only:
refs:
- tags
script:
- COMMIT_MESSAGE=`git show-branch --no-name HEAD`
- COMMIT_URL="$CI_PROJECT_URL/commits/$CI_COMMIT_SHA"
- 'MESSAGE_TEXT=":rocket: $CI_PROJECT_NAME <$COMMIT_URL|$COMMIT_MESSAGE> deployed to :datadog:."'
- postmessage "#rum-deploy" "$MESSAGE_TEXT"
- postmessage "#rum-ops" "$MESSAGE_TEXT"
notify-release-failure:
extends: .slack-notifier-base
when: on_failure
only:
refs:
- tags
script:
- COMMIT_MESSAGE=`git show-branch --no-name HEAD`
- BUILD_URL="$CI_PROJECT_URL/pipelines/$CI_PIPELINE_ID"
- 'MESSAGE_TEXT=":host-red: $CI_PROJECT_NAME release pipeline <$BUILD_URL|$COMMIT_MESSAGE> failed."'
- postmessage "#rum-deploy" "$MESSAGE_TEXT"