-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitlab-ci.yml
218 lines (203 loc) · 5.63 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
default:
tags:
- docker
artifacts:
expire_in: 1 week
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "push"'
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
stages:
- check
- build
- archive
- domain
- integration
- release
.check:
stage: check
image: registry.esss.lu.se/ecdc/ess-dmsc/docker-ubuntu2204-build-node:latest
clang-format:
extends: .check
script:
- ci/check-formatting.sh
black:
extends: .check
script:
- python3 -m venv .venv
- .venv/bin/python -m pip install -r integration-tests/requirements.txt
- .venv/bin/python -m pip install -r domain-tests/requirements.txt
- .venv/bin/python -m black --version
- .venv/bin/python -m black --check integration-tests
- .venv/bin/python -m black --check domain-tests
cppcheck:
extends: .check
script:
- cppcheck --version
- >
cppcheck \
--xml \
--inline-suppr \
--suppress=unusedFunction \
--suppress=missingInclude \
--enable=all \
--inconclusive \
src/ 2> cppcheck.xml
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
.build:
stage: build
before_script:
- mkdir build
- cd build
- >
conan remote add \
--insert 0 \
ecdc-conan-virtual \
$ESS_ARTIFACTORY_ECDC_CONAN_VIRTUAL_REMOTE_URL
- $SCL conan install --build missing ..
- $SCL conan info ../conanfile.txt > CONAN_INFO
after_script:
- >
conan remote add \
ecdc-conan-external \
$ESS_ARTIFACTORY_ECDC_CONAN_EXTERNAL_REMOTE_URL
- >
conan user \
--password $ESS_ARTIFACTORY_ECDC_CONAN_TOKEN \
--remote ecdc-conan-external \
$ESS_ARTIFACTORY_ECDC_CONAN_USER
# Store built packages to save build time on subsequent builds
- conan upload '*' --all --confirm --remote ecdc-conan-external
build-debug:
extends: .build
image: registry.esss.lu.se/ecdc/ess-dmsc/docker-centos7-build-node:latest
variables:
SCL: scl enable devtoolset-11 rh-python38 --
script:
- $SCL cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DCONAN=MANUAL -DRUN_DOXYGEN=ON -DCOV=ON ..
- $SCL ninja all UnitTests docs
- $SCL ninja coverage
- cat coverage.txt
coverage: '/^TOTAL.*\s+(\d+\%)$/'
artifacts:
paths:
- build/coverage.xml
reports:
coverage_report:
coverage_format: cobertura
path: build/coverage.xml
build-release:
extends: .build
image: registry.esss.lu.se/ecdc/ess-dmsc/docker-centos7-build-node:latest
variables:
SCL: scl enable devtoolset-11 rh-python38 --
script:
- $SCL ../ci/configure-release.sh .. .
- $SCL ninja all UnitTests docs
- ./bin/kafka-to-nexus --version
- ./bin/UnitTests --gtest_output=xml:test-output.xml
artifacts:
paths:
- build/test-output.xml
- build/CONAN_INFO
- build/bin
- build/lib
- build/licenses
reports:
junit: build/test-output.xml
domain_tests:
stage: domain
image: registry.esss.lu.se/ecdc/ess-dmsc/docker-centos7-build-node:latest
dependencies:
- build-release
variables:
SCL: scl enable devtoolset-11 rh-python38 --
before_script:
- ls
- cd domain-tests
script:
- $SCL python -m venv venv
- source venv/bin/activate
- python -m pip install -r requirements.txt
- pytest --file-maker-binary=../build/bin/file-maker --junitxml=DomainTestsOutput.xml
artifacts:
when: always
paths:
- domain-tests/DomainTestsOutput.xml
reports:
junit: Domain-tests/DomainTestsOutput.xml
build-alt-distro:
extends: .build
image: registry.esss.lu.se/ecdc/ess-dmsc/docker-$DISTRO-build-node:latest
script:
- $SCL cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DCONAN=MANUAL -DRUN_DOXYGEN=ON ..
- $SCL ninja all UnitTests docs
- ./bin/kafka-to-nexus --version
- ./bin/UnitTests
parallel:
matrix:
- DISTRO:
- debian11
- ubuntu2204
- DISTRO: almalinux8
SCL: scl enable gcc-toolset-12 --
archive:
stage: archive
image: registry.esss.lu.se/ecdc/ess-dmsc/docker-centos7-build-node:latest
script:
- cd build
- mkdir -p archive/kafka-to-nexus/bin
- cp ./bin/kafka-to-nexus archive/kafka-to-nexus/bin/
- cp -r ./lib archive/kafka-to-nexus/
- cp -r ./licenses archive/kafka-to-nexus/
- cp ./CONAN_INFO archive/kafka-to-nexus/
- cd archive
- tar czf kafka-to-nexus.tar.gz kafka-to-nexus
dependencies:
- build-release
artifacts:
paths:
- build/archive/kafka-to-nexus.tar.gz
integration-tests:
stage: integration
image: docker:latest
before_script:
- cd integration-tests
- ./setup.sh ../build/archive/kafka-to-nexus.tar.gz
script:
- ./run-integration-tests.sh
after_script:
- cd integration-tests
- ./teardown.sh
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
variables:
FILEWRITER_ZOOKEEPER_CONTAINER_NAME: zookeeper-$CI_JOB_ID
FILEWRITER_KAFKA_CONTAINER_NAME: kafka-$CI_JOB_ID
FILEWRITER_FILEWRITER_CONTAINER_NAME: filewriter-$CI_JOB_ID
HTTP_PROXY: $ESS_HTTP_PROXY
HTTPS_PROXY: $ESS_HTTP_PROXY
dependencies:
- archive
artifacts:
when: always
paths:
- integration-tests/IntegrationTestsOutput.xml
- integration-tests/logs/*
- integration-tests/output-files/*
reports:
junit: integration-tests/IntegrationTestsOutput.xml
keep-artifacts:
stage: release
image: registry.esss.lu.se/ecdc/ess-dmsc/docker-centos7-build-node:latest
script:
- ls build/archive/kafka-to-nexus.tar.gz
dependencies:
- archive
artifacts:
paths:
- build/archive/kafka-to-nexus.tar.gz
expire_in: never
rules:
- if: $CI_COMMIT_TAG