-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitlab-ci.yml
351 lines (330 loc) · 7.75 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
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
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
before_script:
- CHCP 65001
stages:
- build
- test
- report
- release
health check:
stage: .pre
variables:
GIT_STRATEGY: none
when: on_success
tags:
- OneS
script:
- choco list
- scoop list
timeout: 10m
install-chocolatey:
stage: .pre
variables:
GIT_STRATEGY: none
when: manual
tags:
- OneScript
script:
- Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
timeout: 10m
install-chocolatey-curl-dependencies:
stage: .pre
variables:
GIT_STRATEGY: none
when: manual
tags:
- OneScript
script:
- choco install -r --no-progress curl -y
timeout: 10m
needs:
- job: install-chocolatey
install-chocolatey-java-dependencies:
stage: .pre
variables:
GIT_STRATEGY: none
when: manual
tags:
- OneScript
script:
- choco install -r --no-progress libericajdk -y
timeout: 10m
needs:
- job: install-chocolatey
install-scoop:
stage: .pre
variables:
GIT_STRATEGY: none
when: manual
tags:
- OneScript
script:
- Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser;
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
timeout: 10m
install-scoop-allure-dependencies:
stage: .pre
variables:
GIT_STRATEGY: none
when: manual
tags:
- OneScript
script:
- scoop install allure
timeout: 10m
needs:
- job: install-scoop
install-scoop-sonar-dependencies:
stage: .pre
variables:
GIT_STRATEGY: none
when: manual
tags:
- OneScript
script:
- scoop install sonar-scanner
timeout: 10m
needs:
- job: install-scoop
install-scoop-git-cliff-dependencies:
stage: .pre
variables:
GIT_STRATEGY: none
when: manual
tags:
- OneScript
script:
- scoop install git-cliff
timeout: 10m
needs:
- job: install-scoop
install-scoop-releasecli-dependencies:
stage: .pre
variables:
GIT_STRATEGY: none
when: manual
tags:
- OneScript
script:
- scoop install gitlab-release-cli
timeout: 10m
needs:
- job: install-scoop
install-oscript:
stage: .pre
variables:
GIT_STRATEGY: none
OVM_DOWNLOAD_URL: https://github.com/oscript-library/ovm/releases/download/v1.2.2/ovm.exe
OPM_DOWNLOAD_URL: https://github.com/oscript-library/opm/releases/download/v1.0.4/opm-1.0.4.ospx
when: manual
tags:
- OneScript
script:
- tools\scripts\install-oscript-local.bat
timeout: 10m
needs:
- job: install-chocolatey
- job: install-chocolatey-curl-dependencies
install-package-dependencies:
stage: .pre
variables:
GIT_STRATEGY: none
when: manual
tags:
- OneScript
script:
# устанавливаем 'opm' и устанавливаем зависимости 'vanessa-ci-scripts' из 'packagedef'
- opm install opm;
opm install
timeout: 10m
needs:
- job: install-oscript
build:
stage: build
rules:
- if: '$CI_COMMIT_TAG != null'
tags:
- OneScript
script:
- opm run build
# get the job id and save it as environment statement
- echo BUILD_JOB_ID=$CI_JOB_ID >> CI_JOB_ID.env
timeout: 10m
artifacts:
paths:
- .\build\vanessa-ci-scripts-$CI_COMMIT_TAG.ospx
- CHANGELOG.md
- README.md
name: vanessa-ci-scripts
reports:
# export the environment statement so we can access it in the release stage
dotenv: CI_JOB_ID.env
expire_in: 30 day
1testrunner:
stage: test
variables:
GIT_STRATEGY: none
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ /^develop/'
- changes:
- src/*
- features/*
- tasks/*
- tests/*
tags:
- OneScript
script:
- opm run test
timeout: 10m
artifacts:
reports:
junit:
out/junit/*.xml
paths:
- out/junit/
expire_in: 30 day
coverage:
stage: test
variables:
GIT_STRATEGY: none
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- changes:
- src/*
- features/*
- tasks/*
- tests/*
tags:
- OneScript
script:
- opm run coverage
timeout: 10m
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage/coverage.xml
junit:
out/genericexec/*.xml
paths:
- coverage/
- out/genericexec/
expire_in: 30 day
needs:
- job: 1testrunner
SonarQube:
stage: report
variables:
GIT_STRATEGY: clone
SONAR_SCANNER_OPTS: "-Dfile.encoding=UTF8 -Dsun.jnu.encoding=UTF8 -Xmx6G"
allow_failure: true
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- changes:
- src/*
- features/*
- tasks/*
- tests/*
tags:
- OneScript
script:
# - $VERSION = sls -Path .\opm-metadata.xml -Pattern "<Version>(?<ver>\d\.\d\.\d)" -All | % { $_.Matches.Groups } | ? {$_.Name -eq "ver" } | % Value
# - sonar-scanner -D sonar.token=$SONAR_TOKEN -D sonar.projectVersion=$VERSION
- opm run sonar-scanner
timeout: 10m
needs:
- job: coverage
artifacts: true
Allure:
stage: report
variables:
GIT_STRATEGY: none
allow_failure: true
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ /^develop/'
- changes:
- src/*
- features/*
- tasks/*
- tests/*
tags:
- OneScript
script:
- opm run allure-generate
timeout: 10m
artifacts:
paths:
- out/allure-report
needs:
- job: 1testrunner
pages:
stage: report
variables:
GIT_STRATEGY: none
allow_failure: true
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- changes:
- src/*
- features/*
- tasks/*
- tests/*
tags:
- OneScript
script:
- mkdir public;
move out/allure-report public
timeout: 10m
artifacts:
paths:
- public
needs:
- job: Allure
artifacts: true
- job: SonarQube
package:
stage: release
variables:
GIT_STRATEGY: none
rules:
- !reference [build, rules]
tags:
- OneScript
script:
# Use variables to build a URL to access the artifacts
# ${CI_PROJECT_URL} is the repository URL
# ${BUILD_JOB_ID} is from the previous job,
# the build stage, that contains the artifact
- Invoke-WebRequest -outfile artifacts.zip -Header @{"PRIVATE-TOKEN"=$PROJ_AUTH} -Method Get -uri "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/${BUILD_JOB_ID}/artifacts"
- Invoke-WebRequest -UseBasicParsing -Header @{"JOB-TOKEN"=$CI_JOB_TOKEN} -Infile artifacts.zip -Method Put -uri "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/$CI_COMMIT_TAG/$CI_COMMIT_TAG/vanessa-ci-scripts.zip"
timeout: 10m
needs:
- job: build
artifacts: true
release:
stage: release
variables:
GIT_STRATEGY: none
rules:
- !reference [build, rules]
tags:
- OneScript
script:
- echo "release release_job for $CI_COMMIT_TAG"
# - $file = "${CI_PROJECT_URL}/-/jobs/${BUILD_JOB_ID}/artifacts/file/build/vanessa-ci-scripts-${CI_COMMIT_TAG}.ospx"
- $file = "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/$CI_COMMIT_TAG/$CI_COMMIT_TAG/vanessa-ci-scripts.zip"
- echo $file
- $assets = @{}
- $assets.Add("name", "vanessa-ci-scripts.zip")
- $assets.Add("url", $file)
- $assets = $assets | ConvertTo-Json
- $assets = $assets.replace('"','\"')
- release-cli create
--name "Release $CI_COMMIT_TAG"
--description "[CHANGELOG.md]($CI_PROJECT_URL/-/raw/$CI_DEFAULT_BRANCH/CHANGELOG.md)"
--tag-name "$CI_COMMIT_TAG"
--ref "$CI_COMMIT_SHA"
--assets-link=$assets
- echo "application successfully released."
timeout: 10m
needs:
- job: package