Repository navigation
340 lines (312 loc) · 10.9 KB
/
Copy pathci.yml
File metadata and controls
340 lines (312 loc) · 10.9 KB
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
name: CI
on:
push:
branches:
- master
- dev
- boilerplate
- idiomatic
- rc1
- rc2
- rc3
- hash-review
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
BUILD_TYPE: Release
jobs:
cell:
name: CI (${{ matrix.id }})
strategy:
fail-fast: false
matrix:
include:
- id: linux-clang
os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++
- id: linux-gcc
os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
- id: macos-clang
os: macos-latest
c_compiler: clang
cpp_compiler: clang++
- id: macos-gcc
os: macos-latest
c_compiler: gcc
cpp_compiler: g++
- id: windows-cl
os: windows-latest
c_compiler: cl
cpp_compiler: cl
# `toolchain` carries what is not a compiler: MinGW needs its own
# generator and PATH, but the compilers it drives are gcc and g++
- id: windows-mingw
os: windows-latest
c_compiler: gcc
cpp_compiler: g++
toolchain: mingw
uses: ./.github/workflows/ci-cell.yml
with:
cell-id: ${{ matrix.id }}
os: ${{ matrix.os }}
c-compiler: ${{ matrix.c_compiler }}
cpp-compiler: ${{ matrix.cpp_compiler }}
build-type: Release
toolchain: ${{ matrix.toolchain }}
secrets: inherit
# Same Windows cells as above, configured with --wide-strings. Performance
# steps are skipped in the cell when that input is set.
cell-wide:
name: CI (${{ matrix.id }})
strategy:
fail-fast: false
matrix:
include:
- id: windows-cl-wide
os: windows-latest
c_compiler: cl
cpp_compiler: cl
- id: windows-mingw-wide
os: windows-latest
c_compiler: gcc
cpp_compiler: g++
toolchain: mingw
uses: ./.github/workflows/ci-cell.yml
with:
build-type: Release
c-compiler: ${{ matrix.c_compiler }}
cell-id: ${{ matrix.id }}
cpp-compiler: ${{ matrix.cpp_compiler }}
os: ${{ matrix.os }}
toolchain: ${{ matrix.toolchain }}
wide-strings: true
secrets: inherit
install-smoke:
name: Install smoke (${{ matrix.os }}, ${{ matrix.toolchain || matrix.c_compiler }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
- os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++
- os: macos-latest
c_compiler: clang
cpp_compiler: clang++
- os: windows-latest
c_compiler: cl
cpp_compiler: cl
- os: windows-latest
c_compiler: gcc
cpp_compiler: g++
toolchain: mingw
steps:
- uses: actions/checkout@v4
- name: Install Clang (Ubuntu)
if: runner.os == 'Linux' && matrix.c_compiler == 'clang'
run: sudo apt-get update && sudo apt-get install -y clang
- name: Setup MSYS2 MinGW
if: runner.os == 'Windows' && matrix.toolchain == 'mingw'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-cmake
mingw-w64-x86_64-make
- name: Helper scripts prepare-clean-build-remove-reprepare-build
shell: bash
run: |
set -euo pipefail
# Exercise prepare/clean/build/remove helpers on a dedicated tree
# (does not replace the install-smoke configure/build below).
export SIS_CMAKE_BUILD_DIR="${{ github.workspace }}/_build-helper-smoke"
PREPARE_ARGS=(-E -T)
if [ "${{ matrix.toolchain }}" = "mingw" ]; then
export PATH="/mingw64/bin:$PATH"
PREPARE_ARGS+=(--mingw)
elif [ "${{ matrix.c_compiler }}" != "cl" ]; then
export CC="${{ matrix.c_compiler }}"
export CXX="${{ matrix.cpp_compiler }}"
fi
./prepare_cmake.sh "${PREPARE_ARGS[@]}"
./clean_cmake.sh
./build_cmake.sh
./clean_cmake.sh
./build_cmake.sh
./remove_cmake_artefacts.sh
./prepare_cmake.sh "${PREPARE_ARGS[@]}"
./build_cmake.sh
- name: Configure
shell: bash
run: |
set -euo pipefail
if [ "${{ matrix.c_compiler }}" = "cl" ]; then
cmake -B build -S . \
-DCMAKE_DISABLE_FIND_PACKAGE_MFC=TRUE \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=OFF
elif [ "${{ matrix.toolchain }}" = "mingw" ]; then
export PATH="/mingw64/bin:$PATH"
cmake -B build -G "MinGW Makefiles" \
-DCMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_CXX_COMPILER=g++ \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=OFF
else
cmake -B build -S . \
-DCMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" \
-DCMAKE_C_COMPILER="${{ matrix.c_compiler }}" \
-DCMAKE_CXX_COMPILER="${{ matrix.cpp_compiler }}" \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=OFF
fi
- name: Build
shell: bash
run: |
set -euo pipefail
if [ "${{ matrix.c_compiler }}" = "cl" ]; then
cmake --build build --config "${{ env.BUILD_TYPE }}" --parallel
elif [ "${{ matrix.toolchain }}" = "mingw" ]; then
export PATH="/mingw64/bin:$PATH"
cmake --build build --parallel 2
else
cmake --build build --parallel
fi
- name: Install
shell: bash
run: |
set -euo pipefail
PREFIX="${RUNNER_TEMP}/install-prefix"
echo "INSTALL_PREFIX=$PREFIX" >> "$GITHUB_ENV"
if [ "${{ matrix.c_compiler }}" = "cl" ]; then
cmake --install build --config "${{ env.BUILD_TYPE }}" --prefix "$PREFIX"
else
cmake --install build --prefix "$PREFIX"
fi
- name: Verify install tree
shell: bash
run: |
set -euo pipefail
test -f "${INSTALL_PREFIX}/include/cstring/cstring.h"
test -f "${INSTALL_PREFIX}/lib/cmake/cstring/cstring-config.cmake"
- name: Configure and run install smoke consumer
shell: bash
run: |
set -euo pipefail
CONSUMER="${RUNNER_TEMP}/consumer"
mkdir -p "$CONSUMER"
cat > "$CONSUMER/CMakeLists.txt" <<'EOF'
cmake_minimum_required(VERSION 3.13)
project(cstring_install_smoke C)
find_package(cstring REQUIRED)
add_executable(consumer consumer.c)
target_link_libraries(consumer PRIVATE cstring::core)
EOF
cat > "$CONSUMER/consumer.c" <<'EOF'
#include <cstring/cstring.h>
int main(void) { return 0; }
EOF
if [ "${{ matrix.c_compiler }}" = "cl" ]; then
cmake -S "$CONSUMER" -B consumer-build \
-DCMAKE_PREFIX_PATH="${INSTALL_PREFIX};${{ env.SIS_DEPS }}"
cmake --build consumer-build --config "${{ env.BUILD_TYPE }}" --parallel
consumer-build/${{ env.BUILD_TYPE }}/consumer.exe
elif [ "${{ matrix.toolchain }}" = "mingw" ]; then
export PATH="/mingw64/bin:$PATH"
cmake -S "$CONSUMER" -B consumer-build -G "MinGW Makefiles" \
-DCMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" \
-DCMAKE_PREFIX_PATH="${INSTALL_PREFIX}"
cmake --build consumer-build --parallel 2
consumer-build/consumer.exe
else
cmake -S "$CONSUMER" -B consumer-build \
-DCMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" \
-DCMAKE_C_COMPILER="${{ matrix.c_compiler }}" \
-DCMAKE_CXX_COMPILER="${{ matrix.cpp_compiler }}" \
-DCMAKE_PREFIX_PATH="${INSTALL_PREFIX}"
cmake --build consumer-build --parallel
consumer-build/consumer
fi
no-cpp:
name: Build with --no-cpp
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install test dependencies (STLSoft + shwild + xTests)
uses: ./.github/actions/install-sis-deps
with:
build-type: ${{ env.BUILD_TYPE }}
c-compiler: gcc
cpp-compiler: g++
dependencies: STLSoft shwild xTests
- name: Configure via prepare_cmake.sh --no-cpp
shell: bash
run: |
set -euo pipefail
# Prefer CMAKE_PREFIX_PATH (find_package) over prepare_cmake -s /
# -DSTLSOFT: xTests::core links STLSoft::STLSoft, which only
# exists when the STLSoft CMake package is imported.
export CMAKE_PREFIX_PATH="${{ env.SIS_DEPS }}"
./prepare_cmake.sh --no-cpp
- name: Build via build_cmake.sh
shell: bash
run: |
set -euo pipefail
export CMAKE_PREFIX_PATH="${{ env.SIS_DEPS }}"
./build_cmake.sh
- name: Run automated tests
shell: bash
run: |
set -euo pipefail
SIS_CMAKE_BUILD_DIR="${{ github.workspace }}/_build" ./run_all_automated_tests.sh -M
wide-strings:
name: Build with --wide-strings
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install test dependencies (STLSoft + shwild + xTests)
uses: ./.github/actions/install-sis-deps
with:
build-type: ${{ env.BUILD_TYPE }}
c-compiler: gcc
cpp-compiler: g++
dependencies: STLSoft shwild xTests
- name: Configure via prepare_cmake.sh --wide-strings
shell: bash
run: |
set -euo pipefail
# Same prefix rule as the --no-cpp job: xTests::core links
# STLSoft::STLSoft, which exists only when that package is
# imported. --wide-strings defines CSTRING_USE_WIDE_STRINGS.
export CMAKE_PREFIX_PATH="${{ env.SIS_DEPS }}"
./prepare_cmake.sh --wide-strings
- name: Build via build_cmake.sh
shell: bash
run: |
set -euo pipefail
export CMAKE_PREFIX_PATH="${{ env.SIS_DEPS }}"
./build_cmake.sh
- name: Run automated tests
shell: bash
run: |
set -euo pipefail
SIS_CMAKE_BUILD_DIR="${{ github.workspace }}/_build" ./run_all_automated_tests.sh -M
- name: Run examples
shell: bash
run: |
set -euo pipefail
SIS_EXAMPLE_SMOKE=1 \
SIS_CMAKE_BUILD_DIR="${{ github.workspace }}/_build" \
./run_all_examples.sh -M