forked from SonarSource/sonarlint-vscode
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.cirrus.yml
299 lines (278 loc) · 9.83 KB
/
.cirrus.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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
env:
CIRRUS_CLONE_DEPTH: "50"
# Use bash (instead of sh on linux or cmd.exe on Windows)
CIRRUS_SHELL: bash
# Slack
SLACK_TOKEN: VAULT[development/kv/data/slack data.token]
SLACK_CHANNEL: squad-ide-vscode-bots
# repox
ARTIFACTORY_URL: https://repox.jfrog.io/artifactory
ARTIFACTORY_PRIVATE_USERNAME: vault-${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader
ARTIFACTORY_PRIVATE_PASSWORD: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader access_token]
ARTIFACTORY_DEPLOY_USERNAME: vault-${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-qa-deployer
ARTIFACTORY_DEPLOY_PASSWORD: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-qa-deployer access_token]
ARTIFACTORY_DEPLOY_REPO: sonarsource-public-qa
NPM_CONFIG_registry: https://repox.jfrog.io/artifactory/api/npm/npm
NPM_CONFIG_//repox.jfrog.io/artifactory/api/npm/:_authToken: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader access_token]
ARTIFACTORY_PRIVATE_READER_USERNAME: $ARTIFACTORY_PRIVATE_USERNAME
ARTIFACTORY_PRIVATE_READER_PASSWORD: $ARTIFACTORY_PRIVATE_PASSWORD
GPG_SIGNING_KEY: VAULT[development/kv/data/sign data.key]
GPG_SIGNING_PASSPHRASE: VAULT[development/kv/data/sign data.passphrase]
auto_cancellation: $CIRRUS_BRANCH != $CIRRUS_DEFAULT_BRANCH
eks_container: &CONTAINER_DEFINITION
dockerfile: .cirrus/Dockerfile
docker_arguments:
CIRRUS_AWS_ACCOUNT: ${CIRRUS_AWS_ACCOUNT}
JDK_VERSION: 17
region: eu-central-1
cluster_name: ${CIRRUS_CLUSTER_NAME}
builder_role: cirrus-builder
builder_image: docker-builder-v*
builder_instance_type: t3.large
builder_subnet_id: ${CIRRUS_AWS_SUBNET}
namespace: default
ec2_instance: &WINVM_DEFINITION
experimental: true
image: base-windows-jdk17-v*
platform: windows
region: eu-central-1
subnet_id: ${CIRRUS_AWS_SUBNET}
type: t3.xlarge
skip_master_branch_and_allvsix_branch: &SKIP_MASTER_BRANCH_AND_ALLVSIX_BRANCH
only_if: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_TAG == ""
&& ($CIRRUS_BRANCH != $CIRRUS_DEFAULT_BRANCH && $CIRRUS_BRANCH !=~ ".*allvsix")
only_master_or_allvsix_branch: &ONLY_MASTER_BUILD_OR_ALLVSIX_BRANCH
only_if: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_TAG == ""
&& ($CIRRUS_BRANCH == $CIRRUS_DEFAULT_BRANCH || $CIRRUS_BRANCH =~ ".*allvsix")
only_if_with_nightly: &ONLY_IF_WITH_NIGHTLY
skip: "changesIncludeOnly('docs/*', '**/README.md')"
only_if: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_TAG == ""
only_if_except_nightly: &ONLY_IF_EXCEPT_NIGHTLY
skip: "changesIncludeOnly('docs/*', '**/README.md')"
only_if: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_TAG == "" && $CIRRUS_BUILD_SOURCE != "cron"
only_pr_and_maintained_branches: &ONLY_PR_AND_MAINTAINED_BRANCHES
skip: "changesIncludeOnly('docs/*', '**/README.md')"
only_if: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_TAG == "" && $CIRRUS_BUILD_SOURCE != "cron"
&& ($CIRRUS_PR != "" || $CIRRUS_BRANCH == $CIRRUS_DEFAULT_BRANCH || $CIRRUS_BRANCH =~ "branch-.*" || $CIRRUS_BRANCH =~ "dogfood-on-.*")
only_main_branches: &ONLY_MAIN_BRANCHES
skip: "changesIncludeOnly('docs/*', '**/README.md')"
only_if: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_TAG == "" && ($CIRRUS_BRANCH == $CIRRUS_DEFAULT_BRANCH || $CIRRUS_BRANCH =~ "branch-.*")
node_modules_cache_template: &NODE_MODULES_CACHE_TEMPLATE
node_modules_cache:
folder: "node_modules"
fingerprint_script:
- node --version
- cat package-lock.json
populate_script: npm ci
build_task:
<<: *ONLY_IF_WITH_NIGHTLY
eks_container:
<<: *CONTAINER_DEFINITION
cpu: 2
memory: 2G
<<: *NODE_MODULES_CACHE_TEMPLATE
setup_script:
- source cirrus-env BUILD # Generates a build number
- echo $BUILD_NUMBER
- export PACKAGE_VERSION=$(npm pkg get version | tr -d \" | sed "s|-SNAPSHOT|+$BUILD_NUMBER|g")
- echo PACKAGE_VERSION=${PACKAGE_VERSION}
on_failure:
slack_notification_script: |
source slack-failure-notification
universal_vsix_task:
depends_on: build
<<: *SKIP_MASTER_BRANCH_AND_ALLVSIX_BRANCH
eks_container:
<<: *CONTAINER_DEFINITION
cpu: 2
memory: 2G
<<: *NODE_MODULES_CACHE_TEMPLATE
deploy_script:
- source cirrus-env QA # Retrieve build number
- npm run deploy-universal
on_failure:
slack_notification_script: |
source slack-failure-notification
all_vsix_task:
<<: *ONLY_MASTER_BUILD_OR_ALLVSIX_BRANCH
depends_on: build
eks_container:
<<: *CONTAINER_DEFINITION
cpu: 4
memory: 4G
<<: *NODE_MODULES_CACHE_TEMPLATE
deploy_all_script:
- source cirrus-env QA # Retrieve build number
- npm run deploy-all
on_failure:
slack_notification_script: |
source slack-failure-notification
test_windows_task:
# name: Run tests on Windows
depends_on:
- build
<<: *ONLY_IF_EXCEPT_NIGHTLY
ec2_instance:
<<: *WINVM_DEFINITION
<<: *NODE_MODULES_CACHE_TEMPLATE
env:
NODE_ENV: 'continuous-integration'
script:
- source cirrus-env QA
- export packageVersion=$(npm pkg get version | tr -d \")
- npm run compile
- npm run prepare
- npm run test-cov
always:
unit_tests_artifacts:
path: '**/alltests.xml'
format: junit
on_failure:
slack_notification_script: |
source slack-failure-notification
test_linux_task:
# name: Run tests, Sonarqube analysis on Linux
depends_on:
- build
<<: *ONLY_IF_EXCEPT_NIGHTLY
eks_container:
<<: *CONTAINER_DEFINITION
cpu: 4
memory: 4G
env:
DISPLAY: ":10"
SONARQUBE_NEXT_TOKEN: VAULT[development/kv/data/next data.token]
SONARQUBE_NEXT_URL: VAULT[development/kv/data/next data.url]
<<: *NODE_MODULES_CACHE_TEMPLATE
start_xvfb_background_script:
- /etc/init.d/xvfb start
script:
- sleep 5
- source cirrus-env QA
- npm run compile
- npm run prepare
- npm run test-cov
- .cirrus/cirrus_sonar_analysis_npm
always:
unit_tests_artifacts:
path: '**/alltests.xml'
format: junit
on_failure:
slack_notification_script: |
source slack-failure-notification
mend_scan_task:
depends_on:
- build
<<: *ONLY_MAIN_BRANCHES
eks_container:
<<: *CONTAINER_DEFINITION
<<: *NODE_MODULES_CACHE_TEMPLATE
env:
WS_APIKEY: VAULT[development/kv/data/mend data.apikey]
JDK_VERSION: "17"
whitesource_script:
- source cirrus-env QA # read build number
- export PROJECT_VERSION=$(npm pkg get version | tr -d \" | sed "s|-SNAPSHOT||g")
- export WS_PROJECTNAME="${CIRRUS_REPO_FULL_NAME} ${PROJECT_VERSION}"
- source ws_scan.sh
allow_failures: "true"
always:
ws_artifacts:
path: "whitesource/**/*"
on_failure:
slack_notification_script: |
source slack-failure-notification
qa_task:
# name: Run ITs
depends_on:
- universal_vsix
- all_vsix
<<: *ONLY_IF_EXCEPT_NIGHTLY
eks_container:
<<: *CONTAINER_DEFINITION
cpu: 4
memory: 4G
<<: *NODE_MODULES_CACHE_TEMPLATE
matrix:
- env:
QA_CATEGORY: oldest
VSCODE_VERSION: '1.73.0'
- env:
QA_CATEGORY: stable
VSCODE_VERSION: 'stable'
- env:
QA_CATEGORY: insiders
VSCODE_VERSION: 'insiders'
env:
DISPLAY: ":10"
RECORD_FILENAME: "${CIRRUS_WORKING_DIR}/record_vscode_${QA_CATEGORY}.mp4"
start_xvfb_background_script:
- /etc/init.d/xvfb start
prepare_tests_script:
- sleep 5 # ensure xvfb is up
- source cirrus-env QA
- export PROJECT_VERSION=$(npm pkg get version | tr -d \" | sed "s|-SNAPSHOT|+$BUILD_NUMBER|g")
- echo "Download staged vsix for ${PROJECT_VERSION}"
- mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.1:copy -B --settings ~/.m2/settings.xml -Denable-repo=qa -Dartifact=org.sonarsource.sonarlint.vscode:sonarlint-vscode:$PROJECT_VERSION:vsix -DoutputDirectory=$CIRRUS_WORKING_DIR
- cd its
- npm ci
start_screen_recording_background_script:
- ffmpeg -f x11grab -video_size 1280x960 -i ${DISPLAY} -codec:v libx264 -r 12 ${RECORD_FILENAME}
test_script:
- source cirrus-env QA
- cd its
- npm test
stop_screen_recording_script:
- pkill -SIGINT -f ffmpeg
- while pgrep ffmpeg >/dev/null; do sleep 1; done
- /etc/init.d/xvfb stop
dump_code_logs_script:
- .cirrus/dump_code_logs
always:
its_tests_artifacts:
path: '**/*tests.xml'
format: junit
its_test_recording_artifacts:
path: ${RECORD_FILENAME}
on_failure:
slack_notification_script: |
source slack-failure-notification
promote_task:
env:
ARTIFACTORY_PROMOTE_ACCESS_TOKEN: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-promoter access_token]
GITHUB_TOKEN: VAULT[development/github/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-promotion token]
depends_on:
- qa
- test_windows
- test_linux
<<: *ONLY_PR_AND_MAINTAINED_BRANCHES
eks_container:
<<: *CONTAINER_DEFINITION
cpu: 2
memory: 2G
<<: *NODE_MODULES_CACHE_TEMPLATE
promote_script:
- source cirrus-env PROMOTE
- export PROJECT_VERSION=$(npm pkg get version | tr -d \" | sed "s|-SNAPSHOT|+$BUILD_NUMBER|g")
- cirrus_jfrog_promote
- github-notify-promotion
on_failure:
slack_notification_script: |
source slack-failure-notification
dogfood_task:
depends_on:
- promote
# Dogfood task is only executed after successful promotion of a non-cron build from master
only_if: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_TAG == "" && $CIRRUS_BRANCH == $CIRRUS_DEFAULT_BRANCH && $CIRRUS_BUILD_SOURCE != "cron"
eks_container:
<<: *CONTAINER_DEFINITION
cpu: 2
memory: 2G
env:
ARTIFACTORY_API_USER: vault-${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-promoter
ARTIFACTORY_API_KEY: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-promoter access_token]
dogfood_script:
- .cirrus/cirrus_dogfood_npm
on_failure:
slack_notification_script: |
source slack-failure-notification