forked from red-soft-ru/redexpert
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
416 lines (400 loc) · 13.2 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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
cache:
paths:
- .m2/repository
stages:
- prepare
- sources
- build_docs
- build
- test
- repackage
- deploy
- report
variables:
RELEASE_HUB_PROJECT: red_expert
CI_URL: ${CI_PROJECT_URL}/pipelines/${CI_PIPELINE_ID}
CONTEXT: commit
TAG_BRANCH: master
MAVEN_OPTS: "-Dmaven.repo.local=${CI_PROJECT_DIR}/.m2/repository"
http_proxy: "http://git.red-soft.biz:3128"
https_proxy: "http://git.red-soft.biz:3128"
no_proxy: localhost,172.0.0.0/8,127.0.0.0/8,10.0.0.0/8,.red-soft.biz
prepare:
tags:
- docker
- builder
- x86_64
stage: prepare
image: registry.red-soft.biz:5000/utils/red-release-manager/client:master
script:
- mkdir .ci
- apk --update add sed
- |
if [ "${CI_COMMIT_TAG}" ]; then
VERSION_IN_POM=$(mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
VERSION=$(echo ${CI_COMMIT_TAG}|sed 's/v//')
if [ "$VERSION" != "$VERSION_IN_POM" ]; then
echo Project versions in pom.xml $VERSION_IN_POM and tag $VERSION do not match!
exit 1
fi
SUFFIX=$(echo $VERSION|awk -F- '{print $2}')
if [ "${SUFFIX}" ]; then
STAGE=rc
else
STAGE=release
fi
BRANCH=${TAG_BRANCH}
CONTEXT=tag
else
VERSION=$(date +"%Y.%m")
BUILDNO=$(relmanager_client genbuildno ${RELEASE_HUB_PROJECT} ${VERSION}-SNAPSHOT)
VERSION=${VERSION}-SNAPSHOT.${BUILDNO}
BRANCH=${CI_COMMIT_REF_NAME}
CONTEXT=commit
STAGE=snapshot
fi
- BUILD=$(awk -F'=' '/^eq.build=/ {print $2}' ./src/org/executequery/eq.system.properties)
- m4 -DVERSION=${VERSION} ci/artifacts.m4 > .ci/artifacts
- echo VERSION=${VERSION} > vars.env
- echo BUILD=${BUILD} >> vars.env
- echo BRANCH=${BRANCH} >> vars.env
- echo CONTEXT=${CONTEXT} >> vars.env
- echo STAGE=${STAGE} >> vars.env
artifacts:
paths:
- .ci
reports:
dotenv: vars.env
sources:
tags:
- docker
- builder
- x86_64
stage: sources
image: maven:3-jdk-8-alpine
before_script:
- apk --update add bash git
- git config --global user.name "Dummy Name"
- git config --global user.email "[email protected]"
script:
- ./ci/prepare-src.sh
artifacts:
expire_in: 1 day
paths:
- dist-src/
build_docs:
stage: build_docs
artifacts:
expire_in: 1 day
paths:
- dist/
tags:
- docker
- builder
- x86_64
image: registry.red-soft.biz:5000/docker-images/3rdparty/texlive:TL2022-2023-03-12-full
before_script:
- apt update && apt install -y python3-venv python3-pip
- mkdir -p dist/guide
script:
- cd guide_rst
- make bootstrap
- make latexpdf
- cp build/latex/Red_Expert.pdf ../dist/guide/RedExpert_Guide-ru.pdf
.build_template:
stage: build
artifacts:
expire_in: 1 day
paths:
- dist/
build:linux:
extends: .build_template
image: oraclelinux:7
tags:
- docker
- builder
- x86_64
variables:
MAVEN_VERSION: 3.9.3
M2_HOME: /opt/apache-maven-${MAVEN_VERSION}/
QMAKE: qmake-qt4
ARCH: x86_64
DIST: ${CI_PROJECT_DIR}/dist/linux-${ARCH}
before_script:
- yum -y update
- yum install -y java-1.8.0-openjdk-devel qt-devel gtk3-devel wget libcurl-devel
- yum group install -y "Development Tools"
- yum install -y ca-certificates
- cd /opt
- wget https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz
- tar xzf apache-maven-${MAVEN_VERSION}-bin.tar.gz
- export PATH=${M2_HOME}/bin:${PATH}
- export JAVA_HOME=`java -XshowSettings:properties -version 2>&1|grep "java.home"|cut -d "=" -f 2|tr -d " "|rev | cut -c 4- | rev`
script:
- cd "${CI_PROJECT_DIR}"
- tar xf dist-src/RedExpert-$VERSION-src.tar.gz
- cd RedExpert-$VERSION
- ./ci/build_native.sh
- ./ci/build_jar.sh
- mkdir -p "${DIST}"
- mv native/RedExpertNativeLauncher/resources "${DIST}"
- mkdir "${DIST}"/guide/
- chmod +x modules/redexpert/target/bin/*
- mv modules/redexpert/target/bin "${DIST}"
- mv modules/redexpert/target/config "${DIST}"
- mv modules/redexpert/target/lib "${DIST}"
- cp -r license/ "${DIST}"
- cp -r "${CI_PROJECT_DIR}"/dist/guide/ "${DIST}"
- mv modules/redexpert/target/classes "${DIST}"
- mv modules/redexpert/target/LICENSE.txt "${DIST}"
- mv modules/redexpert/target/red_expert.ico "${DIST}"
- mv modules/redexpert/target/red_expert.png "${DIST}"
- mv modules/redexpert/target/RedExpert.jar "${DIST}"
- ./ci/build_installer.sh
build:windows:
extends: .build_template
tags:
- windows
- proxmox
variables:
ErrorActionPreference: STOP
JAVA_HOME: c:\Program Files\Java\jdk8
DIST: ${CI_PROJECT_DIR}\dist\windows-${ARCH}
URL_INSTALLBUILDER: http://builds.red-soft.biz/release_hub/installbuilder/20.12.0/download/installbuilder:windows-${ARCH}:20.12.0:exe
before_script:
- $env:RE_VERSION = $VERSION
- unzip -q dist-src\RedExpert-$VERSION-src.zip
- mkdir ${DIST}
- cd ${CI_PROJECT_DIR}\RedExpert-$VERSION
- echo "downloading installbuilder from ${URL_INSTALLBUILDER}"
- $client=new-object System.Net.WebClient
- $client.DownloadFile(${URL_INSTALLBUILDER}, "${CI_PROJECT_DIR}\RedExpert-$VERSION\ib.exe")
- echo "installing installbuilder"
- $pwd=pwd
- $pwd=$pwd.path
- $prefix_installbuilder="$pwd\ib"
- echo $prefix_installbuilder
- .\ib.exe --mode unattended --prefix $prefix_installbuilder
- $env:PATH="$prefix_installbuilder\bin\;"+$env:PATH
- echo $env:PATH
script:
- cd ${CI_PROJECT_DIR}\RedExpert-$VERSION
- ls
- powershell -ExecutionPolicy ByPass -file ci\build_native.ps1
- powershell -ExecutionPolicy ByPass -file ci\build_jar.ps1
- mv modules/redexpert/target/bin "${DIST}"
- mv modules/redexpert/target/config "${DIST}"
- mv modules/redexpert/target/lib "${DIST}"
- cp -r license/ "${DIST}"
- cp -r ${CI_PROJECT_DIR}/dist/guide/ ${DIST}/
- mv modules/redexpert/target/LICENSE.txt "${DIST}"
- mv modules/redexpert/target/red_expert.ico "${DIST}"
- mv modules/redexpert/target/red_expert.png "${DIST}"
- mv modules/redexpert/target/RedExpert.jar "${DIST}"
- powershell -ExecutionPolicy ByPass -file ci\build_installer.ps1
parallel:
matrix:
- ARCH: x86_64
QMAKE: c:\Qt\Qt5.6.3\5.6.3\msvc2013_64\bin\qmake.exe
- ARCH: x86
QMAKE: c:\Qt\Qt5.6.3_x86\5.6.3\msvc2013\bin\qmake.exe
.test_template:
stage: test
artifacts:
expire_in: 1 day
paths:
- test-results/
- coverage-results/
except:
variables:
- $SKIP_TESTS == "1"
test:windows:
extends: .test_template
tags:
- windows
- proxmox
- tester
variables:
BUILD: ${BUILD}
PROXMOX_TEMPLATE: template-testing-re-windows-7
JAVA_HOME: c:\Program Files\Java\jdk8
ErrorActionPreference: STOP
DIST: ${CI_PROJECT_DIR}\dist\windows-${ARCH}
PYTHON: c:\Python38\python.exe
WORKSPACE: ${CI_PROJECT_DIR}
DISTRO: windows-lackey
parallel:
matrix:
- TEST_TYPE: core
ARCH: ["x86_64", "x86"]
DBMS: ["rdb30", "rdb50"]
before_script:
- $TEST_DIR = New-TempDirectory -Prefix 'test_re_'
- cd $TEST_DIR
- unzip -q ${CI_PROJECT_DIR}\dist-src\RedExpert-$env:VERSION-src.zip
- cd $TEST_DIR\RedExpert-$env:VERSION\ci
- start-process "${PYTHON}" ".\download_dbms.py ${DBMS} ${ARCH} windows" -wait -nonewwindow
- powershell -ExecutionPolicy ByPass -file install_dbms.ps1
script:
- cd $TEST_DIR\RedExpert-$env:VERSION\ci
- powershell -ExecutionPolicy ByPass -file test.ps1
dependencies: ["prepare", "sources", "build:windows"]
needs: ["prepare", "sources", "build:windows"]
timeout: 2 hours
only:
variables:
- ($CONTEXT == "weekly" || $CI_COMMIT_TAG) && $TEST_TYPE == "core"
- $CONTEXT == "commit" && $ARCH == "x86_64" && $DBMS == "rdb50"
- $CONTEXT == "commit" && $ARCH == "x86_64" && $DBMS == "rdb30"
test:windows-robot:
extends: .test_template
tags:
- windows
- proxmox
- tester
variables:
BUILD: ${BUILD}
PROXMOX_TEMPLATE: template-testing-re-windows-7
ErrorActionPreference: STOP
DIST: ${CI_PROJECT_DIR}\dist\windows-${ARCH}
PYTHON: c:\Python38\python.exe
WORKSPACE: ${CI_PROJECT_DIR}
DISTRO: windows-robot
parallel:
matrix:
- TEST_TYPE: core
ARCH: ["x86_64", "x86"]
DBMS: ["rdb30", "rdb50"]
before_script:
- $TEST_DIR = New-TempDirectory -Prefix 'robot_test_re_'
- cd $TEST_DIR
- unzip -q ${CI_PROJECT_DIR}\dist-src\RedExpert-$env:VERSION-src.zip
- cd $TEST_DIR\RedExpert-$env:VERSION\ci
- start-process "${PYTHON}" ".\download_dbms.py ${DBMS} ${ARCH} windows" -wait -nonewwindow
- powershell -ExecutionPolicy ByPass -file install_dbms.ps1
script:
- cd $TEST_DIR\RedExpert-$env:VERSION\ci
- powershell -ExecutionPolicy ByPass -file test_robot.ps1
dependencies: ["prepare", "sources", "build:windows"]
needs: ["prepare", "sources", "build:windows"]
timeout: 2 hours
only:
variables:
- ($CONTEXT == "weekly" || $CI_COMMIT_TAG) && $TEST_TYPE == "core"
- $CONTEXT == "commit" && $ARCH == "x86_64" && $DBMS == "rdb50"
- $CONTEXT == "commit" && $ARCH == "x86_64" && $DBMS == "rdb30"
test:linux-robot:
extends: .test_template
tags:
- gui
- linux
- red_expert
- tester
variables:
BUILD: ${BUILD}
PROXMOX_TEMPLATE: template-testing-re-ubuntu-20
ErrorActionPreference: STOP
DIST: ${CI_PROJECT_DIR}/dist/linux-${ARCH}
PYTHON: /usr/bin/python3
WORKSPACE: ${CI_PROJECT_DIR}
DISTRO: linux-robot
parallel:
matrix:
- TEST_TYPE: core
ARCH: ["x86_64"]
DBMS: ["rdb30", "rdb50"]
before_script:
- cd ${CI_PROJECT_DIR}
- tar xf ${CI_PROJECT_DIR}/dist-src/RedExpert-$VERSION-src.tar.gz
- cd RedExpert-$VERSION
- $PYTHON ./ci/download_dbms.py ${DBMS} ${ARCH} linux
- chmod +x ./ci/install_dbms.sh
- ./ci/install_dbms.sh
- |
if [ $ARCH == "x86_64" ] && [ $DBMS == "rdb50" ]; then
export COVERAGE=true
fi
script:
- chmod +x ./ci/test_robot.sh
- ./ci/test_robot.sh
dependencies: ["prepare", "sources", "build:linux"]
needs: ["prepare", "sources", "build:linux"]
timeout: 2 hours
only:
variables:
- ($CONTEXT == "weekly" || $CI_COMMIT_TAG) && $TEST_TYPE == "core"
- $CONTEXT == "commit" && $ARCH == "x86_64" && $DBMS == "rdb50"
- $CONTEXT == "commit" && $ARCH == "x86_64" && $DBMS == "rdb30"
repackage:
tags:
- docker
- builder
- x86_64
stage: repackage
image: alpine:3.8
before_script:
- apk --update add bash tar zip
script:
- ./ci/repackage.sh linux-x86_64 windows-x86_64 windows-x86
artifacts:
expire_in: 1 day
paths:
- dist/unified/
dependencies: [ "prepare", "sources", "build:windows", "build:linux" ]
needs: [ "prepare", "sources", "build:windows", "build:linux" ]
deploy:
tags:
- docker
- builder
- x86_64
stage: deploy
image: registry.red-soft.biz:5000/utils/red-release-manager/client:master
script:
- test -d test-results && for f in $(find test-results -name \*.xml); do printf "testpack $(basename ${f/.xml})\nfile $f\nend\n"; done >> .ci/artifacts || true
- |
for d in $(find test-results/* -maxdepth 1 -type d | sed 's/test-results\///'); do
printf "testpack $d\n";
for t in $(find test-results/$d -name \*.xml); do
printf "file $t\n";
done;
printf "end\n";
done >> .ci/artifacts || true
- relmanager_client deploy ${RELEASE_HUB_PROJECT} ${VERSION} --artifacts .ci/artifacts --ci_url ${CI_URL} --context ${CONTEXT} --branch ${BRANCH} --commit ${CI_COMMIT_SHA} --stage ${STAGE}
only:
variables:
- "$RELEASE_HUB_KEY"
report:coverage:
stage: report
tags: ["docker", "x86_64"]
image: registry.red-soft.biz:5000/docker-images/rdbbuildenv:rdb5-8
before_script:
- test -e ${CI_PROJECT_DIR}/coverage-results || (echo No coverage data found; exit 0)
- pip3 install anybadge
script:
- echo "Uploading report"
- mc alias set minio ${MINIO_SERVER} ${MINIO_USER} ${MINIO_PASSWORD}
- |
if [ "${CI_COMMIT_TAG}" ]; then
REPORT_NAME=${VERSION}
elif [ "${CI_COMMIT_REF_NAME}" = "$TAG_BRANCH" ]; then
REPORT_NAME=${TAG_BRANCH}
echo "Generating badge"
PCOV=$(grep -oP '<tfoot.*?>.*?</tfoot>' coverage-results/index.html | grep -oP '<td class="ctr2">\K[^<]+' | head -n 1 | tr -d '%')
anybadge -l "coverage ${TAG_BRANCH}" -v "$PCOV" --suffix='%' -o -f coverage-results/badge.svg 70=red 80=orange 90=yellow 100=green
fi
- |
if [ "${REPORT_NAME}" ]; then
mc rm -r --force minio/reports/coverage/red-expert/${REPORT_NAME}
mc cp -r coverage-results/ minio/reports/coverage/red-expert/${REPORT_NAME}
echo Report ${MINIO_SERVER}reports/coverage/red-expert/${REPORT_NAME}/index.html
else
mc cp -r coverage-results/ minio/reports/temp/coverage/red-expert/${VERSION}
echo Report ${MINIO_SERVER}reports/temp/coverage/red-expert/${VERSION}/index.html
fi
# coverage: /^\s*lines:\s*\d+.\d+\%/
only:
variables:
- $CI_COMMIT_TAG
- $CONTEXT == "weekly"
- $FORCE_COVERAGE == "1"
allow_failure: true