-
Notifications
You must be signed in to change notification settings - Fork 10
206 lines (189 loc) · 5.86 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
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
name: build
on:
push:
branches:
- main
paths:
- '.github/workflows/build.yml'
- 'include/**'
- 'tests/**'
- 'CMakeLists.txt'
- 'cmake/**'
- 'nix/**'
pull_request:
branches:
- main
paths:
- '.github/workflows/build.yml'
- 'include/**'
- 'tests/**'
- 'CMakeLists.txt'
- 'cmake/**'
- 'nix/**'
jobs:
linux:
runs-on:
group: default
strategy:
fail-fast: false
matrix:
configuration:
- Debug
- Release
env:
- compiler: gcc
release: 12
modes: "cxx20"
- compiler: clang
release: 16
modes: "cxx20"
- compiler: clang
release: 17
modes: "cxx20"
- compiler: gcc
release: 13
modes: "cxx20 cxx23"
- compiler: gcc
release: 14
modes: "cxx20 cxx23"
- compiler: clang
release: 18
modes: "cxx20 cxx23"
- compiler: clang
release: 19
modes: "cxx20 cxx23"
container: libfn/ci-build-${{ matrix.env.compiler }}:${{ matrix.env.release }}
steps:
- uses: actions/checkout@v4
- name: Prepare build
run: |
mkdir .build
cd .build
cmake -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} ..
COMPILER=$( grep -iE "^CMAKE_CXX_COMPILER:FILEPATH=" CMakeCache.txt | sed -n 's/^[^=]*=//p' )
FLAGS=$( grep -iE "^CMAKE_CXX_FLAGS(_${{ matrix.configuration }})?:STRING" CMakeCache.txt | sed -n 's/^[^=]*=//p' | tr '\n' ' ' )
printf "C++ compiler path: %s\n" "$COMPILER"
$COMPILER --version
printf "C++ compilation options: %s\n" "$FLAGS"
- name: Build and test C++20 mode
if: ${{ contains( matrix.env.modes, 'cxx20' ) }}
run: |
cd .build
cmake --build . --target clean
cmake --build . --target cxx20
ctest -L cxx20 --output-on-failure
- name: Build and test C++23 mode
if: ${{ contains( matrix.env.modes, 'cxx23' ) }}
run: |
cd .build
cmake --build . --target clean
cmake --build . --target cxx23
ctest -L cxx23 --output-on-failure
# We want to build all for at least one arbitrary configuration
- name: Build and test all
if: ${{ matrix.env.compiler == 'gcc' && matrix.env.release == '14' }}
run: |
cd .build
cmake --build . --target clean
cmake --build .
ctest --output-on-failure
macos:
runs-on: macos-${{ matrix.env.osver }}
strategy:
fail-fast: false
matrix:
configuration:
- Debug
- Release
env:
- compiler: appleclang
osver: 15
modes: "cxx20 cxx23"
- compiler: clang
release: 18
osver: 15
modes: "cxx20 cxx23"
steps:
- uses: actions/checkout@v4
- name: Prepare build
run: |
mkdir .build
cd .build
if [[ "${{ matrix.env.compiler }}" == "appleclang" ]]; then
export CXX="$(which clang++)"
export CC="$(which clang)"
fi
if [[ "${{ matrix.env.compiler }}" == "clang" ]]; then
export CXX="$(brew --prefix llvm@${{ matrix.env.release }})/bin/clang++"
export CC="$(brew --prefix llvm@${{ matrix.env.release }})/bin/clang"
fi
cmake -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} ..
COMPILER=$( grep -iE "^CMAKE_CXX_COMPILER:FILEPATH=" CMakeCache.txt | sed -n 's/^[^=]*=//p' )
FLAGS=$( grep -iE "^CMAKE_CXX_FLAGS(_${{ matrix.configuration }})?:STRING" CMakeCache.txt | sed -n 's/^[^=]*=//p' | tr '\n' ' ' )
printf "C++ compiler path: %s\n" "$COMPILER"
$COMPILER --version
printf "C++ compilation options: %s\n" "$FLAGS"
- name: Build and test C++20 mode
if: ${{ contains( matrix.env.modes, 'cxx20' ) }}
run: |
cd .build
cmake --build . --target clean
cmake --build . --target cxx20
ctest -L cxx20 --output-on-failure
- name: Build and test C++23 mode
if: ${{ contains( matrix.env.modes, 'cxx23' ) }}
run: |
cd .build
cmake --build . --target clean
cmake --build . --target cxx23
ctest -L cxx23 --output-on-failure
windows:
runs-on: windows-${{ matrix.env.osver }}
strategy:
fail-fast: false
matrix:
configuration:
- Debug
- Release
env:
- compiler: "Visual Studio 17 2022"
osver: 2025
modes: "cxx20"
steps:
- uses: actions/checkout@v4
- name: Prepare build
run: |
mkdir .build
cd .build
cmake -G "${{ matrix.env.compiler }}" -A x64 ..
- name: Build and test C++20 mode
if: ${{ contains( matrix.env.modes, 'cxx20' ) }}
run: |
cd .build
cmake --build . --config ${{ matrix.configuration }} --target clean
cmake --build . --config ${{ matrix.configuration }} --target cxx20
ctest -L cxx20 -C ${{ matrix.configuration }} --output-on-failure
- name: Build and test C++23 mode
if: ${{ contains( matrix.env.modes, 'cxx23' ) }}
run: |
cd .build
cmake --build . --config ${{ matrix.configuration }} --target clean
cmake --build . --config ${{ matrix.configuration }} --target cxx23
ctest -L cxx23 -C ${{ matrix.configuration }} --output-on-failure
nixos:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
compiler:
- gcc
- clang
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v30
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Build and test
run: nix -L build '.#${{matrix.compiler}}'