Skip to content

Commit 94e6f0a

Browse files
committed
ci
1 parent a6eae85 commit 94e6f0a

File tree

1 file changed

+23
-54
lines changed

1 file changed

+23
-54
lines changed

.github/workflows/build.yml

Lines changed: 23 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2,75 +2,44 @@ name: Build and run tests
22

33
on: [push, pull_request]
44

5+
env:
6+
CMAKE_COLOR_DIAGNOSTICS: ON
7+
OMP_NUM_THREADS: 1
8+
59
jobs:
610
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 }}
913

1014
strategy:
1115
fail-fast: false
1216
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"
5625

5726
steps:
5827
- uses: actions/checkout@v4
5928

6029
- name: Install dependencies on Windows
61-
if: startsWith(matrix.config.os, 'windows')
30+
if: startsWith(matrix.os, 'windows')
6231
run: choco install -y --no-progress cmake ninja
6332

6433
- name: Install dependencies on Linux
65-
if: startsWith(matrix.config.os, 'ubuntu')
34+
if: startsWith(matrix.os, 'ubuntu')
6635
run: |
6736
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
6837
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
6938
sudo apt-get update
7039
sudo apt-get install ninja-build cmake
7140
7241
- name: Install dependencies on macOS
73-
if: startsWith(matrix.config.os, 'macos')
42+
if: startsWith(matrix.os, 'macos')
7443
run: brew install cmake ninja
7544

7645
- name: Prepare build folder
@@ -80,14 +49,14 @@ jobs:
8049
cmake \
8150
-S . \
8251
-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 }}" \
8655
-DCMAKE_INSTALL_PREFIX:PATH=instdir
8756
8857
- name: Build project
8958
shell: bash
90-
run: cmake --build build --config ${{ matrix.config.build_type }}
59+
run: cmake --build build --config ${{ matrix.build_type }}
9160

9261
- name: Run tests
9362
shell: bash
@@ -101,9 +70,9 @@ jobs:
10170
uses: actions/upload-artifact@v4
10271
if: always()
10372
with:
104-
name: unit-test-results-${{ matrix.config.os }}-${{ matrix.config.shared_libs }}
73+
name: unit-test-results-${{ matrix.os }}-${{ matrix.shared_libs }}
10574
path: build/report.xml
10675

10776
- name: Install and strip
10877
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

Comments
 (0)