forked from BIM2SIM/bim2sim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
312 lines (278 loc) · 9.53 KB
/
.gitlab-ci.yml
File metadata and controls
312 lines (278 loc) · 9.53 KB
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
stages:
- build
- Test Base
- Test Plugin
- Test Regression
- doc
- code_quality
- release_modelica
- release_energyplus
- deploy
variables:
# TODO variable inside variable seems not be working on our gitlab instance,
# see post below, therefore use hardcoded image here for sphinx job
# https://stackoverflow.com/questions/67005507/variable-inside-variable-gitlab-ci
PYTHON_VERSION: "registry.git.rwth-aachen.de/ebc/ebc_all/github_ci/bim2sim/bim2sim:py3.11-occ7.9.0"
# PYTHON_VERSION: "${CI_REGISTRY}/environment:development"
GIT_SUBMODULE_STRATEGY: recursive
GH_REPO_URL: "git@github.com:BIM2SIM/bim2sim.git"
GH_PAGES_URL: "https://bim2sim.github.io/${CI_PROJECT_NAME}/"
TEST_ENGINE: "unittest"
TEST_PATH: test
include:
- 'ci/builds_releases.gitlab-ci.yml'
- project: 'EBC/EBC_all/gitlab_ci/templates'
file: 'python/code-quality/pylint.gitlab-ci.yml'
- project: 'EBC/EBC_all/gitlab_ci/templates'
file: 'python/doc/sphinxdoc.gitlab-ci.yml'
- project: 'EBC/EBC_all/gitlab_ci/templates'
file: 'pages/gh-pages.gitlab-ci.yml'
# Pre setup environment for included templates
.install_local_repository:
script:
# if stage is doc, we need to install documentation specific dependencies
- eval "$(micromamba shell hook --shell bash)"
- micromamba activate base
- pip install -e .[docu,PluginTEASER,PluginEnergyPlus,PluginAixLib,PluginCFD,PluginHKESim,PluginLCA,PluginComfort,PluginOpenFOAM]
# Tests
.test_template_base: &test_template_base
stage: Test Base
before_script:
- eval "$(micromamba shell hook --shell bash)"
- micromamba activate base
script:
- mkdir -p ~/bim2sim-coding/
- mv ./* ~/bim2sim-coding/
- cd ~/bim2sim-coding
- pip install -e .[test]
- export BIM2SIM_LOG_LEVEL=ERROR
- |
if [ "$COVERAGE" = "true" ]; then
coverage run -m unittest discover ~/bim2sim-coding/test
mkdir -p /builds/EBC/EBC_all/github_ci/bim2sim/$CI_COMMIT_REF_NAME/coverage
coverage html -d /builds/EBC/EBC_all/github_ci/bim2sim/$CI_COMMIT_REF_NAME/coverage
coverage-badge -o /builds/EBC/EBC_all/github_ci/bim2sim/$CI_COMMIT_REF_NAME/coverage/badge.svg
else
python -m unittest discover ~/bim2sim-coding/test
fi
- ls -la
artifacts:
paths:
- $CI_COMMIT_REF_NAME/coverage
expire_in: 2 hrs
.test_template_plugin_integration: &test_template_plugin_integration
stage: Test Plugin
before_script:
- eval "$(micromamba shell hook --shell bash)"
- micromamba activate base
script:
- mkdir -p ~/bim2sim-coding/
- mv ./* ~/bim2sim-coding/
- cd ~/bim2sim-coding
- pip install -e .[test]
- pip install -e .[$plugin]
- export BIM2SIM_LOG_LEVEL=ERROR
# run coverage for unit and integration tests if they exist
- |
plugin_test_dir=~/bim2sim-coding/bim2sim/plugins/${plugin}/test
if [ -d "${plugin_test_dir}/unit" ] || [ -d "${plugin_test_dir}/integration" ]; then
if [ -d "${plugin_test_dir}/unit" ]; then
echo "Running unit tests..."
coverage run --source=~/bim2sim-coding/bim2sim/plugins/${plugin} -m unittest discover -v ${plugin_test_dir}/unit
fi
if [ -d "${plugin_test_dir}/integration" ]; then
echo "Running integration tests..."
coverage run --append --source=~/bim2sim-coding/bim2sim/plugins/${plugin} -m unittest discover -v ${plugin_test_dir}/integration
fi
else
echo "No unit or integration test directories found."
exit 1
fi
.test_template_plugin_regression: &test_template_plugin_regression
stage: Test Regression
before_script:
- eval "$(micromamba shell hook --shell bash)"
- micromamba activate base
script:
- mkdir -p ~/bim2sim-coding/
- mv ./* ~/bim2sim-coding/
- cd ~/bim2sim-coding
- pip install -e .[test]
- pip install -e .[$plugin]
- export BIM2SIM_LOG_LEVEL=ERROR
# perform prepare_regression_tests if it exists
- |
if [ -f ~/bim2sim-coding/bim2sim/plugins/${plugin}/test/regression/prepare_regression_tests.py ]; then
python ~/bim2sim-coding/bim2sim/plugins/${plugin}/test/regression/prepare_regression_tests.py
else
echo "Skipping regression test preparation for ${plugin}: File not found"
fi
# for EP image create Minimal.idf file
- |
if [[ "$CI_JOB_IMAGE" == *"energyplus"* ]]; then
cat ~/bim2sim-coding/bim2sim/plugins/PluginEnergyPlus/data/Minimal.idf
fi
# use xvfb-run -n 77 command if dymola image is used
# use set +e to make sure the pipeline does not stop when the job returns exit code 1
- |
set +e
if [[ "$CI_JOB_IMAGE" == *"dymola"* ]]; then
xvfb-run -n 77 coverage run -m unittest discover ~/bim2sim-coding/bim2sim/plugins/${plugin}/test/regression
else
coverage run -m unittest discover ~/bim2sim-coding/bim2sim/plugins/${plugin}/test/regression
fi
test_exit_code=$?
set -e
- mkdir -p /builds/EBC/EBC_all/github_ci/bim2sim/logs/
- cp *.log /builds/EBC/EBC_all/github_ci/bim2sim/logs/ || true
- exit $test_exit_code
artifacts:
when: always
paths:
- logs/*
# All tests are done with the dev image, as the code in fresh installed anyway, so only the micromamba environment and the occ version can change between dev and main
# Unit tests for base
py3.10:
<<: *test_template_base
image: $CI_REGISTRY/bim2sim:py3.10-occ7.9.0
variables:
PYTHON_VERSION: "3.10"
COVERAGE: "false"
py3.11:
<<: *test_template_base
image: $CI_REGISTRY/bim2sim:py3.11-occ7.9.0
variables:
PYTHON_VERSION: "3.11"
COVERAGE: "true"
# Integration tests
PluginTEASER:py3.10:
<<: *test_template_plugin_integration
image: $CI_REGISTRY/bim2sim:py3.10-occ7.9.0
variables:
plugin: "PluginTEASER"
PluginTEASER:py3.11:
<<: *test_template_plugin_integration
image: $CI_REGISTRY/bim2sim:py3.11-occ7.9.0
variables:
plugin: "PluginTEASER"
PluginAixLib:py3.10:
<<: *test_template_plugin_integration
image: $CI_REGISTRY/bim2sim:py3.10-occ7.9.0
variables:
plugin: "PluginAixLib"
PluginAixLib:py3.11:
<<: *test_template_plugin_integration
image: $CI_REGISTRY/bim2sim:py3.11-occ7.9.0
variables:
plugin: "PluginAixLib"
PluginEnergyPlus:py3.10:
<<: *test_template_plugin_integration
image: $CI_REGISTRY/bim2sim:energyplus9.4.0-py3.10
variables:
plugin: "PluginEnergyPlus"
PluginEnergyPlus:py3.11:
<<: *test_template_plugin_integration
image: $CI_REGISTRY/bim2sim:energyplus9.4.0-py3.11
variables:
plugin: "PluginEnergyPlus"
PluginHKESim:py3.10:
<<: *test_template_plugin_integration
image: $CI_REGISTRY/bim2sim:py3.10-occ7.9.0
variables:
plugin: "PluginHKESim"
PluginHKESim:py3.11:
<<: *test_template_plugin_integration
image: $CI_REGISTRY/bim2sim:py3.11-occ7.9.0
variables:
plugin: "PluginHKESim"
PluginLCA:py3.10:
<<: *test_template_plugin_integration
image: $CI_REGISTRY/bim2sim:py3.10-occ7.9.0
variables:
plugin: "PluginLCA"
PluginLCA:py3.11:
<<: *test_template_plugin_integration
image: $CI_REGISTRY/bim2sim:py3.11-occ7.9.0
variables:
plugin: "PluginLCA"
PluginComfort:py3.10:
<<: *test_template_plugin_integration
image: $CI_REGISTRY/bim2sim:energyplus9.4.0-py3.10
variables:
plugin: "PluginComfort"
PluginComfort:py3.11:
<<: *test_template_plugin_integration
image: $CI_REGISTRY/bim2sim:energyplus9.4.0-py3.11
variables:
plugin: "PluginComfort"
PluginOpenFOAM:py3.10:
<<: *test_template_plugin_integration
image: $CI_REGISTRY/bim2sim:energyplus9.4.0-py3.10
variables:
plugin: "PluginOpenFOAM"
PluginOpenFOAM:py3.11:
<<: *test_template_plugin_integration
image: $CI_REGISTRY/bim2sim:energyplus9.4.0-py3.11
variables:
plugin: "PluginOpenFOAM"
PluginIFCCheck:py3.10:
<<: *test_template_plugin_integration
image: $CI_REGISTRY/bim2sim:py3.10-occ7.9.0
variables:
plugin: "PluginIFCCheck"
PluginIFCCheck:py3.11:
<<: *test_template_plugin_integration
image: $CI_REGISTRY/bim2sim:py3.11-occ7.9.0
variables:
plugin: "PluginIFCCheck"
# Regression tests
PluginTEASER_reg:py3.10:
<<: *test_template_plugin_regression
image: $CI_REGISTRY/bim2sim:dymola2022-py3.10
variables:
plugin: "PluginTEASER"
PluginTEASER_reg:py3.11:
<<: *test_template_plugin_regression
image: $CI_REGISTRY/bim2sim:dymola2022-py3.11
variables:
plugin: "PluginTEASER"
PluginEnergyPlus_reg:py3.10:
<<: *test_template_plugin_regression
image: $CI_REGISTRY/bim2sim:energyplus9.4.0-py3.10
variables:
plugin: "PluginEnergyPlus"
PluginEnergyPlus_reg:py3.11:
<<: *test_template_plugin_regression
image: $CI_REGISTRY/bim2sim:energyplus9.4.0-py3.11
variables:
plugin: "PluginEnergyPlus"
PluginComfort_reg:py3.10:
<<: *test_template_plugin_regression
image: $CI_REGISTRY/bim2sim:energyplus9.4.0-py3.10
variables:
plugin: "PluginComfort"
PluginComfort_reg:py3.11:
<<: *test_template_plugin_regression
image: $CI_REGISTRY/bim2sim:energyplus9.4.0-py3.11
variables:
plugin: "PluginComfort"
PluginOpenFOAM_reg:py3.10:
<<: *test_template_plugin_regression
image: $CI_REGISTRY/bim2sim:energyplus9.4.0-py3.10
variables:
plugin: "PluginOpenFOAM"
PluginOpenFOAM_reg:py3.11:
<<: *test_template_plugin_regression
image: $CI_REGISTRY/bim2sim:energyplus9.4.0-py3.11
variables:
plugin: "PluginOpenFOAM"
PluginIFCCheck_reg:py3.10:
<<: *test_template_plugin_regression
image: $CI_REGISTRY/bim2sim:py3.10-occ7.9.0
variables:
plugin: "PluginIFCCheck"
PluginIFCCheck_reg:py3.11:
<<: *test_template_plugin_regression
image: $CI_REGISTRY/bim2sim:py3.11-occ7.9.0
variables:
plugin: "PluginIFCCheck"