-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathgitlab-ci.yml
270 lines (238 loc) · 7.83 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
# This file is part of SoSy-Lab Java-Project Template,
# a collection of common files and build definitions for Java projects:
# https://gitlab.com/sosy-lab/software/java-project-template
#
# SPDX-FileCopyrightText: 2018-2025 Dirk Beyer <https://www.sosy-lab.org>
#
# SPDX-License-Identifier: Apache-2.0
# DO NOT EDIT LOCALLY!
# Keep this file synchronized with
# https://gitlab.com/sosy-lab/software/java-project-template
stages:
- images
- dependencies
- build
- checks
- deploy
# Default image for non-JDK-specific jobs
image: ${CI_REGISTRY_IMAGE}/test:jdk-11
variables:
IVY_CACHE_DIR: "${CI_PROJECT_DIR}/.ivy2"
ANT_PROPS_BUILD: "-Divy.disable=true"
ANT_PROPS_CHECKS: "-Divy.disable=true -DskipBuild=true"
# Download dependencies and provide them to later stages
build-dependencies:
stage: dependencies
script: "ant build-dependencies"
interruptible: true
cache:
key: "$CI_JOB_NAME"
paths:
- ".ivy2/"
- "lib/java/"
artifacts:
paths:
- "lib/java/"
expire_in: 1 day # sufficient for building later stages and near-time debugging
# Build binaries and provide them to later stages
.build:
stage: build
script: "ant $ANT_PROPS_BUILD jar"
interruptible: true
artifacts:
paths:
- "bin/"
- "*.jar"
- "hs_err_pid*.log"
- "core.*"
build:jdk-11: { extends: .build, image: "${CI_REGISTRY_IMAGE}/test:jdk-11" }
build:jdk-17: { extends: .build, image: "${CI_REGISTRY_IMAGE}/test:jdk-17" }
build:jdk-21: { extends: .build, image: "${CI_REGISTRY_IMAGE}/test:jdk-21" }
build:jdk-23: { extends: .build, image: "${CI_REGISTRY_IMAGE}/test:jdk-23" }
# For checks that need the binaries
.binary_check:
stage: checks
interruptible: true
# For checks that only need the source code, not the binaries
.source_check:
stage: checks
needs:
- build-dependencies
interruptible: true
.build-project-ecj:
extends: .source_check
script: "ant $ANT_PROPS_BUILD build-project-ecj"
build-project-ecj:jdk-17: {extends: .build-project-ecj, image: "${CI_REGISTRY_IMAGE}/test:jdk-17" }
build-project-ecj:jdk-21: {extends: .build-project-ecj, image: "${CI_REGISTRY_IMAGE}/test:jdk-21" }
build-project-ecj:jdk-23: {extends: .build-project-ecj, image: "${CI_REGISTRY_IMAGE}/test:jdk-23" }
check-format:
extends: .source_check
script: "ant $ANT_PROPS_CHECKS format-source && git diff -s --exit-code"
checkstyle:
extends: .source_check
script:
- "ant $ANT_PROPS_CHECKS checkstyle"
- "ant $ANT_PROPS_CHECKS run-checkstyle -Dcheckstyle.output=plain && cat Checkstyle*.xml && test $(cat Checkstyle*xml | grep -vic audit) -eq 0"
artifacts:
paths:
- "Checkstyle*html"
when: on_failure
javadoc:
extends: .binary_check
script: "ant $ANT_PROPS_CHECKS javadoc"
needs:
- build-dependencies
- build:jdk-11
artifacts:
paths:
- "Javadoc/"
spotbugs:
extends: .binary_check
script:
- 'ant $ANT_PROPS_CHECKS spotbugs'
- 'test \! -f SpotBugs.html'
needs:
- build-dependencies
- build:jdk-11
artifacts:
paths:
- "SpotBugs.html"
when: on_failure
.unit-tests:
extends: .binary_check
before_script:
- "uname -a"
- "ldd --version"
- "java -version"
script:
- "ant $ANT_PROPS_CHECKS unit-tests-coverage"
artifacts:
paths:
- "JUnit.html"
- "JUnit-coverage/"
- "junit/coverage.xml"
when: always
reports:
junit: "junit/TESTS-TestSuites.xml"
.unit-tests-quick:
extends: [ .binary_check, .unit-tests ]
script:
- "ant $ANT_PROPS_CHECKS unit-tests-quick"
artifacts:
paths:
- "JUnit.html" # no coverage files available
unit-tests:x86_64:jdk-11:
extends: .unit-tests
needs: [ build-dependencies, build:jdk-11 ]
image: "${CI_REGISTRY_IMAGE}/test:jdk-11"
unit-tests:x86_64:jdk-17:
extends: .unit-tests
needs: [ build-dependencies, build:jdk-17 ]
image: "${CI_REGISTRY_IMAGE}/test:jdk-17"
unit-tests:x86_64:jdk-21:
extends: .unit-tests
needs: [ build-dependencies, build:jdk-21 ]
image: "${CI_REGISTRY_IMAGE}/test:jdk-21"
unit-tests:x86_64:jdk-23:
extends: .unit-tests
needs: [ build-dependencies, build:jdk-23 ]
image: "${CI_REGISTRY_IMAGE}/test:jdk-23"
unit-tests:arm64:jdk-11:
extends: .unit-tests-quick
needs: [ build-dependencies, build:jdk-11 ]
image: { name: "${CI_REGISTRY_IMAGE}/test:jdk-11-arm64", docker: { platform: linux/arm64 } }
unit-tests:arm64:jdk-17:
extends: .unit-tests-quick
needs: [ build-dependencies, build:jdk-17 ]
image: { name: "${CI_REGISTRY_IMAGE}/test:jdk-17-arm64", docker: { platform: linux/arm64 } }
unit-tests:arm64:jdk-21:
extends: .unit-tests-quick
needs: [ build-dependencies, build:jdk-21 ]
image: { name: "${CI_REGISTRY_IMAGE}/test:jdk-21-arm64", docker: { platform: linux/arm64 } }
unit-tests:arm64:jdk-23:
extends: .unit-tests-quick
needs: [ build-dependencies, build:jdk-23 ]
image: { name: "${CI_REGISTRY_IMAGE}/test:jdk-23-arm64", docker: { platform: linux/arm64 } }
refaster:
extends: .source_check
image: ${CI_REGISTRY_IMAGE}/test:jdk-11
before_script:
- 'test -d refaster || git clone https://gitlab.com/sosy-lab/software/refaster.git'
- 'cd refaster'
- 'git fetch'
- 'git checkout $REFASTER_REPO_REVISION'
- 'ant build-refaster-rule -Drefaster.source.pattern=**/*.java -Drefaster.rule.file=../rule.refaster -Derrorprone.version=$REFASTER_VERSION'
- 'cd -'
script:
- 'ant $ANT_PROPS_BUILD refaster -Drefaster.rule.file=rule.refaster'
interruptible: true
cache:
key: "$CI_JOB_NAME"
paths:
- ".ivy2/"
- "refaster/"
artifacts:
paths:
- "error-prone.patch"
- "rule.refaster"
when: on_failure
except:
variables:
- $REFASTER_REPO_REVISION == null # required for job
- $REFASTER_VERSION == null # required for job
# check license declarations etc.
reuse:
stage: checks
needs: []
image:
name: fsfe/reuse:3
entrypoint: [""]
script:
- reuse lint
deploy-gh-pages:
stage: deploy
script: "build/deploy-gh-pages.sh"
needs:
- build:jdk-11
- javadoc
environment: deploy/gh-pages
only:
variables:
- $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # only on default branch
- $CI_PROJECT_PATH == $PROJECT_PATH # not on forks
except:
variables:
- $GH_TOKEN == null # required for job
# Build container images
# following this guideline: https://docs.gitlab.com/ee/ci/docker/using_kaniko.html
.build-docker:
stage: images
variables:
EXTRA_ARGS: ""
DOCKERFILE: "build/gitlab-ci.Dockerfile.$JDK_VERSION"
IMAGE: "test:$JDK_VERSION" # no architecture suffix for backwards compatibility
image:
name: "gcr.io/kaniko-project/executor:debug"
entrypoint: [""]
script:
- mkdir -p /root/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --dockerfile $CI_PROJECT_DIR/$DOCKERFILE --destination $CI_REGISTRY_IMAGE/$IMAGE $EXTRA_ARGS
only:
- schedules
- web
.build-docker:arm64:
extends: .build-docker
image:
docker:
platform: linux/arm64
variables:
IMAGE: "test:$JDK_VERSION-arm64" # override image name for arm64
build-docker:x86_64:jdk-11: { extends: .build-docker, variables: { JDK_VERSION: jdk-11 } }
build-docker:x86_64:jdk-17: { extends: .build-docker, variables: { JDK_VERSION: jdk-17 } }
build-docker:x86_64:jdk-21: { extends: .build-docker, variables: { JDK_VERSION: jdk-21 } }
build-docker:x86_64:jdk-23: { extends: .build-docker, variables: { JDK_VERSION: jdk-23 } }
build-docker:arm64:jdk-11: { extends: .build-docker:arm64, variables: { JDK_VERSION: jdk-11 } }
build-docker:arm64:jdk-17: { extends: .build-docker:arm64, variables: { JDK_VERSION: jdk-17 } }
build-docker:arm64:jdk-21: { extends: .build-docker:arm64, variables: { JDK_VERSION: jdk-21 } }
build-docker:arm64:jdk-23: { extends: .build-docker:arm64, variables: { JDK_VERSION: jdk-23 } }