forked from SVWS-NRW/SVWS-Server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
209 lines (190 loc) · 7.08 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
# Source: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Gradle.gitlab-ci.yml
# To contribute improvements to CI/CD templates, please follow the Development guide at:
# https://docs.gitlab.com/ee/development/cicd/templates.html
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Gradle.gitlab-ci.yml
# This is the Gradle build system for JVM applications
# https://gradle.org/
# https://github.com/gradle/gradle
image: svwsnrw/dockerrunner:21
# Disable the Gradle daemon for Continuous Integration servers as correctness
# is usually a priority over speed in CI environments. Using a fresh
# runtime for each build is more reliable since the runtime is completely
# isolated from any previous builds.
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
cache: &global_cache
key: "$CI_COMMIT_REF_NAME"
policy: pull-push
paths:
- ./**/build
- .gradle_user
- .gradle
stages:
- build
- integration-tests
- analyze
- build_installer
- publish
publish_maven:
stage: publish
rules:
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?$/'
when: manual
variables:
SECURE_FILES_DOWNLOAD_PATH: '/'
needs:
- job: build_linux
- job: build_windows
script:
- curl --silent "https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer" | bash
- cat gradle_secure.properties >> gradle.properties
- chmod +x ./deployment/setupVersion.sh
- ./deployment/setupVersion.sh
- ./gradlew signJar publishAllPublicationsToSonatypeRepository closeAndReleaseSonatypeStagingRepository
publish_all:
stage: publish
rules:
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?$/'
when: manual
variables:
SECURE_FILES_DOWNLOAD_PATH: '/'
needs:
- job: build_linux
- job: build_windows
script:
- curl --silent "https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer" | bash
- cat gradle_secure.properties >> gradle.properties
- chmod +x ./deployment/setupVersion.sh
- ./deployment/setupVersion.sh
- ./gradlew signJar publishReleaseAll
publish_dockerhub:
stage: publish
rules:
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?$/'
when: manual
variables:
SECURE_FILES_DOWNLOAD_PATH: '/'
needs:
- job: build_linux
- job: build_windows
script:
- curl --silent "https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer" | bash
- cat gradle_secure.properties >> gradle.properties
- cat dockerlogin.txt | docker login --username svwsnrw --password-stdin
- chmod +x ./deployment/setupVersion.sh
- ./deployment/setupVersion.sh
- ./gradlew :deployment:docker:dockerPushAllDockerhub
publish_github:
stage: publish
rules:
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?$/'
when: manual
variables:
SECURE_FILES_DOWNLOAD_PATH: '/'
needs:
- job: build_linux
- job: build_windows
script:
- curl --silent "https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer" | bash
- cat gradle_secure.properties >> gradle.properties
- chmod +x ./deployment/setupVersion.sh
- ./deployment/setupVersion.sh
- ./gradlew :deployment:githubRelease
build_linux:
stage: build_installer
rules:
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?$/'
needs:
- job: build
script:
- chmod +x ./deployment/setupVersion.sh
- ./deployment/setupVersion.sh
- ./gradlew :deployment:linux-installer:buildLinuxInstaller
- mkdir artifacts_linux
- cp -r ./deployment/linux-installer/build/distributions/ ./artifacts_linux
artifacts:
paths:
- artifacts_linux/
when: on_success
build_windows:
stage: build_installer
rules:
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?$/'
needs:
- job: build
tags:
- windows
variables:
SECURE_FILES_DOWNLOAD_PATH: '/'
SVWS_SIGNTOOL_PATH: 'c:\tmp\signtool\signtool'
image: svwsnrw/dockerrunner-win
script:
- ./deployment/setupVersion.ps1
- c:/tmp/download-secure-files-windows-amd64.exe
- Add-Content -Path ".\gradle.properties" -Value (Get-Content -Path ".\gradle_secure.properties")
- dir /builds/svws/SVWS-Server/
- ./gradlew :deployment:windows-installer:doZip
- mkdir artifacts_windows
- copy .\deployment\windows-installer\build\output\win64-installer* .\artifacts_windows\
artifacts:
paths:
- artifacts_windows/
when: on_success
integration-tests:
dependencies:
- build
stage: integration-tests
script:
- chmod +x ./deployment/setupVersion.sh
- ./deployment/setupVersion.sh
- ./gradlew --build-cache testing:integrationTest --stacktrace -Penvironment=testing -PMDB_PASSWORD=$MDB_PASSWORD -PMariaDB_ROOT_PASSWORD=$MariaDB_ROOT_PASSWORD -PMariaDB_PASSWORD=$MariaDB_PASSWORD -PSVWS_TLS_KEYSTORE_PASSWORD=$SVWS_TLS_KEYSTORE_PASSWORD -PMariaDB_USER=$MariaDB_USER
cache:
<<: *global_cache
policy: pull
artifacts:
when: always
expire_in: "7 days"
reports:
junit: ./testing/**/build/test-results/**/*.xml
e2e-tests:
dependencies:
- build
stage: integration-tests
when: manual
script:
- ./gradlew --build-cache svws-webclient:browser-test:playwrightInstallDeps --stacktrace
- ./gradlew --build-cache testing:svws-browser-test:runBrowserTest --stacktrace -Penvironment=testing -PMDB_PASSWORD=$MDB_PASSWORD -PMariaDB_ROOT_PASSWORD=$MariaDB_ROOT_PASSWORD -PMariaDB_PASSWORD=$MariaDB_PASSWORD -PSVWS_TLS_KEYSTORE_PASSWORD=$SVWS_TLS_KEYSTORE_PASSWORD -PMariaDB_USER=$MariaDB_USER
artifacts:
when: always
expire_in: "1 days"
reports:
junit: "./svws-webclient/browser-test/build/testresults/results.xml"
paths:
- "./svws-webclient/browser-test/build/playwright-report/**"
build:
stage: build
script:
- chmod +x ./deployment/setupVersion.sh
- ./deployment/setupVersion.sh
- ./gradlew --build-cache build -Penvironment=build
cache:
<<: *global_cache
policy: pull
when: always
artifacts:
when: always
reports:
junit: ./**/build/test-results/test/**/TEST-*.xml
paths:
- "./build/**"
- "./**/build/**"
expire_in: "1 days"
sonarqube_analysis:
stage: analyze
only:
refs:
- dev
when: manual
script:
- ./gradlew sonarqube -Dsonar.projectKey=svws-server -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_LOGIN -Dsonar.password=$SONAR_PASSWORD --full-stacktrace