-
Notifications
You must be signed in to change notification settings - Fork 93
446 lines (411 loc) · 14.2 KB
/
build.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
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
on: [ push, pull_request, workflow_dispatch ]
name: Build
jobs:
build-linux-memtest:
runs-on: ubuntu-20.04
steps:
- run: sudo apt update
- run: sudo apt install -y valgrind uuid-dev
- uses: actions/checkout@v2
with:
submodules: true
- run: sh cmake/GenerateMake.sh
- run: cmake --build . --target lib3mf_memcheck
working-directory: ./build
build-linux-ubi8-gcc12:
runs-on: ubuntu-20.04
steps:
- run: sudo apt update
- run: sudo apt install -y uuid-dev
- uses: actions/checkout@v2
with:
submodules: true
- run: mkdir -p build
- run: zip -r build/bindings.zip Autogenerated/Bindings
- name: Archive bindings
uses: actions/upload-artifact@v2
with:
name: bindings.zip
path: build/bindings.zip
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker Build
uses: docker/build-push-action@v5
with:
context: .
file: ./CI/Dockerfile
platforms: linux/amd64
tags: lib3mf_ubi8:latest
load: true
- name: Docker Extract
uses: shrink/[email protected]
id: extract
with:
image: lib3mf_ubi8:latest
path: out.zip
destination: dist
- run: unzip out.zip
working-directory: ./dist
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: lib3mf.so
path: dist/lib3mf.so.2
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- run: sh cmake/GenerateMake.sh "-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64"
- run: cmake --build .
working-directory: ./build
- run: ctest -V
working-directory: ./build
- name: Archive Mac binary
uses: actions/upload-artifact@v2
with:
name: lib3mf.dylib
path: build/lib3mf.dylib
build-macos-debug:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- run: sh cmake/GenerateMake.sh "-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64 -DCMAKE_BUILD_TYPE=Debug"
- run: cmake --build .
working-directory: ./build
- run: ctest -V
working-directory: ./build
- name: Archive Mac binary
uses: actions/upload-artifact@v2
with:
name: lib3mf.debug.dylib
path: build/lib3mf.dylib
codecoverage-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Prerequisites
run: |
brew install lcov
brew install gcovr
- run: sh cmake/GenerateMake.sh -DBUILD_FOR_CODECOVERAGE=ON
- run: cmake --build .
working-directory: ./build
- run: ./Tests/codecoverage/run_codecoverage.sh
- name: Archive Code Coverage Results
uses: actions/upload-artifact@v2
with:
name: codecoverage.zip
path: build/codecoverage.zip
- name: Upload code coverage to codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./build/Test_CPP_Bindings_filtered.info
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
build-windows-release:
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
with:
submodules: true
- run: ./cmake/GenerateVS2019.bat
- run: cmake --build . --config Release
working-directory: ./build
- run: ctest -V
working-directory: ./build
- name: Archive Windows Release binary
uses: actions/upload-artifact@v2
with:
name: lib3mf.dll
path: build/Release/lib3mf.dll
- name: Archive Windows Release lib
uses: actions/upload-artifact@v2
with:
name: lib3mf.lib
path: build/Release/lib3mf.lib
build-windows-debug:
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
with:
submodules: true
- run: ./cmake/GenerateVS2019.bat
- run: cmake --build . --config Debug
working-directory: ./build
- run: ctest -V
working-directory: ./build
- name: Archive Windows Debug binary
uses: actions/upload-artifact@v2
with:
name: lib3mf.debug.dll
path: build/Debug/lib3mf.dll
- uses: actions/upload-artifact@v2
with:
name: lib3mf.pdb
path: build/Debug/lib3mf.pdb
- uses: actions/upload-artifact@v2
with:
name: lib3mf.debug.lib
path: build/Debug/lib3mf.lib
build-windows-32bit:
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
with:
submodules: true
- run: ./cmake/GenerateVS2019_32bit.bat
- run: cmake --build . --config Release
working-directory: ./build_32bit
- run: ctest -V
working-directory: ./build_32bit
- name: Archive Windows 32 bit Release binary
uses: actions/upload-artifact@v2
with:
name: lib3mf_32bit.dll
path: build_32bit/Release/lib3mf.dll
- name: Archive Windows 32 bit Release lib
uses: actions/upload-artifact@v2
with:
name: lib3mf_32bit.lib
path: build_32bit/Release/lib3mf.lib
build-mingw-w64:
runs-on: windows-2019
steps:
- run: choco install mingw -y
- uses: actions/checkout@v2
with:
submodules: true
- run: ./cmake/GenerateMinGW.bat
- run: cmake --build .
working-directory: ./build
- run: ctest -V
working-directory: ./build
assemble-sdk:
runs-on: ubuntu-20.04
needs: [ build-windows-release, build-macos, build-linux-ubi8-gcc12 ]
steps:
- run: sudo apt install -y zip unzip
- run: mkdir build
- uses: actions/checkout@v2
with:
submodules: false
- name: Download all workflow run artifacts
uses: actions/download-artifact@v2
with:
path: ./build
- run: ls -Rl ./build
- run: unzip bindings.zip/bindings.zip
working-directory: ./build
- run: bash SDK/GenerateSDK_github.sh
- name: Archive SDK artifact
uses: actions/upload-artifact@v2
with:
name: lib3mf_sdk.zip
path: build/lib3mf_sdk.zip
deploy-linux:
runs-on: ubuntu-20.04
needs: [ assemble-sdk ]
steps:
- run: sudo apt install -y zip unzip
- run: pwd
- run: ls -Rl .
- name: Download lib3mf_sdk artifact
uses: actions/download-artifact@v2
with:
name: lib3mf_sdk.zip
path: lib3mf_sdk.zip
- run: ls -Rl .
- name: Unpack the SDK
run: |
unzip lib3mf_sdk.zip/lib3mf_sdk.zip
- name: Build CppDynamic
run: |
sh Examples/CppDynamic/GenerateMake.sh
cd Examples/CppDynamic/build
cmake --build .
./Example_ExtractInfo ../../Files/Helix.3mf
- name: Build Cpp
run: |
sh Examples/Cpp/GenerateMake.sh
cd Examples/Cpp/build
cmake --build .
./Example_ExtractInfo ../../Files/Helix.3mf
deploy-windows:
runs-on: windows-2019
needs: [ assemble-sdk ]
steps:
- name: Download lib3mf_sdk artifact
uses: actions/download-artifact@v2
with:
name: lib3mf_sdk.zip
path: lib3mf_sdk.zip
- name: Unpack the SDK
run: |
unzip lib3mf_sdk.zip/lib3mf_sdk.zip
- name: Build CppDynamic
run: |
./Examples/CppDynamic/GenerateVS2019.bat
cd Examples/CppDynamic/build
cmake --build . --config Release
./Release/Example_ExtractInfo.exe ../../Files/Helix.3mf
- name: Build Cpp
run: |
./Examples/Cpp/GenerateVS2019.bat
cd Examples/Cpp/build
cmake --build . --config Release
./Release/Example_ExtractInfo.exe ../../Files/Helix.3mf
deploy-macos:
runs-on: macos-latest
needs: [ assemble-sdk ]
steps:
- name: Download lib3mf_sdk artifact
uses: actions/download-artifact@v2
with:
name: lib3mf_sdk.zip
path: lib3mf_sdk.zip
- name: Unpack the SDK
run: |
unzip lib3mf_sdk.zip/lib3mf_sdk.zip
- name: Build CppDynamic
run: |
sh Examples/CppDynamic/GenerateMake.sh
cd Examples/CppDynamic/build
cmake --build .
./Example_ExtractInfo ../../Files/Helix.3mf
- name: Build Cpp
run: |
sh Examples/Cpp/GenerateMake.sh
cd Examples/Cpp/build
cmake --build .
./Example_ExtractInfo ../../Files/Helix.3mf
integration-tests-latest-release:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Get latest lib3mf SDK release info from GitHub API
id: get_lib3mf_release
run: |
LATEST_LIB3MF_URL=$(curl -s https://api.github.com/repos/3MFConsortium/lib3mf/releases/latest | grep "browser_download_url.*zip" | cut -d '"' -f 4)
echo "LATEST_LIB3MF_URL=${LATEST_LIB3MF_URL}" >> $GITHUB_ENV
- name: Download latest lib3mf SDK zip
run: |
wget ${{ env.LATEST_LIB3MF_URL }} -O latest_lib3mf_sdk.zip
- name: Unpack the SDK
run: |
unzip latest_lib3mf_sdk.zip -d lib3mf_sdk
- name: Build CppDynamic
run: |
sh lib3mf_sdk/Examples/CppDynamic/GenerateMake.sh
cd lib3mf_sdk/Examples/CppDynamic/build
cmake --build .
./Example_ExtractInfo ../../Files/Helix.3mf
- name: Download and unzip test suite
run: |
wget https://github.com/3MFConsortium/test_suites/releases/download/v2.0.0/3MF_Conformance_Test_Suites_v2.0.0.zip
unzip 3MF_Conformance_Test_Suites_v2.0.0.zip -d test_suites
- name: List files
run: |
ls -al
- name: Copy integration test script
run: |
cp CI/integration_test.py test_suites/ && cp -r lib3mf_sdk/Examples/CppDynamic/build/* test_suites/
- name: Run integration tests
run: |
cd test_suites && python integration_test.py
integration-tests-last-two-releases:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Get latest lib3mf SDK release info from GitHub API
id: get_latest_release
run: |
LATEST_LIB3MF_URL=$(curl -s https://api.github.com/repos/3MFConsortium/lib3mf/releases/latest | grep "browser_download_url.*zip" | cut -d '"' -f 4)
echo "LATEST_LIB3MF_URL=${LATEST_LIB3MF_URL}" >> $GITHUB_ENV
- name: Get second latest lib3mf SDK release info from GitHub API
id: get_second_latest_release
run: |
SECOND_LATEST_LIB3MF_URL=$(curl -s https://api.github.com/repos/3MFConsortium/lib3mf/releases | grep "browser_download_url.*zip" | cut -d '"' -f 4 | sed -n '2p')
echo "SECOND_LATEST_LIB3MF_URL=${SECOND_LATEST_LIB3MF_URL}" >> $GITHUB_ENV
- name: Download latest lib3mf SDK zip
run: |
wget ${{ env.LATEST_LIB3MF_URL }} -O latest_lib3mf_sdk.zip
- name: Download second latest lib3mf SDK zip
run: |
wget ${{ env.SECOND_LATEST_LIB3MF_URL }} -O second_latest_lib3mf_sdk.zip
- name: Unpack the latest SDK
run: |
unzip latest_lib3mf_sdk.zip -d latest_lib3mf_sdk
- name: Unpack the second latest SDK
run: |
unzip second_latest_lib3mf_sdk.zip -d second_latest_lib3mf_sdk
- name: Download and unzip test suite
run: |
wget https://github.com/3MFConsortium/test_suites/releases/download/v2.0.0/3MF_Conformance_Test_Suites_v2.0.0.zip
unzip 3MF_Conformance_Test_Suites_v2.0.0.zip -d test_suites
- name: Copy integration test script
run: |
cp CI/integration_test.py test_suites/
- name: Build and run CppDynamic with latest SDK
run: |
sh latest_lib3mf_sdk/Examples/CppDynamic/GenerateMake.sh
cd latest_lib3mf_sdk/Examples/CppDynamic/build
cmake --build .
cp -r * ../../../../test_suites/
- name: Run integration tests with latest SDK
run: |
cd test_suites
/usr/bin/time -v python integration_test.py 2>&1 | tee latest_sdk_test.log
- name: Clean up latest SDK binaries
run: |
find test_suites -maxdepth 1 ! -name 'integration_test.py' ! -name 'latest_sdk_test.log' -exec rm -rf {} +
- name: Build and run CppDynamic with second latest SDK
run: |
sh second_latest_lib3mf_sdk/Examples/CppDynamic/GenerateMake.sh
cd second_latest_lib3mf_sdk/Examples/CppDynamic/build
cmake --build .
echo "First debug"
ls -al ../../../../
echo "This will fail"
cp -r * ../../../../test_suites/
- name: Run integration tests with second latest SDK
run: |
cd test_suites
/usr/bin/time -v python integration_test.py 2>&1 | tee second_latest_sdk_test.log
- name: Compare results
run: |
LATEST_TIME=$(grep "Elapsed (wall clock) time" test_suites/latest_sdk_test.log | awk '{print $8}')
SECOND_LATEST_TIME=$(grep "Elapsed (wall clock) time" test_suites/second_latest_sdk_test.log | awk '{print $8}')
echo "Latest SDK execution time: ${LATEST_TIME}"
echo "Second Latest SDK execution time: ${SECOND_LATEST_TIME}"
if [ $(echo "$LATEST_TIME < $SECOND_LATEST_TIME" | bc) -eq 1 ]; then
echo "New release is better"
else
echo "New release is worse"
fi