-
Notifications
You must be signed in to change notification settings - Fork 21
60 lines (57 loc) · 1.67 KB
/
cmake.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
name: "CMake build"
on:
push:
pull_request:
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
build:
name: ${{ matrix.toolchain }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
toolchain:
- linux-gcc
- macos-clang
- windows-msvc
- windows-mingw
configuration:
- Debug
include:
- toolchain: linux-gcc
os: ubuntu-latest
compiler: gcc
- toolchain: macos-clang
os: macos-latest
compiler: clang
- toolchain: windows-msvc
os: windows-latest
compiler: msvc
- toolchain: windows-mingw
os: windows-latest
compiler: mingw
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Configure (${{ matrix.configuration }})
run: |
if [ "${{ matrix.compiler }}" == "msvc" ]; then
cmake -S . -B build -DBUILD_TESTS=ON
elif [ "${{ matrix.compiler }}" == "mingw" ]; then
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -DBUILD_TESTS=ON -G "MinGW Makefiles"
else
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -DBUILD_TESTS=ON
fi
- name: Build with ${{ matrix.compiler }}
run: |
if [ "${{ matrix.compiler }}" == "msvc" ]; then
cmake --build build --config ${{ matrix.configuration }}
else
cmake --build build -- -j8
fi
- name: Test
run: |
ctest --test-dir build --build-config ${{ matrix.configuration }} --verbose