-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.gitlab-ci.yml
226 lines (208 loc) · 6.75 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
# 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_snapshot_installer
- build_installer
- sign
- publish
build:
stage: build
script:
- chmod +x ./deployment/setupVersion.sh
- ./deployment/setupVersion.sh
- ./gradlew --build-cache build -Penvironment=build
cache:
<<: *global_cache
policy: pull
artifacts:
when: always
reports:
junit: ./**/build/test-results/test/**/TEST-*.xml
paths:
- "./build/**"
- "./**/build/**"
expire_in: "1 days"
when: always
integration-tests:
dependencies:
- build
stage: integration-tests
script:
- chmod +x ./deployment/setupVersion.sh
- ./deployment/setupVersion.sh
- ./gradlew --build-cache tests:integrationTest --stacktrace
cache:
<<: *global_cache
policy: pull
artifacts:
when: always
expire_in: "7 days"
reports:
junit: ./tests/**/build/test-results/**/*.xml
sonarqube_analysis:
stage: analyze
only:
refs:
- dev
script:
- ./gradlew sonarqube -Dsonar.projectKey=svws-server -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_LOGIN -Dsonar.password=$SONAR_PASSWORD --full-stacktrace
when: manual
build_snapshot_windows:
stage: build_snapshot_installer
needs:
- job: build
only:
refs:
- dev
tags:
- windows
image: svwsnrw/dockerrunner-win
script:
- ./deployment/setupVersion.ps1
- 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: manual
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/
build_windows:
stage: build_installer
rules:
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?$/'
needs:
- job: build
tags:
- windows
image: svwsnrw/dockerrunner-win
script:
- ./deployment/setupVersion.ps1
- 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/
sign_artifacts:
stage: sign
image: svwsnrw/dockerrunner:17
rules:
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?$/'
needs:
- job: build
- job: build_windows
- job: build_linux
before_script:
- chmod u+x config/signing/*.sh
script:
- ./gradlew signJars signWindowsInstaller
artifacts:
paths:
- artifacts_windows/
- artifacts_linux/
- "./build/**"
- "./**/build/**"
exclude:
- "./build/signing/**/*"
- "./build/signing"
publish_all:
stage: publish
rules:
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?$/'
variables:
SECURE_FILES_DOWNLOAD_PATH: '/'
needs:
- job: sign_artifacts
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 publishReleaseAll
when: manual
publish_maven:
stage: publish
rules:
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?$/'
variables:
SECURE_FILES_DOWNLOAD_PATH: '/'
needs:
- job: sign_artifacts
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 publishAllPublicationsToSonatypeRepository closeAndReleaseSonatypeStagingRepository
when: manual
publish_dockerhub:
stage: publish
rules:
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?$/'
variables:
SECURE_FILES_DOWNLOAD_PATH: '/'
needs:
- job: sign_artifacts
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
when: manual
publish_github:
stage: publish
rules:
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?$/'
variables:
SECURE_FILES_DOWNLOAD_PATH: '/'
needs:
- job: sign_artifacts
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
when: manual