-
Notifications
You must be signed in to change notification settings - Fork 2
269 lines (245 loc) · 8.68 KB
/
Copy pathci.yml
File metadata and controls
269 lines (245 loc) · 8.68 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
name: CI
on:
push:
branches:
- master
- dev
- boilerplate
- rc1
- rc2
- rc3
- rc4
- rc5
- update
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
- id: windows-mingw
os: windows-latest
c_compiler: mingw
cpp_compiler: g++
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
secrets: inherit
install-smoke:
name: Install smoke (${{ matrix.os }}, ${{ 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: mingw
cpp_compiler: g++
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.c_compiler == '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: 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.c_compiler }}" = "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.c_compiler }}" = "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.c_compiler }}" = "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 dependencies (STLSoft + shwild + xTests)
shell: bash
run: |
set -euo pipefail
DEPS="${RUNNER_TEMP}/sis-deps"
STLSRC="${RUNNER_TEMP}/stlsoft-src"
STLBUILD="${RUNNER_TEMP}/stlsoft-build"
SHWSRC="${RUNNER_TEMP}/shwild-src"
SHWBUILD="${RUNNER_TEMP}/shwild-build"
XTSRC="${RUNNER_TEMP}/xtests-src"
XTBUILD="${RUNNER_TEMP}/xtests-build"
mkdir -p "$DEPS"
git clone --depth 1 https://github.com/synesissoftware/STLSoft "$STLSRC"
cmake -S "$STLSRC" -B "$STLBUILD" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$DEPS" \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=OFF
cmake --build "$STLBUILD" --parallel
cmake --install "$STLBUILD"
git clone --depth 1 https://github.com/synesissoftware/shwild "$SHWSRC"
cmake -S "$SHWSRC" -B "$SHWBUILD" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$DEPS" \
-DCMAKE_PREFIX_PATH="$DEPS" \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=OFF
cmake --build "$SHWBUILD" --parallel
cmake --install "$SHWBUILD"
git clone --depth 1 https://github.com/synesissoftware/xTests "$XTSRC"
cmake -S "$XTSRC" -B "$XTBUILD" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$DEPS" \
-DCMAKE_PREFIX_PATH="$DEPS" \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=OFF
cmake --build "$XTBUILD" --parallel
cmake --install "$XTBUILD"
echo "SIS_DEPS=$DEPS" >> "$GITHUB_ENV"
- name: Configure and build 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 -m
- name: Run unit tests
shell: bash
run: |
set -euo pipefail
SIS_CMAKE_BUILD_DIR="${{ github.workspace }}/_build" ./run_all_unit_tests.sh -M --unit-only