forked from SonarSource/sonarlint-intellij
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.cirrus.yml
287 lines (271 loc) · 10.5 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
env:
CIRRUS_CLONE_DEPTH: "50"
CIRRUS_SHELL: bash
ARTIFACTORY_URL: VAULT[development/kv/data/repox data.url]
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]
BURGR_URL: VAULT[development/kv/data/burgr data.url]
BURGR_USERNAME: VAULT[development/kv/data/burgr data.cirrus_username]
BURGR_PASSWORD: VAULT[development/kv/data/burgr data.cirrus_password]
SONAR_HOST_URL: VAULT[development/kv/data/next data.url]
SONAR_TOKEN: VAULT[development/kv/data/next data.token]
GRADLE_VERSION: "7.6"
auto_cancellation: $CIRRUS_BRANCH != $CIRRUS_DEFAULT_BRANCH
only_pr_and_maintained_branches: &ONLY_PR_AND_MAINTAINED_BRANCHES
skip: "changesIncludeOnly('*.txt', '**/README.md')"
only_if: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_TAG == ""
&& ($CIRRUS_PR != "" || $CIRRUS_BRANCH == $CIRRUS_DEFAULT_BRANCH || $CIRRUS_BRANCH =~ "branch-.*" || $CIRRUS_BRANCH =~ "dogfood-on-.*")
only_main_branches: &ONLY_MAIN_BRANCHES
skip: "changesIncludeOnly('*.txt', '**/README.md')"
only_if: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_TAG == "" && ($CIRRUS_BRANCH == $CIRRUS_DEFAULT_BRANCH || $CIRRUS_BRANCH =~ "branch-.*")
eks_container: &CONTAINER_DEFINITION
image: ${CIRRUS_AWS_ACCOUNT}.dkr.ecr.eu-central-1.amazonaws.com/base:j11-g7-latest
region: eu-central-1
cluster_name: ${CIRRUS_CLUSTER_NAME}
namespace: default
eks_builder_container: &BUILDER_CONTAINER_DEFINITION
<<: *CONTAINER_DEFINITION
dockerfile: .cirrus/Dockerfile
docker_arguments:
CIRRUS_AWS_ACCOUNT: ${CIRRUS_AWS_ACCOUNT}
JDK_VERSION: ${JDK_VERSION}
builder_role: cirrus-builder
builder_image: docker-builder-v*
builder_instance_type: t3.small
builder_subnet_id: ${CIRRUS_AWS_SUBNET}
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
setup_gradle_cache_template: &SETUP_GRADLE_CACHE
gradle_cache:
folder: ~/.gradle/caches
fingerprint_script:
- echo $CIRRUS_OS
- cat **/*.gradle* **/gradle-wrapper.properties || true
populate_script:
- mkdir -p ~/.gradle/caches
cleanup_gradle_cache_script_template: &CLEANUP_GRADLE_CACHE_SCRIPT
cleanup_gradle_script: |
rm -rf ~/.gradle/caches/$GRADLE_VERSION/
rm -rf ~/.gradle/daemon/
rm -rf ~/.gradle/caches/transforms-*
rm -rf ~/.gradle/caches/journal-*
/usr/bin/find ~/.gradle/caches/ -name "*.lock" -type f -delete
build_task:
# name: "Build and stage to repox"
<<: *ONLY_PR_AND_MAINTAINED_BRANCHES
eks_container:
<<: *CONTAINER_DEFINITION
cpu: 4
memory: 8G
env:
ARTIFACTORY_DEPLOY_REPO: sonarsource-public-qa
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]
ORG_GRADLE_PROJECT_signingKey: VAULT[development/kv/data/sign data.key]
ORG_GRADLE_PROJECT_signingPassword: VAULT[development/kv/data/sign data.passphrase]
ORG_GRADLE_PROJECT_signingKeyId: VAULT[development/kv/data/sign data.key_id]
<<: *SETUP_GRADLE_CACHE
build_script: |
source cirrus-env BUILD-PRIVATE
source .cirrus/use-gradle-wrapper.sh
source .cirrus/set_gradle_build_version
regular_gradle_build_deploy_analyze -x build -x sonarqube :buildPlugin :cyclonedxBom
<<: *CLEANUP_GRADLE_CACHE_SCRIPT
validate_task:
# name: "Run UTs and trigger SonarQube analysis"
depends_on:
- build
<<: *ONLY_PR_AND_MAINTAINED_BRANCHES
env:
JDK_VERSION: "11"
eks_container:
<<: *BUILDER_CONTAINER_DEFINITION
cpu: 4
memory: 8G
<<: *SETUP_GRADLE_CACHE
build_script: |
source cirrus-env QA
source .cirrus/use-gradle-wrapper.sh
PULL_REQUEST_SHA=$GIT_SHA1 regular_gradle_build_deploy_analyze check -x :its:check -x artifactoryPublish :runPluginVerifier sonarqube jacocoTestReport
<<: *CLEANUP_GRADLE_CACHE_SCRIPT
on_failure:
reports_artifacts:
path: "**/reports/**/*"
junit_artifacts:
path: "**/test-results/**/*.xml"
format: junit
validate_windows_task:
# name: "Run unit tests on Windows"
depends_on:
- build
<<: *ONLY_PR_AND_MAINTAINED_BRANCHES
ec2_instance:
<<: *WINVM_DEFINITION
<<: *SETUP_GRADLE_CACHE
build_script: |
source cirrus-env QA
source .cirrus/use-gradle-wrapper.sh
PULL_REQUEST_SHA=$GIT_SHA1 regular_gradle_build_deploy_analyze check -x :its:check -x artifactoryPublish -x sonarqube jacocoTestReport
<<: *CLEANUP_GRADLE_CACHE_SCRIPT
on_failure:
reports_artifacts:
path: "**/reports/**/*"
junit_artifacts:
path: "**/test-results/**/*.xml"
format: junit
qa_task:
# name: "Run ITs"
depends_on:
- build
<<: *ONLY_PR_AND_MAINTAINED_BRANCHES
eks_container:
<<: *BUILDER_CONTAINER_DEFINITION
cpu: 4
memory: 16G
env:
CLION_KEY: VAULT[development/team/sonarlint/kv/data/clion.key data.key]
GOLAND_KEY: VAULT[development/team/sonarlint/kv/data/goland.key data.key]
ARTIFACTORY_ACCESS_TOKEN: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader access_token]
GITHUB_TOKEN: VAULT[development/github/token/licenses-ro token]
DISPLAY: :10
JDK_VERSION: "17"
clionKey_file:
path: ${CIRRUS_WORKING_DIR}/its/build/idea-sandbox/config-uiTest/clion.key.b64
variable_name: CLION_KEY
golandKey_file:
path: ${CIRRUS_WORKING_DIR}/its/build/idea-sandbox/config-uiTest/goland.key.b64
variable_name: GOLAND_KEY
matrix:
- env:
IDEA_VERSION: 'IC-2021.3.3'
QA_CATEGORY: 'Idea2021'
- env:
IDEA_VERSION: 'CL-2021.3.3'
QA_CATEGORY: 'CLion2021'
- env:
IDEA_VERSION: 'GO-2021.3.3'
QA_CATEGORY: 'GoLand2021'
- env:
IDEA_VERSION: 'IC-2023.2.1'
QA_CATEGORY: 'Idea2023'
- env:
IDEA_VERSION: 'CL-2023.2'
QA_CATEGORY: 'CLion2023'
- env:
IDEA_VERSION: 'GO-2023.2'
QA_CATEGORY: 'GoLand2023'
<<: *SETUP_GRADLE_CACHE
xvfb_background_script: |
/etc/init.d/xvfb start
prepare_background_script: |
set -euo pipefail
echo "Prepare env and start IDE ${IDEA_VERSION}"
source cirrus-env QA
source .cirrus/use-gradle-wrapper.sh
source .cirrus/set_gradle_build_version
mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.1:unpack -B -Dartifact=org.sonarsource.sonarlint.intellij:sonarlint-intellij:${PROJECT_VERSION}:zip "-DoutputDirectory=${CIRRUS_WORKING_DIR}/staged-plugin"
mkdir -p its/build/idea-sandbox/config-uiTest/
base64 --decode its/build/idea-sandbox/config-uiTest/clion.key.b64 > its/build/idea-sandbox/config-uiTest/clion.key
base64 --decode its/build/idea-sandbox/config-uiTest/goland.key.b64 > its/build/idea-sandbox/config-uiTest/goland.key
metacity --sm-disable --replace &
sleep 10 # give metacity some time to start
gradle :its:runIdeForUiTests --stacktrace -i -PijVersion=${IDEA_VERSION} -PslPluginDirectory=${CIRRUS_WORKING_DIR}/staged-plugin > ${CIRRUS_WORKING_DIR}/runIdeGradle.log &
wait_ide_script: |
echo "Wait for IDE to start"
.cirrus/wait-for-endpoint.sh http://127.0.0.1:8082 -t 500
recording_background_script: |
echo 'Recording tests on video'
ffmpeg -loglevel warning -f x11grab -video_size 1280x960 -i ${DISPLAY} -codec:v libx264 -r 12 ${CIRRUS_WORKING_DIR}/recording_${IDEA_VERSION}.mp4
run_its_script: |
echo "Run ITs on ${IDEA_VERSION}"
source .cirrus/use-gradle-wrapper.sh
gradle :its:check --stacktrace -i -PijVersion=${IDEA_VERSION} -PslPluginDirectory=${CIRRUS_WORKING_DIR}/staged-plugin
<<: *CLEANUP_GRADLE_CACHE_SCRIPT
always:
stop_recording_script: |
pkill -SIGINT -f ffmpeg
while pgrep ffmpeg >/dev/null; do sleep 1; done
/etc/init.d/xvfb stop
display_log_script:
- cat ${CIRRUS_WORKING_DIR}/runIdeGradle.log
test_recording_artifacts:
path: "${CIRRUS_WORKING_DIR}/recording_${IDEA_VERSION}.mp4"
log_artifacts:
path: "its/build/idea-sandbox/system/log"
on_failure:
xvfb_log_artifacts:
path: "${CIRRUS_WORKING_DIR}/Xvfb.out"
reports_artifacts:
path: "**/reports/**/*"
junit_artifacts:
path: "**/test-results/**/*.xml"
format: junit
mend_scan_task:
depends_on:
- build
<<: *ONLY_MAIN_BRANCHES
eks_container:
<<: *CONTAINER_DEFINITION
cpu: 4
memory: 4G
env:
WS_APIKEY: VAULT[development/kv/data/mend data.apikey]
<<: *SETUP_GRADLE_CACHE
mend_script: |
source cirrus-env QA
source .cirrus/use-gradle-wrapper.sh
source .cirrus/set_gradle_build_version
source ws_scan.sh
<<: *CLEANUP_GRADLE_CACHE_SCRIPT
allow_failures: "true"
always:
ws_scan_artifacts:
path: "whitesource/**/*"
promote_task:
depends_on:
- build
- validate
- validate_windows
- qa
- mend_scan
<<: *ONLY_PR_AND_MAINTAINED_BRANCHES
eks_container:
<<: *CONTAINER_DEFINITION
cpu: 3
memory: 4G
env:
GCF_ACCESS_TOKEN: VAULT[development/kv/data/promote data.token]
PROMOTE_URL: VAULT[development/kv/data/promote data.url]
GITHUB_TOKEN: VAULT[development/github/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-promotion token]
# artifacts which will have downloadable links in burgr
ARTIFACTS: org.sonarsource.sonarlint.intellij:sonarlint-intellij:zip
<<: *SETUP_GRADLE_CACHE
promote_script: |
source .cirrus/use-gradle-wrapper.sh
.cirrus/cirrus_promote_gradle
<<: *CLEANUP_GRADLE_CACHE_SCRIPT
dogfood_task:
# name: "Update internal dogfooding plugin repo"
# alias: "update_dogfood_repo"
depends_on:
- promote
only_if: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_TAG == "" && $CIRRUS_BRANCH == $CIRRUS_DEFAULT_BRANCH
eks_container:
<<: *BUILDER_CONTAINER_DEFINITION
cpu: 1
memory: 1G
env:
ARTIFACTORY_API_KEY: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-promoter access_token]
JDK_VERSION: "17"
dogfood_script: |
source cirrus-env QA
source .cirrus/use-gradle-wrapper.sh
source .cirrus/set_gradle_build_version
envsubst '$ARTIFACTORY_URL,$PROJECT_VERSION' <.cirrus/updatePlugins-template.xml >updatePlugins.xml
jfrog rt u updatePlugins.xml sonarsource-public-builds/org/sonarsource/sonarlint/intellij/sonarlint-intellij/ \
--url "${ARTIFACTORY_URL}" --access-token "${ARTIFACTORY_API_KEY}" --build-name "$CIRRUS_REPO_NAME" --build-number "$BUILD_NUMBER"