@@ -2,75 +2,44 @@ name: Build and run tests
2
2
3
3
on : [push, pull_request]
4
4
5
+ env :
6
+ CMAKE_COLOR_DIAGNOSTICS : ON
7
+ OMP_NUM_THREADS : 1
8
+
5
9
jobs :
6
10
build :
7
- name : ${{ matrix.config.name }}
8
- runs-on : ${{ matrix.config. os }}
11
+ name : ${{ matrix.os }} ${{ matrix.shared_libs && 'shared' || 'static' }}
12
+ runs-on : ${{ matrix.os }}
9
13
10
14
strategy :
11
15
fail-fast : false
12
16
matrix :
13
- config :
14
- - {
15
- name : " Windows static" ,
16
- os : windows-latest,
17
- build_type : " Release" ,
18
- shared_libs : false,
19
- generators : " Visual Studio 17 2022"
20
- }
21
- - {
22
- name : " Ubuntu Linux static" ,
23
- os : ubuntu-latest,
24
- build_type : " Release" ,
25
- shared_libs : false,
26
- generators : " Ninja"
27
- }
28
- - {
29
- name : " macOS static" ,
30
- os : macos-latest,
31
- build_type : " Release" ,
32
- shared_libs : false,
33
- generators : " Ninja"
34
- }
35
- - {
36
- name : " Windows shared" ,
37
- os : windows-latest,
38
- build_type : " Release" ,
39
- shared_libs : true,
40
- generators : " Visual Studio 17 2022"
41
- }
42
- - {
43
- name : " Ubuntu Linux shared" ,
44
- os : ubuntu-latest,
45
- build_type : " Release" ,
46
- shared_libs : true,
47
- generators : " Ninja"
48
- }
49
- - {
50
- name : " macOS shared" ,
51
- os : macos-latest,
52
- build_type : " Release" ,
53
- shared_libs : true,
54
- generators : " Ninja"
55
- }
17
+ os : [windows-latest, ubuntu-latest, macos-latest]
18
+ build_type : ["Release"]
19
+ shared_libs : [false, true]
20
+ exclude :
21
+ - os : windows-latest
22
+ generators : Ninja # Windows doesn't use Ninja
23
+ generators :
24
+ - windows-latest : " Visual Studio 17 2022"
56
25
57
26
steps :
58
27
- uses : actions/checkout@v4
59
28
60
29
- name : Install dependencies on Windows
61
- if : startsWith(matrix.config. os, 'windows')
30
+ if : startsWith(matrix.os, 'windows')
62
31
run : choco install -y --no-progress cmake ninja
63
32
64
33
- name : Install dependencies on Linux
65
- if : startsWith(matrix.config. os, 'ubuntu')
34
+ if : startsWith(matrix.os, 'ubuntu')
66
35
run : |
67
36
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
68
37
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null
69
38
sudo apt-get update
70
39
sudo apt-get install ninja-build cmake
71
40
72
41
- name : Install dependencies on macOS
73
- if : startsWith(matrix.config. os, 'macos')
42
+ if : startsWith(matrix.os, 'macos')
74
43
run : brew install cmake ninja
75
44
76
45
- name : Prepare build folder
@@ -80,14 +49,14 @@ jobs:
80
49
cmake \
81
50
-S . \
82
51
-B build \
83
- -DBUILD_SHARED_LIBS=${{ matrix.config. shared_libs }} \
84
- -DCMAKE_BUILD_TYPE=${{ matrix.config. build_type }} \
85
- -G "${{ matrix.config. generators }}" \
52
+ -DBUILD_SHARED_LIBS=${{ matrix.shared_libs }} \
53
+ -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
54
+ -G "${{ matrix.generators }}" \
86
55
-DCMAKE_INSTALL_PREFIX:PATH=instdir
87
56
88
57
- name : Build project
89
58
shell : bash
90
- run : cmake --build build --config ${{ matrix.config. build_type }}
59
+ run : cmake --build build --config ${{ matrix.build_type }}
91
60
92
61
- name : Run tests
93
62
shell : bash
101
70
uses : actions/upload-artifact@v4
102
71
if : always()
103
72
with :
104
- name : unit-test-results-${{ matrix.config. os }}-${{ matrix.config .shared_libs }}
73
+ name : unit-test-results-${{ matrix.os }}-${{ matrix.shared_libs }}
105
74
path : build/report.xml
106
75
107
76
- name : Install and strip
108
77
shell : bash
109
- run : cmake --install build --config ${{ matrix.config. build_type }} --strip
78
+ run : cmake --install build --config ${{ matrix.build_type }} --strip
0 commit comments