-
Notifications
You must be signed in to change notification settings - Fork 53
860 lines (732 loc) Β· 26.5 KB
/
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
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
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
name: CI
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
env:
BUILD_TYPE: Release
CMAKE_FLAGS: >
-DSPIRIT_UI_USE_IMGUI=ON
-DSPIRIT_UI_CXX_USE_QT=OFF
-DSPIRIT_ENABLE_PINNING=ON
-DSPIRIT_ENABLE_DEFECTS=ON
SOURCES: "find core/include/ core/src/ ui-cpp/utility/ ui-cpp/ui-imgui/include/ ui-cpp/ui-imgui/src/ -iname *.hpp -o -iname *.cpp"
steps:
- uses: actions/checkout@v4
- name: π Install required system packages
run: |
sudo apt-get update
sudo apt-get install -y xorg-dev libglu1-mesa-dev libgtk-3-dev tree
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: π Install python packages
run: >
pip install --user numpy pylint
"black==22.10.0"
"clang-format==18.1.8"
"clang-tidy==18.1.8"
- name: π Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: β Configure
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS
- name: π§ͺ clang-format linting
if: always()
shell: bash
run: |
clang-format --version
OUTPUT=$($SOURCES | xargs clang-format -n 2>&1)
if [[ $OUTPUT ]]; then
echo "$OUTPUT"
exit 1
fi
- name: π§ͺ clang-tidy linting
if: always()
shell: bash
run: |
clang-tidy --version
- name: π§ͺ Python code formatting check
shell: bash
run: |
git ls-files core/python/{,**/}*.py | xargs black --check
git ls-files ui-python/{,**/}*.py | xargs black --check
- name: π§ͺ Python code quality checks, linting
shell: bash
run: pylint core/python/spirit --fail-under=8
test-gcc:
name: gcc ${{ matrix.parallelisation }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
- os: ubuntu-22.04
parallelisation: "openmp"
env:
BUILD_TYPE: Release
CMAKE_FLAGS: >
-DCMAKE_C_COMPILER=gcc
-DCMAKE_CXX_COMPILER=g++
-DSPIRIT_UI_USE_IMGUI=ON
-DSPIRIT_UI_CXX_USE_QT=OFF
-DSPIRIT_BUILD_TEST=ON
OMP_NUM_THREADS: 4
steps:
- uses: actions/checkout@v4
- name: π Install required system packages
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y xorg-dev libglu1-mesa-dev libgtk-3-dev
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: π Install python packages
run: pip install --user numpy
- name: π Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: β Configure
if: matrix.parallelisation == ''
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS
- name: β Configure with OpenMP
if: matrix.parallelisation == 'openmp'
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSPIRIT_USE_OPENMP=ON $CMAKE_FLAGS
- name: π Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE -j 2
- name: π§ͺ Test
shell: bash
working-directory: ${{runner.workspace}}/build
run: ctest -C $BUILD_TYPE --output-on-failure
test-clang:
name: clang ${{ matrix.parallelisation }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
parallelisation: ""
- os: ubuntu-24.04
parallelisation: "openmp"
# this build cannot be configured currently
# - os: ubuntu-24.04
# parallelisation: "cuda"
- os: macos-13
parallelisation: ""
- os: macos-13
parallelisation: "openmp"
- os: windows-2022
parallelisation: ""
- os: windows-2022
parallelisation: "openmp"
env:
BUILD_TYPE: Release
BUILD_SYSTEM_FLAG: ${{ matrix.os == 'windows-2022' && '-G Ninja' || '' }}
CMAKE_FLAGS: >
-DCMAKE_C_COMPILER=clang
-DCMAKE_CXX_COMPILER=clang++
-DSPIRIT_UI_USE_IMGUI=ON
-DSPIRIT_UI_CXX_USE_QT=OFF
-DSPIRIT_BUILD_TEST=ON
OMP_NUM_THREADS: 4
steps:
- uses: actions/checkout@v4
- name: π Install LLVM 17 and some libs (Ubuntu)
if: matrix.os == 'ubuntu-24.04'
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y xorg-dev libglu1-mesa-dev libgtk-3-dev clang-17 lldb-17 lld-17 libomp-17-dev
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-17 10
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-17 10
clang --version
- name: π Install CUDA Toolkit
if: matrix.parallelisation == 'cuda'
shell: bash
run: |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt-get update
sudo apt-get -y install cuda-toolkit-12-5
echo "/usr/local/cuda-12.5/bin" >> $GITHUB_PATH
echo "/usr/local/cuda-12.5/lib64" >> $GITHUB_PATH
- name: π Install LLVM (MacOS)
if: matrix.os == 'macos-13'
shell: bash
run: |
brew update
brew install llvm
echo "/usr/local/opt/llvm/bin" >> $GITHUB_PATH
echo "/opt/homebrew/opt/llvm/bin" >> $GITHUB_PATH
- name: π Install LLVM and Ninja (Windows)
if: matrix.os == 'windows-2022'
shell: pwsh
run: |
choco install llvm ninja -y
choco upgrade llvm
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: π Install python packages
run: pip install --user numpy
- name: π Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: β Configure
if: matrix.parallelisation == ''
shell: bash
working-directory: ${{runner.workspace}}/build
run: >
cmake $GITHUB_WORKSPACE
$BUILD_SYSTEM_FLAG
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
$CMAKE_FLAGS
- name: β Configure with CUDA
if: matrix.parallelisation == 'cuda'
shell: bash
working-directory: ${{runner.workspace}}/build
run: >
CUDA_PATH=/usr/local/cuda-12.5
cmake $GITHUB_WORKSPACE
-DCMAKE_CUDA_COMPILER=clang++
-DSPIRIT_CUDA_ARCH=70
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
$CMAKE_FLAGS
-DSPIRIT_USE_CUDA=ON
- name: β Configure with OpenMP
if: matrix.parallelisation == 'openmp'
shell: bash
working-directory: ${{runner.workspace}}/build
run: >
cmake $GITHUB_WORKSPACE
$BUILD_SYSTEM_FLAG
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
$CMAKE_FLAGS
-DSPIRIT_USE_OPENMP=ON
- name: π Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE -j 2
- name: π§ͺ Test
if: matrix.parallelisation != 'cuda'
shell: bash
working-directory: ${{runner.workspace}}/build
run: ctest -C $BUILD_TYPE --output-on-failure
test-nvcpp:
name: nvcpp ${{ matrix.parallelisation }} (ubuntu-22.04)
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
include:
- parallelisation: ""
# - parallelisation: "openmp" # Some OpenMP that Spirit uses isn't supported by nvc++
- parallelisation: "cuda"
env:
BUILD_TYPE: Release
CMAKE_FLAGS: >
-DCMAKE_CXX_COMPILER=nvc++
-DSPIRIT_UI_USE_IMGUI=ON
-DSPIRIT_UI_CXX_USE_QT=OFF
-DSPIRIT_BUILD_TEST=ON
OMP_NUM_THREADS: 4
steps:
- uses: actions/checkout@v4
- name: Force upgrade to gcc-12 on Ubuntu 22.04
if: matrix.os == 'ubuntu-22.04'
shell: bash
run: |
sudo apt-get update
sudo apt-get --purge remove -y "g++*"
sudo apt-get install -y g++-12
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 10
- name: π Install NVIDIA HPC SDK and some libs
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y xorg-dev libglu1-mesa-dev libgtk-3-dev
curl https://developer.download.nvidia.com/hpc-sdk/ubuntu/DEB-GPG-KEY-NVIDIA-HPC-SDK | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg
echo 'deb [signed-by=/usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg] https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64 /' | sudo tee /etc/apt/sources.list.d/nvhpc.list
sudo apt-get update -y
sudo apt-get install -y nvhpc-24-5
echo "/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/bin" >> $GITHUB_PATH
echo "/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/math_libs/lib64" >> $GITHUB_PATH
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: π Install python packages
run: pip install --user numpy
- name: π Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: β Configure
if: matrix.parallelisation == ''
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS
- name: β Configure with OpenMP
if: matrix.parallelisation == 'openmp'
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS -DSPIRIT_USE_OPENMP=ON
- name: β Configure with CUDA
if: matrix.parallelisation == 'cuda'
shell: bash
working-directory: ${{runner.workspace}}/build
run: >
cmake $GITHUB_WORKSPACE
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
$CMAKE_FLAGS
-DSPIRIT_USE_CUDA=ON
-DCUDA_TOOLKIT_ROOT_DIR=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/cuda/
- name: π Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE -j 2
- name: π§ͺ Test
if: matrix.parallelisation != 'cuda'
shell: bash
working-directory: ${{runner.workspace}}/build
run: ctest -C $BUILD_TYPE --output-on-failure
test-msvc:
name: msvc (windows-2022)
runs-on: windows-2022
env:
BUILD_TYPE: Release
CMAKE_FLAGS: >
-DSPIRIT_UI_USE_IMGUI=ON
-DSPIRIT_UI_CXX_USE_QT=OFF
-DSPIRIT_BUILD_TEST=ON
steps:
- uses: actions/checkout@v4
- name: π Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: π Install python packages
run: pip install --user numpy
- name: β Configure
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS
- name: π Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE -j 2
- name: π§ͺ Test
shell: bash
working-directory: ${{runner.workspace}}/build
run: ctest -C $BUILD_TYPE --output-on-failure
test-debug-coverage:
name: test debug and coverage (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
coverage: true
- os: macos-13
- os: windows-2022
env:
BUILD_TYPE: Debug
CMAKE_FLAGS: >
-DSPIRIT_UI_USE_IMGUI=OFF
-DSPIRIT_UI_CXX_USE_QT=OFF
-DSPIRIT_BUILD_TEST=ON
EXCLUDETESTS: (configparser|solver)
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: π Install python packages
run: pip install --user numpy
- name: π Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: β Configure (without coverage)
if: matrix.coverage != true
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS
- name: β Configure (with coverage)
if: matrix.coverage == true
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSPIRIT_TEST_COVERAGE=ON $CMAKE_FLAGS
- name: π Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE -j 2
- name: π§ͺ Test regular debug build
if: matrix.coverage != true
shell: bash
working-directory: ${{runner.workspace}}/build
run: ctest -C $BUILD_TYPE -E $EXCLUDETESTS --output-on-failure
- name: π Install coverage packages
if: matrix.coverage == true
run: |
python -m pip install --upgrade pip
python -m pip install coverage 'coveralls<3' wheel
sudo apt-get update
sudo apt-get install -y lcov
- name: π§ͺ Generate C++ coverage
if: matrix.coverage == true
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
lcov -c -i --no-external --directory . --base-directory $GITHUB_WORKSPACE/core -o baseline.info
make test
lcov -c --no-external --directory . --base-directory $GITHUB_WORKSPACE/core -o after_test.info
lcov -a baseline.info -a after_test.info -o total_test.info
lcov -r total_test.info \*thirdparty\* \*/test/\* \*Collection\* \*DLL_\* -o coverage.info
- name: β¬ Upload C++ coverage
if: matrix.coverage == true
uses: codecov/codecov-action@v3
with:
files: ${{runner.workspace}}/build/coverage.info
- name: π§ͺ Generate Python API coverage
if: matrix.coverage == true
working-directory: ./core/python
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
coverage run --source spirit --omit=spirit/spiritlib.py \
-m unittest discover \
--start-directory ./test \
--pattern "*.py" \
> cov.txt
head cov.txt
coverage report -m
coverage xml
coveralls
test-other-configurations:
name: test ${{ matrix.configuration }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- configuration: "single-precision"
os: ubuntu-24.04
- configuration: "single-precision"
os: macos-13
- configuration: "pinning-and-defects"
os: ubuntu-24.04
env:
BUILD_TYPE: Release
CMAKE_FLAGS: >
-DSPIRIT_UI_USE_IMGUI=ON
-DSPIRIT_UI_CXX_USE_QT=OFF
-DSPIRIT_BUILD_TEST=ON
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: π Install python packages
run: pip install --user numpy
- name: Force install of gcc-13 on Ubuntu 24.04
if: matrix.os == 'ubuntu-24.04'
shell: bash
run: |
sudo apt-get update
sudo apt-get --purge remove -y "g++*"
sudo apt-get install -y g++-13
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 10
- name: π Install required system packages
if: matrix.os == 'ubuntu-24.04'
run: |
sudo apt-get update
sudo apt-get install -y xorg-dev libglu1-mesa-dev libgtk-3-dev
- name: π Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: β Configure single-precision build
if: matrix.configuration == 'single-precision'
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSPIRIT_SCALAR_TYPE="float" $CMAKE_FLAGS
- name: β Configure pinning-and-defects build
if: matrix.configuration == 'pinning-and-defects'
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSPIRIT_ENABLE_PINNING=ON -DSPIRIT_ENABLE_DEFECTS=ON $CMAKE_FLAGS
- name: π Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE -j 2
- name: π§ͺ Test
shell: bash
working-directory: ${{runner.workspace}}/build
run: ctest -C $BUILD_TYPE --output-on-failure
build-cuda:
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- os: ubuntu-22.04
env:
BUILD_TYPE: Release
CMAKE_FLAGS: -DSPIRIT_UI_USE_IMGUI=OFF -DSPIRIT_UI_CXX_USE_QT=OFF -DSPIRIT_USE_CUDA=ON -DSPIRIT_CUDA_ARCH=70
steps:
- uses: actions/checkout@v4
- name: Force downgrade to gcc-10 on Ubuntu 22.04 to avoid a bug in gcc-11.3 header
if: matrix.config.os == 'ubuntu-22.04'
shell: bash
run: |
sudo apt-get update
sudo apt-get --purge remove -y "g++*"
sudo apt-get install -y g++-10 cmake
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10
- name: π Install CUDA
shell: bash
run: |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt-get update
sudo apt-get install -y cuda-toolkit-12-4
echo "/usr/local/cuda-12.4/bin" >> $GITHUB_PATH
echo "/usr/local/cuda-12.4/lib64" >> $GITHUB_PATH
- name: π Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: β Configure
shell: bash
working-directory: ${{runner.workspace}}/build
run: >
CUDA_PATH=/usr/local/cuda
cmake $GITHUB_WORKSPACE
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
$CMAKE_FLAGS
- name: π Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE -j 2
build-ui-qt:
runs-on: ubuntu-20.04
env:
BUILD_TYPE: Release
CMAKE_FLAGS: -DSPIRIT_UI_USE_IMGUI=OFF -DSPIRIT_UI_CXX_USE_QT=ON
steps:
- uses: actions/checkout@v4
- name: π Install Qt5
run: |
sudo apt-get update
sudo apt-get install -y qt5-default libqt5charts5-dev
- name: π Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: β Configure
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS
- name: π Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE -j 2
build-webapp:
name: webapp ${{ matrix.target }} (ubuntu-22.04)
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
include:
- target: "mobile"
- target: "desktop"
env:
BUILD_TYPE: Release
CMAKE_FLAGS: -DSPIRIT_BUILD_FOR_JS=ON
EMSCRIPTEN_VERSION: "3.1.38"
steps:
- uses: actions/checkout@v4
- name: π Install Emscripten
working-directory: ${{runner.workspace}}
run: |
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install $EMSCRIPTEN_VERSION
./emsdk activate $EMSCRIPTEN_VERSION
- name: π Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: β Configure (mobile)
if: matrix.target == 'mobile'
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
source ${{runner.workspace}}/emsdk/emsdk_env.sh
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSPIRIT_UI_USE_IMGUI=OFF $CMAKE_FLAGS -DCMAKE_TOOLCHAIN_FILE=${{runner.workspace}}/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
- name: β Configure (desktop)
if: matrix.target == 'desktop'
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
source ${{runner.workspace}}/emsdk/emsdk_env.sh
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSPIRIT_UI_USE_IMGUI=ON $CMAKE_FLAGS -DCMAKE_TOOLCHAIN_FILE=${{runner.workspace}}/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
- name: π Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
source ${{runner.workspace}}/emsdk/emsdk_env.sh
cmake --build . --config $BUILD_TYPE -j 2
- name: π¦ Archive mobile web app
if: matrix.target == 'mobile'
uses: actions/upload-artifact@v3
with:
name: webapp-mobile
path: ui-web/
if-no-files-found: error
- name: π¦ Archive desktop web app
if: matrix.target == 'desktop'
uses: actions/upload-artifact@v3
with:
name: webapp-desktop
path: ui-cpp/ui-imgui/webapp/
if-no-files-found: error
deploy-pypi:
if: github.event_name != 'pull_request'
needs: [lint, test-gcc, test-clang, test-nvcpp, test-msvc, test-debug-coverage]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
env:
BUILD_TYPE: Release
CMAKE_FLAGS: -DSPIRIT_UI_USE_IMGUI=OFF -DSPIRIT_UI_CXX_USE_QT=OFF
SPIRIT_ADD_VERSION_SUFFIX: true
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: β Configure environment
shell: bash
if: github.ref == 'refs/heads/master'
run: echo "SPIRIT_ADD_VERSION_SUFFIX=false" >> $GITHUB_ENV
- name: π Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: β Configure
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS
- name: π Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE -j 2
- name: π Install necessary packages
run: |
python -m pip install --upgrade pip
python -m pip install numpy setuptools wheel twine
- name: π Build Python package
shell: bash
working-directory: ./core/python
run: |
echo "Python package build"
echo "Add suffix to spirit version tag for python package $SPIRIT_ADD_VERSION_SUFFIX"
python setup.py sdist bdist_wheel
- name: π Deploy to TestPyPI
working-directory: ./core/python
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
if: github.ref != 'refs/heads/master'
run: twine upload --skip-existing --repository testpypi dist/*
- name: π Deploy to PyPI
working-directory: ./core/python
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
if: github.ref == 'refs/heads/master'
run: twine upload --skip-existing dist/*
deploy-package:
if: github.event_name != 'pull_request'
needs: [lint, test-gcc, test-clang, test-nvcpp, test-msvc, test-debug-coverage]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
env:
BUILD_TYPE: Release
CMAKE_FLAGS: -DSPIRIT_UI_USE_IMGUI=ON -DSPIRIT_UI_CXX_USE_QT=OFF -DSPIRIT_BUNDLE_APP=ON
steps:
- uses: actions/checkout@v4
- name: π Install required system packages
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y xorg-dev libglu1-mesa-dev libgtk-3-dev
- name: π Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: β Configure
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS
- name: π Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
cmake --build . --config $BUILD_TYPE -j 2
cmake --install .
cmake --build . --config $BUILD_TYPE -j 2 --target package
- name: π¦ Archive ubuntu package
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v3
with:
name: spirit-ubuntu
path: ${{runner.workspace}}/build/*.tar.gz
if-no-files-found: error
- name: π¦ Archive macOS package
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v3
with:
name: spirit-macos
path: |
${{runner.workspace}}/build/*.dmg
${{runner.workspace}}/build/install/README.md
${{runner.workspace}}/build/install/LICENSE.txt
${{runner.workspace}}/build/install/VERSION.txt
${{runner.workspace}}/build/install/licenses/
if-no-files-found: error
- name: π¦ Archive windows package
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v3
with:
name: spirit-windows
path: ${{runner.workspace}}/build/*.zip
if-no-files-found: error
draft-release:
if: github.event_name == 'push' && startsWith( github.ref, 'refs/tags/' )
needs: [deploy-pypi, deploy-package, build-webapp]
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: π Generate a changelog
id: changelog
uses: metcalfc/[email protected]
with:
myToken: ${{ secrets.GITHUB_TOKEN }}
- name: π Print the changelog
run: echo "${{ steps.changelog.outputs.changelog }}"
- name: π Create draft release
id: draft_release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: ${{ steps.changelog.outputs.changelog }}
draft: true