-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
184 lines (172 loc) · 6.23 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
# (c) https://github.com/MontiCore/monticore
# Build JAVA applications using Gradle (https://gradle.org/)
stages:
- build
- post-build
- test
- post-test
- report
- check
- mirror
Build:
image: registry.git.rwth-aachen.de/monticore/container-registry/gradle:7.6.4-jdk11
stage: build
allow_failure: false
artifacts:
paths:
- applications/**/build/
- build-logic/.gradle/
- build-logic/build/
- generators/**/build/
- languages/build/
- libraries/**/build/
- tooling/language-server/build/generated-sources/MontiArcWithCD4A/plugins/montiarcwithcd4a-intellij-plugin/build/distributions/
- .gradle/
expire_in: 1 week
script:
- gradle clean assemble
Verify Formatting:
stage: test
image: registry.git.rwth-aachen.de/monticore/container-registry/gradle:7.6.4-jdk11
dependencies:
- Build
needs: ["Build"]
allow_failure: false
script:
- gradle spotlessCheck
Package:
image: registry.git.rwth-aachen.de/monticore/container-registry/gradle:7.6.4-jdk11
stage: post-build
dependencies:
- Build
needs: ["Build"]
allow_failure: false
script:
- gradle shadowjar
.unit_test_template: &unit_test_definition
stage: test
dependencies:
- Build
needs: ["Build"]
script:
- gradle test jacocoAggregatedTestReport
- awk -F","
'{ instructions += $4 + $5; covered += $5 } END
{ print covered, "/", instructions, " instructions covered"; print 100*covered/instructions, "% covered" }'
'build/reports/test-coverage/jacocoAggregated.csv'
coverage: '/\d+.\d+ \% covered/'
artifacts:
reports:
junit: ./**/test-results/test/**/TEST-*.xml
paths:
- generators/ma2java/build/reports/test-coverage/jacoco.xml
- languages/build/basis/reports/test-coverage/jacoco.xml
- languages/build/montiarc/reports/test-coverage/jacoco.xml
when: always
Unit Test:
image: registry.git.rwth-aachen.de/monticore/container-registry/gradle:7.6.4-jdk11
allow_failure: false
<<: *unit_test_definition
Test Coverage:
stage: post-test
image: registry.gitlab.com/haynes/jacoco2cobertura:1.0.7
script:
- python /opt/cover2cover.py
generators/ma2java/build/reports/test-coverage/jacoco.xml
generators/ma2java/main/java/
> generators/ma2java/build/reports/test-coverage/cobertura.xml
- python /opt/cover2cover.py
languages/build/basis/reports/test-coverage/jacoco.xml
languages/basis/main/java/
> languages/build/basis/reports/test-coverage/cobertura.xml
- python /opt/cover2cover.py
languages/build/montiarc/reports/test-coverage/jacoco.xml
languages/montiarc/main/java/
> languages/build/montiarc/reports/test-coverage/cobertura.xml
dependencies:
- Unit Test
needs: ["Unit Test"]
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: "**/reports/test-coverage/cobertura.xml"
Deploy Nexus:
image: registry.git.rwth-aachen.de/monticore/container-registry/gradle:7.6.4-jdk11
stage: post-test
dependencies:
- Build #download artifacts from build
script:
- gradle publish :gradle-plugins:publishAll -PmavenPassword=$pass -PmavenUser=$user
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push"'
when: on_success
Pages:
stage: report
needs: []
image: python:alpine
rules:
- changes:
- mkdocs.yml
- README.md
- docs/
before_script:
- apk add gcc musl-dev python3-dev
- pip install cython
- pip install mkdocs
- pip install mkdocs-material
script:
- mkdocs build --verbose --clean --strict
- mv site public
artifacts:
paths:
- public
# Mirrors this repository 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/monticore/auxiliary-development-tools/github-mirror-tools (Available internally only)
Github Mirror:
stage: mirror
image: registry.git.rwth-aachen.de/monticore/container-registry/gradle:7.6.4-jdk11
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
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- 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:
- git lfs fetch --all
- git remote add github [email protected]:MontiCore/montiarc.git
- git fetch --all
- if git rev-parse --quiet --verify github/"$CI_COMMIT_BRANCH" > /develop/null;
then git pull --rebase github "$CI_COMMIT_BRANCH";
fi
- git push --force github $CI_COMMIT_BRANCH
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push"'
when: on_success
Check Links:
# We need a JDK 17+ image for this job since the link checker requires Java 17.
image: eclipse-temurin:17-jdk-alpine
stage: check
# We don't want to fail the pipeline if a link is invalid. Therefore, allow
# failure regardless of whether the tool exists with an error code.
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'
# The link-check does not depend on any artifacts generated by other jobs and
# can therefore run immediately.
needs: []