-
Notifications
You must be signed in to change notification settings - Fork 20
/
.gitlab-ci.yml
488 lines (444 loc) · 12.2 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
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
# (c) https://github.com/MontiCore/monticore
image: registry.git.rwth-aachen.de/monticore/container-registry/gradle:7.6.4-jdk11
#include:
# - template: Code-Quality.gitlab-ci.yml
#
variables:
MC_MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2"
GRADLE_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2"
MC_MAVEN_CLI_OPTS: "--settings settings.xml --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn"
SONAR_OPTS: "-Dsonar.login=$sonarUser -Dsonar.password=$sonarPassword"
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
# Cache the gradle build cache
cache:
key: gradle-cache-key
paths:
- .gradle/caches
policy: pull-push
stages:
- build
- test
- deploy
- mirror
- trigger_languages
- sonar
- report
- check
build:
stage: build
script:
- "cd monticore-generator && gradle build $GRADLE_OPTS -Pci -i"
- "cd .. && gradle buildMC $GRADLE_OPTS -Pci -PgenTR=true -PgenEMF=true -PgenTagging=true -i --max-workers=4 --stacktrace"
artifacts:
when: always
paths:
- ".gradle"
- "*/target"
- "*/.gradle"
expire_in: 1 week
reports:
junit: '**/target/test-results/test/**/TEST-*.xml'
only:
- merge_requests
- branches
except:
- master
# Checks if the links in this repository's Markdown files are valid.
#
# For more information, visit: https://git.rwth-aachen.de/se/infrastructure/mdlinkchecker (Available internally only)
check-links:
# We need a JDK 17+ image for this job since the link checker requires Java 17.
image: eclipse-temurin:17-jdk-alpine
# The check runs parallel to the build since project documentation is not generated.
stage: build
# Allow failure regardless of whether the tool exists with a non-zero error code. We don't currently want to fail the
# pipeline if a link is invalid.
allow_failure: true
before_script:
- 'apk --no-cache add curl'
script:
- 'curl --location --header "PRIVATE-TOKEN: $secibuildinfstrtoken" "https://git.rwth-aachen.de/api/v4/projects/se%2Finfrastructure%2Fmdlinkchecker/jobs/artifacts/master/raw/target/libs/MDLinkCheckerCLI.jar?job=build" --output MDLinkChecker.jar'
- 'java -jar MDLinkChecker.jar -t "$secibuildtoken" -r . -p'
artifacts:
when: always
reports:
junit: '**/target/test-results/test/**/TEST-*.xml'
test_01experiments:
stage: test
dependencies:
- build
script:
- "gradle -p monticore-test/01.experiments build $GRADLE_OPTS -PgenEMF=true -PgenTagging=true -Pci --max-workers=4 --stacktrace"
artifacts:
when: always
reports:
junit: '**/target/test-results/test/**/TEST-*.xml'
only:
- merge_requests
- branches
except:
- master
test_02experiments:
stage: test
dependencies:
- build
script:
- "gradle -p monticore-test/02.experiments build $GRADLE_OPTS -PgenEMF=true -Pci --max-workers=4 --stacktrace"
artifacts:
when: always
reports:
junit: '**/target/test-results/test/**/TEST-*.xml'
only:
- merge_requests
- branches
except:
- master
test_it:
stage: test
dependencies:
- build
script:
- "gradle -p monticore-test/it build $GRADLE_OPTS -Pci --max-workers=4 --stacktrace"
# This check must run in a stage where the monticore-generator was executed, otherwise no relevant file handles are opened.
# Problems can be investigated on small examples projects with https://github.com/jenkinsci/lib-file-leak-detector
- echo "Checking that all file handles in the target folder are closed"
- if pgrep java | xargs -i ls -la /proc/{}/fd | grep "monticore-test/it/target/"; then echo "Found open file handles!"; exit 1; else echo "No open file handles."; exit 0; fi
artifacts:
when: always
reports:
junit: '**/target/test-results/test/**/TEST-*.xml'
only:
- merge_requests
- branches
except:
- master
test_it_emf:
stage: test
dependencies:
- build
script:
- "gradle -p monticore-test/it build -PbuildProfile=emf -PgenEMF=true $GRADLE_OPTS -Pci --max-workers=4 --stacktrace"
artifacts:
when: always
reports:
junit: '**/target/test-results/test/**/TEST-*.xml'
only:
- merge_requests
- branches
except:
- master
test_grammar_it:
stage: test
dependencies:
- build
script:
- "gradle -p monticore-test/monticore-grammar-it build $GRADLE_OPTS -PgenEMF=true -Pci --max-workers=4 --stacktrace"
artifacts:
when: always
reports:
junit: '**/target/test-results/test/**/TEST-*.xml'
only:
- merge_requests
- branches
except:
- master
test_montitrans:
stage: test
dependencies:
- build
script:
- "gradle -p monticore-test/montitrans build $GRADLE_OPTS -PgenTR=true -PgenEMF=true -PgenTagging=true -Pci --max-workers=4 --stacktrace"
artifacts:
when: always
reports:
junit: '**/target/test-results/test/**/TEST-*.xml'
only:
- merge_requests
- branches
except:
- master
deploy:
stage: deploy
dependencies:
- build
script:
- "gradle deployMC -PmavenPassword=$password -PmavenUser=$username $GRADLE_OPTS -PgenTR=true -PgenEMF=true -PgenTagging=true -Pci --max-workers=4"
only:
- dev
except:
- master
checkMLCs:
stage: check
needs: ["build"]
dependencies:
- build
script:
- "gradle checkArtifacts --max-workers=4"
artifacts:
name: mlcreports
when: always
paths:
- "**/target/reports/"
expire_in: 1 week
only:
- merge_requests
- branches
except:
- master
sonar:
stage: check
needs: ["build"]
dependencies:
- build
script:
- "gradle sonarMC $GRADLE_OPTS $SONAR_OPTS -Pci"
allow_failure: true
only:
- dev
except:
- master
trigger-automata:
stage: trigger_languages
allow_failure: true
trigger:
project: monticore/languages/automaton
branch: master
only:
- dev
trigger-cd4a-dev:
stage: trigger_languages
trigger:
project: monticore/cd4analysis/cd4analysis
branch: develop
only:
- dev
trigger-sd-dev:
stage: trigger_languages
trigger:
project: monticore/statechart/sd-language
branch: dev
only:
- dev
trigger-fd-dev:
stage: trigger_languages
trigger:
project: monticore/languages/feature-diagram
branch: develop
only:
- dev
trigger-guidsl-dev:
stage: trigger_languages
trigger:
project: monticore/languages/gui-dsl
branch: dev
only:
- dev
trigger-json-dev:
stage: trigger_languages
trigger:
project: monticore/languages/json
branch: develop
only:
- dev
trigger-ma-dev:
stage: trigger_languages
trigger:
project: monticore/montiarc/core
branch: develop
only:
- dev
trigger-ocl-dev:
stage: trigger_languages
trigger:
project: monticore/languages/OCL
branch: develop
only:
- dev
trigger-montifun-dev:
stage: trigger_languages
trigger:
project: monticore/languages/montifun
branch: dev
only:
- dev
trigger-sc-dev:
stage: trigger_languages
trigger:
project: monticore/statechart/sc-language
branch: dev
only:
- dev
trigger-xml-dev:
stage: trigger_languages
trigger:
project: monticore/languages/xml
branch: develop
only:
- dev
trigger-od-dev:
stage: trigger_languages
trigger:
project: monticore/languages/od
branch: dev
only:
- dev
trigger-umlp-dev:
stage: trigger_languages
trigger:
project: monticore/umlp
branch: dev
only:
- dev
trigger-ucd-dev:
stage: trigger_languages
trigger:
project: monticore/languages/ucd
branch: dev
only:
- dev
trigger-cd4a-master:
stage: trigger_languages
trigger:
project: monticore/cd4analysis/cd4analysis
branch: master
only:
- master
trigger-sd-master:
stage: trigger_languages
trigger:
project: monticore/statechart/sd-language
branch: master
only:
- master
trigger-fd-master:
stage: trigger_languages
trigger:
project: monticore/languages/feature-diagram
branch: master
only:
- master
trigger-guidsl-master:
stage: trigger_languages
trigger:
project: monticore/languages/gui-dsl
branch: master
only:
- master
trigger-json-master:
stage: trigger_languages
trigger:
project: monticore/languages/json
branch: master
only:
- master
trigger-ma-master:
stage: trigger_languages
trigger:
project: monticore/montiarc/core
branch: master
only:
- master
trigger-ocl-master:
stage: trigger_languages
trigger:
project: monticore/languages/OCL
branch: master
only:
- master
trigger-montifun-main:
stage: trigger_languages
trigger:
project: monticore/languages/montifun
branch: main
only:
- master
trigger-sc-master:
stage: trigger_languages
trigger:
project: monticore/statechart/sc-language
branch: master
only:
- master
trigger-xml-master:
stage: trigger_languages
trigger:
project: monticore/languages/xml
branch: master
only:
- master
trigger-od-master:
stage: trigger_languages
trigger:
project: monticore/languages/od
branch: master
only:
- master
# A lite version of the MontiVerse to detect the results of potential changes before they are merged
trigger-montiverse-ci:
stage: test
trigger:
project: monticore/montiverseci
variables:
MONTICORE_BRANCH: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
FULL_MC: "false" # Do not run the experiments in the MontiVerse pipeline
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && ($CI_MERGE_REQUEST_EVENT_TYPE == 'detached' || $CI_MERGE_REQUEST_EVENT_TYPE == 'merged_result')
pages:
stage: report
dependencies: []
image: python:alpine
before_script:
- apk add gcc musl-dev python3-dev
- pip install cython
- pip install mkdocs
- pip install mkdocs-material
script:
- sh docs/scripts/preprocessing.sh
- mkdocs build
- mv site public
artifacts:
paths:
- public
only:
- schedules
# Mirrors this repository's `dev` and `master` branches to GitHub.
#
# The mirror will always be at either HEAD or HEAD+1 (depending on whether cleanup is necessary).
# For more information, visit: https://git.rwth-aachen.de/se/infrastructure/github-mirror-tools (Available internally only)
githubmirror:
# We need a JDK 17+ image for this job since the link checker requires Java 17.
image: eclipse-temurin:17-jdk-alpine
stage: mirror
variables:
# The repository is edited during this job. To make sure that no changes persist, we instruct GitLab to always
# create a fresh clone of the repository instead of caching it and attempting to remove any changes.
#
# See https://docs.gitlab.com/ee/ci/runners/configure_runners.html#git-strategy
GIT_STRATEGY: clone
dependencies: []
before_script:
- 'apk --no-cache add curl git openssh-client'
- eval $(ssh-agent -s)
- ssh-add <(echo "$SE_CIBUILD_SSH_PRIV_KEY")
- echo "$SE_CIBUILD_SSH_PRIV_KEY" | tr -d '\r' | ssh-add -
- git config --global user.email "[email protected]"
- git config --global user.name "MontiCore Mirroring Bot"
- git checkout "$CI_COMMIT_REF_NAME" # GitLab checks out a commit in detached HEAD mode by default, but we want to commit to the branch and push.
- mkdir -p ~/.ssh
- echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
script:
- 'curl --location --header "PRIVATE-TOKEN: $secibuildinfstrtoken" "https://git.rwth-aachen.de/api/v4/projects/se%2Finfrastructure%2Fgithub-mirror-tools/repository/files/mirror.sh/raw" --output mirror.sh'
- sh mirror.sh
- rm mirror.sh
- 'curl --location --header "PRIVATE-TOKEN: $secibuildinfstrtoken" "https://git.rwth-aachen.de/api/v4/projects/se%2Finfrastructure%2Fmdlinkchecker/jobs/artifacts/master/raw/target/libs/MDLinkCheckerCLI.jar?job=build" --output MDLinkChecker.jar'
- 'java -jar MDLinkChecker.jar -t "$secibuildtoken" -r . -p -c -i'
- 'rm MDLinkChecker.jar'
- git add --all
# We'll simply ignore failures during commit because there is a chance that no files were changed. In this case the
# remote will be on the same commit as the upstream repository.
- (git commit -m "[Mirror] Replace all internal links and references") || true
- git remote add github [email protected]:MontiCore/monticore.git
- git push github $CI_COMMIT_BRANCH --force
rules:
- when: never