-
Notifications
You must be signed in to change notification settings - Fork 1
130 lines (130 loc) · 4.95 KB
/
build-and-test.yaml
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
name: Build and test
on: push
jobs:
build-linux:
name: Build ${{ matrix.os }} ${{ matrix.build_type }} with ${{ matrix.preset }}
strategy:
matrix:
os: [ubuntu-22.04]
build_type: [Debug, Release]
preset: [gcc-12, clang-17]
runs-on: ${{ matrix.os }}
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Restore cache
uses: actions/cache@v3
id: vcpkg-cache-linux
with:
path: ~/.cache/vcpkg
key: ${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.preset }}-${{ hashFiles('**/vcpkg.json', '**/CMakePresets.json') }}
- name: Install system dependencies
run: |
sudo apt update || exit $?
sudo apt -y install ninja-build || exit $?
- name: Install clang-17
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x ./llvm.sh
sudo ./llvm.sh 17
- name: Configure
run: |
cmake -S . -B cmake-build --preset ${{ matrix.preset }} \
-DFL_DEV=ON \
-DFL_TEST=ON \
-DFL_BENCHMARK=ON \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake || exit $?
- name: Build
run: |
cmake --build cmake-build --parallel --config ${{ matrix.build_type }} || exit $?
- name: Test
run: ctest -E "benchmark$" --test-dir "cmake-build" || exit $?
- name: Benchmark
if: ${{ matrix.build_type == 'Release' }}
run: ctest -R "benchmark$" --test-dir "cmake-build" || exit $?
build-mac:
name: Build ${{ matrix.os }} ${{ matrix.build_type }} with ${{ matrix.preset }}
strategy:
matrix:
os: [macos-12]
build_type: [Debug, Release]
preset: [system-clang]
runs-on: ${{ matrix.os }}
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Restore cache
uses: actions/cache@v3
id: vcpkg-cache-macos
with:
path: ~/.cache/vcpkg
key: ${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.preset }}-${{ hashFiles('**/vcpkg.json', '**/CMakePresets.json') }}
- name: Install system dependencies
run: |
brew install ninja || exit $?
brew install gcc@12 || exit $?
brew install pkg-config || exit $?
- name: Configure
run: |
cmake -S . -B cmake-build --preset ${{ matrix.preset }} \
-DFL_DEV=ON \
-DFL_TEST=ON \
-DFL_BENCHMARK=ON \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake || exit $?
- name: Build
run: |
cmake --build cmake-build --parallel --config ${{ matrix.build_type }} || exit $?
- name: Test
run: ctest -E "benchmark$" --test-dir "cmake-build" || exit $?
- name: Benchmark
if: ${{ matrix.build_type == 'Release' }}
run: ctest -R "benchmark$" --test-dir "cmake-build" || exit $?
build-windows:
name: Build ${{ matrix.os }} ${{ matrix.build_type }} with ${{ matrix.preset }}
strategy:
matrix:
os: [windows-2022]
build_type: [Debug, Release]
preset: [msvc-system]
runs-on: ${{ matrix.os }}
steps:
- name: Save vcpkg env vars
shell: powershell
run: |
"vcpkg_root=$env:VCPKG_INSTALLATION_ROOT" >> $env:GITHUB_ENV
"vcpkg_cache=$env:LOCALAPPDATA\vcpkg\" >> $env:GITHUB_ENV
- name: Check out code
uses: actions/checkout@v3
- name: Restore cache
uses: actions/cache@v3
id: vcpkg-cache-windows
with:
path: ${{ env.vcpkg_cache }}
key: ${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.preset }}-${{ hashFiles('**/vcpkg.json', '**/CMakePresets.json') }}
- name: Install system dependencies
shell: powershell
run: choco install ninja -y
- name: Configure
shell: powershell
run: |
& 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Launch-VsDevShell.ps1' -SkipAutomaticLocation
cmake -S . -B cmake-build --preset ${{ matrix.preset }} `
-DFL_DEV=ON `
-DFL_TEST=ON `
-DFL_BENCHMARK=ON `
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} `
-DCMAKE_TOOLCHAIN_FILE=${{ env.vcpkg_root }}\scripts\buildsystems\vcpkg.cmake
- name: Build
shell: powershell
run: |
& 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Launch-VsDevShell.ps1' -SkipAutomaticLocation
cmake --build cmake-build --parallel --config ${{ matrix.build_type }}
- name: Test
shell: powershell
run: ctest -E "benchmark$" --test-dir "cmake-build"
- name: Benchmark
if: ${{ matrix.build_type == 'Release' }}
shell: powershell
run: ctest -R "benchmark$" --test-dir "cmake-build"