-
Notifications
You must be signed in to change notification settings - Fork 43
358 lines (319 loc) · 10.3 KB
/
cmake-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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
name: CI Matrix
on: [push, pull_request]
jobs:
Windows:
name: Windows ${{ matrix.runs.generator }} (${{ matrix.build-type }})
runs-on: ${{ matrix.runs.os }}
strategy:
fail-fast: false
matrix:
build-type: [Release, Debug]
runs: [
{generator: "Ninja", os: windows-latest},
{generator: "NMake Makefiles", os: windows-latest},
{generator: "Visual Studio 16 2019", os: windows-2019}]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Print env
run: |
echo github.event.action: ${{ github.event.action }}
echo github.event_name: ${{ github.event_name }}
- name: Setup Ninja
uses: abdes/gha-setup-ninja@master
with:
version: 1.11.0
- name: Setup cmake
uses: jwlawson/[email protected]
with:
cmake-version: 3.21.x
- name: Setup ccache
# If ccache behaves badly on windows, skip this step
# if: runner.os != 'Windows'
uses: Chocobo1/setup-ccache-action@v1
with:
install_ccache: true
update_packager_index: true
prepend_symlinks_to_path: true
windows_compile_environment: msvc # this field is required
- name: Set environment
uses: ilammy/msvc-dev-cmd@v1
- name: Configure
run: |
cmake `
-S . `
-B build `
-D CMAKE_BUILD_TYPE=${{ matrix.build-type }} `
-G "${{ matrix.runs.generator }}" `
-D USE_CCACHE=ON `
-D CMAKE_VERBOSE_MAKEFILE=ON
- name: Build
run: cmake --build build --config ${{ matrix.build-type }}
- name: Run cryptest
run: ctest --verbose -j40 -R cryptest --test-dir build -C ${{ matrix.build-type }}
- name: Run build tests
run: ctest -j40 -E cryptest --output-on-failure --test-dir build -C ${{ matrix.build-type }}
MacOS:
name: ${{ matrix.config.name }} ${{matrix.generator }} (${{ matrix.build-type }})
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
build-type: [Release, Debug]
generator: [Ninja, Xcode]
config:
- {
name: "MacOS",
omp: "OFF",
}
- {
name: "MacOS-omp-homebrew",
omp: "ON",
}
- {
name: "MacOS-omp-macports",
omp: "ON",
}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Print env
run: |
echo github.event.action: ${{ github.event.action }}
echo github.event_name: ${{ github.event_name }}
- name: Setup Ninja
uses: abdes/gha-setup-ninja@master
with:
version: 1.11.0
- name: Setup cmake
uses: jwlawson/[email protected]
with:
cmake-version: 3.21.x
- name: Setup ccache
uses: Chocobo1/setup-ccache-action@v1
with:
install_ccache: true
update_packager_index: true
prepend_symlinks_to_path: false
windows_compile_environment: msvc # this field is required
- name: Install macports
uses: melusina-org/setup-macports@v1
if: endsWith(matrix.config.name, 'macports')
- name: Install libomp (macports)
run: |
port install libomp
brew uninstall --ignore-dependencies --zap libomp
if: endsWith(matrix.config.name, 'macports')
- name: Setup XCode
uses: mobiledevops/xcode-select-version-action@v1
with:
xcode-select-version: 13.1
if: matrix.generator == 'Xcode'
- name: Configure
run: |
cmake \
-S . \
-B build \
-G ${{ matrix.generator }} \
-D USE_CCACHE=ON \
-D CMAKE_VERBOSE_MAKEFILE=ON \
-D USE_OPENMP=${{ matrix.config.omp }} \
-D CMAKE_BUILD_TYPE=${{ matrix.build-type }}
- name: Build
run: |
NINJA_STATUS="[%f/%t %o/sec] " export NINJA_STATUS
cmake --build build --config ${{ matrix.build-type }}
- name: Run cryptest
run: ctest -j40 --verbose -R "cryptest" --test-dir build -C ${{ matrix.build-type }}
- name: Run build tests
run: ctest -j40 -E "cryptest" --output-on-failure --test-dir build -C ${{ matrix.build-type }}
Ubuntu:
name: ${{ matrix.config.name }} (${{ matrix.build-type }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
build-type: [Release, Debug]
config:
- {
name: "ubuntu",
cc: "gcc-10",
cxx: "g++-10",
generators: "Ninja",
}
- {
name: "ubuntu-gcc12",
cc: "gcc-12",
cxx: "g++-12",
generators: "Ninja",
}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Print env
run: |
echo github.event.action: ${{ github.event.action }}
echo github.event_name: ${{ github.event_name }}
- name: Setup Ninja
uses: abdes/gha-setup-ninja@master
with:
version: 1.11.0
- name: Setup cmake
uses: jwlawson/[email protected]
with:
cmake-version: 3.21.x
- name: Install ccache
shell: cmake -P {0}
run: |
set(ccache_version "4.6.3")
set(ccache_dist "ccache-${ccache_version}-linux-x86_64")
set(ccache_url "https://github.com/ccache/ccache/releases/download/v${ccache_version}/${ccache_dist}.tar.xz")
file(DOWNLOAD "${ccache_url}" ./ccache.tar.xz SHOW_PROGRESS)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar zxvf ./ccache.tar.xz)
# Add to PATH environment variable
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/${ccache_dist}" ccache_dir)
set(path_separator ":")
file(APPEND "$ENV{GITHUB_PATH}" "$ENV{GITHUB_WORKSPACE}${path_separator}${ccache_dir}")
- name: Setup ccache
uses: Chocobo1/setup-ccache-action@v1
with:
install_ccache: false
update_packager_index: false
prepend_symlinks_to_path: false
windows_compile_environment: msvc # this field is required
- name: Configure
run: |
export CC=${{ matrix.config.cc }}
export CXX=${{ matrix.config.cxx }}
export PATH=${GITHUB_WORKSPACE}:${PATH}
cmake \
-S . \
-B build \
-D CMAKE_BUILD_TYPE=$ENV{BUILD_TYPE} \
-G Ninja \
-D CMAKE_MAKE_PROGRAM=ninja \
-D USE_CCACHE=ON \
-D CMAKE_VERBOSE_MAKEFILE=ON \
-D CMAKE_BUILD_TYPE=${{ matrix.build-type }}
- name: Build
run: |
export NINJA_STATUS="[%f/%t %o/sec] "
cmake --build build --target all --config ${{ matrix.build-type }}
- name: Run cryptest
run: ctest -j40 --verbose -R cryptest --test-dir build -C ${{ matrix.build-type }}
- name: Run build tests
run: |
export CC=${{ matrix.config.cc }}
export CXX=${{ matrix.config.cxx }}
ctest -j40 -E cryptest --output-on-failure --test-dir build -C ${{ matrix.build-type }}
MSys:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
build-type: [Release, Debug]
sys: [mingw32, mingw64, ucrt64, clang64]
config:
- {
name: "with OMP ",
omp: ON,
}
- {
name: "",
omp: "OFF",
}
exclude:
- sys: mingw32
build-type: Debug
name: MSys - ${{ matrix.sys }} ${{ matrix.config.name }}(${{ matrix.build-type }})
defaults:
run:
shell: msys2 {0}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.sys }}
update: true
install: >-
git
make
pacboy: >-
toolchain:p
cmake:p
- name: Setup ccache
uses: Chocobo1/setup-ccache-action@v1
with:
prepend_symlinks_to_path: false
windows_compile_environment: msys2
- name: Configure
run: |
cmake -G"Unix Makefiles" \
-S . \
-B build \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DUSE_OPENMP=${{ matrix.config.omp }} \
-D USE_CCACHE=ON
- name: Build
run: cmake --build build --config ${{ matrix.build-type }}
- name: Run cryptest
run: ctest -j40 --verbose -R cryptest --test-dir build -C ${{ matrix.build-type }}
- name: Run tests
run: ctest -j40 -E cryptest --output-on-failure --test-dir build -C ${{ matrix.build-type }}
cygwin:
strategy:
fail-fast: false
matrix:
build-type: [Release]
config:
- {
name: "with OMP ",
omp: ON,
}
- {
name: "",
omp: "OFF",
}
runs-on: windows-latest
defaults:
run:
shell: C:\cygwin\bin\bash.exe --login -o igncr '{0}'
name: Cygwin ${{ matrix.config.name }}(${{ matrix.build-type }})
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup cygwin
uses: cygwin/cygwin-install-action@master
with:
packages: >-
ccache
cmake
gcc-core
gcc-g++
ninja
- name: Configure
run: |
cmake /cygdrive/d/a/cryptopp-cmake/cryptopp-cmake \
-B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-G Ninja \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DUSE_OPENMP=${{ matrix.config.omp }} \
-D USE_CCACHE=ON
- name: Build
run: cmake --build build --config ${{ matrix.build-type }}
- name: Run cryptest
run: ctest -j40 --verbose -R cryptest --test-dir build -C ${{ matrix.build-type }}
- name: Run tests
run: ctest -j40 -E cryptest --output-on-failure --test-dir build -C ${{ matrix.build-type }}