-
Notifications
You must be signed in to change notification settings - Fork 18
74 lines (62 loc) · 2.34 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
name: Build and run tests
on: [push, pull_request]
jobs:
build:
name: ${{ matrix.os }} ${{ matrix.shared_libs && 'shared' || 'static' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
build_type: ["Release"]
shared_libs: [false, true]
exclude:
- os: windows-latest
generator: Ninja # Windows doesn't use Ninja
generator:
- windows-latest: "Visual Studio 17 2022"
steps:
- uses: actions/checkout@v4
- name: Install dependencies on Windows
if: startsWith(matrix.os, 'windows')
run: choco install -y --no-progress cmake ninja
- name: Install dependencies on Linux
if: startsWith(matrix.os, 'ubuntu')
run: |
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
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
sudo apt-get update
sudo apt-get install ninja-build cmake
- name: Install dependencies on macOS
if: startsWith(matrix.os, 'macos')
run: brew install cmake ninja
- name: Prepare build folder
shell: bash
run: |
mkdir build
cmake \
-S . \
-B build \
-DBUILD_SHARED_LIBS=${{ matrix.shared_libs }} \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-G "${{ matrix.generator }}" \
-DCMAKE_INSTALL_PREFIX:PATH=instdir
- name: Build project
shell: bash
run: cmake --build build --config ${{ matrix.build_type }}
- name: Run tests
shell: bash
env:
CTEST_OUTPUT_ON_FAILURE: 1
run: |
cd build
ctest --output-junit report.xml
- name: Archive unit test results
uses: actions/upload-artifact@v4
if: always()
with:
name: unit-test-results-${{ matrix.os }}-${{ matrix.shared_libs }}
path: build/report.xml
- name: Install and strip
shell: bash
run: cmake --install build --config ${{ matrix.build_type }} --strip