-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
249 lines (223 loc) · 7.29 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
variables:
# Latest stable version
RECOMMENDED_VERSION: "4.1"
# This will suppress any download for dependencies and plugins or upload messages which would clutter the console log.
# `showDateTime` will show the passed time in milliseconds. You need to specify `--batch-mode` to make this work.
MAVEN_OPTS: "-Xmx2G -Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
# As of Maven 3.3.0 instead of this you may define these options in `.mvn/maven.config` so the same config is used
# when running from the command line.
# `installAtEnd` and `deployAtEnd` are only effective with recent version of the corresponding plugins.
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
JOB_MAVEN_OVERRIDE: ""
DEBIAN_FRONTEND: noninteractive
# See https://gitlab.com/help/user/application_security/index.md
include:
- template: Dependency-Scanning.gitlab-ci.yml
- template: SAST.gitlab-ci.yml
spotbugs-sast:
variables:
SAST_JAVA_VERSION: 21
stages:
- build
- test
- verify
- package
- deploy
# This template uses jdk21 for verifying and deploying images
image: maven:3.9.4-eclipse-temurin-21
# Cache downloaded dependencies and plugins between builds.
# To keep cache across branches add 'key: "$CI_JOB_NAME"'
cache:
key: "$CI_JOB_NAME"
paths:
- .m2/repository
build:
stage: build
before_script:
- apt-get update -yqq
- apt-get install -yqq gnuplot graphviz
- apt-get install -yqq pocl-opencl-icd opencl-headers
script:
- 'mvn $MAVEN_CLI_OPTS $JOB_MAVEN_OVERRIDE package -DskipTests -DskipPITests -Dmaven.javadoc.skip=true'
artifacts:
paths:
- core/target
- extras/target
- gp/target
- gpu/target
- moo/target
- neat/target
- samples/target
- target
expire_in: 1 week
# For merge requests do not `deploy` but only run `validate`.
# See https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
.validate: &validate
stage: test
before_script:
- apt-get update -yqq
- apt-get install -yqq gnuplot graphviz
- apt-get install -yqq pocl-opencl-icd opencl-headers
script:
- 'mvn $MAVEN_CLI_OPTS $JOB_MAVEN_OVERRIDE test -DskipPITests -Dmaven.javadoc.skip=true'
# Validate merge requests using JDK21 - Temurin (default)
validate:jdk21:
<<: *validate
cache:
key: "$CI_JOB_NAME-java21"
artifacts:
paths:
- core/target
- extras/target
- gp/target
- gpu/target
- moo/target
- neat/target
- samples/target
expire_in: 1 week
# Validate merge requests using JDK21 - Amazon Corretto
validate:jdk21-amazoncorretto:
<<: *validate
image: maven:3.9.4-amazoncorretto-21
cache:
key: "$CI_JOB_NAME-java21-amazoncorretto"
before_script:
- yum install -y gnuplot graphviz
- yum install -y python3 python3-pip
semgrep:
stage: test
image: returntocorp/semgrep:latest
script: semgrep ci --junit-xml > semgrep.xml
variables:
SEMGREP_APP_TOKEN: $SEMGREP_APP_TOKEN
GITLAB_TOKEN: $SEMGREP_PERSONAL_ACCESS_TOKEN
artifacts:
paths:
- semgrep.xml
.verify: &verify
stage: verify
cache:
key: "$CI_JOB_NAME-java21-verify"
before_script:
- apt-get update -yqq
- apt-get install -yqq gnuplot graphviz
- apt-get install -yqq pocl-opencl-icd opencl-headers
verify-core:
<<: *verify
script:
- 'mvn $MAVEN_CLI_OPTS $JOB_MAVEN_OVERRIDE --projects core --also-make verify'
artifacts:
paths:
- core/target
expire_in: 1 week
verify-extras:
<<: *verify
script:
- 'mvn $MAVEN_CLI_OPTS $JOB_MAVEN_OVERRIDE install -DskipTests -DskipPITests'
- 'mvn $MAVEN_CLI_OPTS $JOB_MAVEN_OVERRIDE --projects extras verify'
- 'rm -rfv $CI_PROJECT_DIR/.m2/repository/net/bmahe'
artifacts:
paths:
- extras/target
expire_in: 1 week
verify-gp:
<<: *verify
script:
- 'mvn $MAVEN_CLI_OPTS $JOB_MAVEN_OVERRIDE install -DskipTests -DskipPITests'
- 'mvn $MAVEN_CLI_OPTS $JOB_MAVEN_OVERRIDE --projects gp verify'
- 'rm -rfv $CI_PROJECT_DIR/.m2/repository/net/bmahe'
artifacts:
paths:
- gp/target
expire_in: 1 week
verify-gpu:
<<: *verify
script:
- 'mvn $MAVEN_CLI_OPTS $JOB_MAVEN_OVERRIDE install -DskipTests -DskipPITests'
- 'mvn $MAVEN_CLI_OPTS $JOB_MAVEN_OVERRIDE --projects gpu verify'
- 'rm -rfv $CI_PROJECT_DIR/.m2/repository/net/bmahe'
artifacts:
paths:
- gpu/target
expire_in: 1 week
verify-moo:
<<: *verify
script:
- 'mvn $MAVEN_CLI_OPTS $JOB_MAVEN_OVERRIDE install -DskipTests -DskipPITests'
- 'mvn $MAVEN_CLI_OPTS $JOB_MAVEN_OVERRIDE --projects moo verify'
- 'rm -rfv $CI_PROJECT_DIR/.m2/repository/net/bmahe'
artifacts:
paths:
- moo/target
expire_in: 1 week
verify-neat:
<<: *verify
script:
- 'mvn $MAVEN_CLI_OPTS $JOB_MAVEN_OVERRIDE install -DskipTests -DskipPITests'
- 'mvn $MAVEN_CLI_OPTS $JOB_MAVEN_OVERRIDE --projects neat verify'
- 'rm -rfv $CI_PROJECT_DIR/.m2/repository/net/bmahe'
artifacts:
paths:
- neat/target
expire_in: 1 week
verify-samples:
<<: *verify
script:
- 'mvn $MAVEN_CLI_OPTS $JOB_MAVEN_OVERRIDE install -DskipTests -DskipPITests'
- 'mvn $MAVEN_CLI_OPTS $JOB_MAVEN_OVERRIDE --projects samples verify'
- 'rm -rfv $CI_PROJECT_DIR/.m2/repository/net/bmahe'
artifacts:
paths:
- samples/target
expire_in: 1 week
site:
stage: package
artifacts:
paths:
- target/staging
script:
- apt-get update -yqq
- apt-get install -yqq gnuplot graphviz
- apt-get install -yqq python3.10 python3-pip
- apt-get install -yqq pocl-opencl-icd opencl-headers
- pip3 install matplotlib pandas
- mvn site site:stage -Dproject.recommended.version="${RECOMMENDED_VERSION}"
- "sed -i -e 's/<title>.*<\\/title>/<title>Genetics4j<\\/title>/' target/staging/index.html"
pages:
stage: deploy
script:
- mv target/staging public
artifacts:
paths:
- public
only:
- master
release:
stage: deploy
cache:
policy: pull
script:
- if [ ! -f ci_settings.xml ];
then echo "CI settings missing\! If deploying to GitLab Maven Repository, please see https://gitlab.com/help/user/project/packages/maven_repository.md#creating-maven-packages-with-gitlab-cicd for instructions.";
fi
- apt-get update -yqq
- apt-get install -yqq openssh-client
- eval $(ssh-agent -s)
- rm -rf ~/.ssh/*
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "${CI_SSH_PRIVATE_KEY_B64}" | base64 -d > ~/.ssh/ci_key
- chmod 0600 ~/.ssh/ci_key
- ssh-add ~/.ssh/ci_key
- ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- git config --global user.email "ci@bmahe.net"
- git config --global user.name "Gitlab CI"
- git checkout -B "$CI_COMMIT_REF_NAME"
- apt-get install -yqq gnuplot graphviz
- apt-get install -yqq python3 python3-pip
- mvn $MAVEN_CLI_OPTS --batch-mode release:prepare -DtagNameFormat="r@{project.version}" -DscmCommentPrefix="[maven-release-plugin][ci skip] " -s ci_settings.xml
- mvn $MAVEN_CLI_OPTS --batch-mode release:perform -Dgoals="deploy" -s ci_settings.xml
when: manual
only:
- master