-
Notifications
You must be signed in to change notification settings - Fork 1
268 lines (246 loc) · 9.26 KB
/
Copy pathci-cell.yml
File metadata and controls
268 lines (246 loc) · 9.26 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
name: CI cell
on:
workflow_call:
inputs:
cell-id:
required: true
type: string
os:
required: true
type: string
c-compiler:
required: true
type: string
cpp-compiler:
required: true
type: string
build-type:
required: false
type: string
default: Release
with-clasp:
required: false
type: boolean
default: true
with-cstring:
required: false
type: boolean
default: false
with-test-deps:
required: false
type: boolean
default: true
run-tests:
required: false
type: boolean
default: true
jobs:
cell:
name: ${{ inputs.cell-id }}
runs-on: ${{ inputs.os }}
steps:
- uses: actions/checkout@v4
- name: Install Clang (Ubuntu)
if: runner.os == 'Linux' && inputs.c-compiler == 'clang'
run: sudo apt-get update && sudo apt-get install -y clang
- name: Setup MSYS2 MinGW
if: runner.os == 'Windows' && inputs.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: Install dependencies
shell: bash
run: |
set -euxo pipefail
DEPS="${RUNNER_TEMP}/sis-deps"
mkdir -p "$DEPS"
echo "SIS_DEPS=$DEPS" >> "$GITHUB_ENV"
if [ "${{ inputs.c-compiler }}" = "mingw" ]; then
export PATH="/mingw64/bin:$PATH"
fi
cmake_configure() {
local src="$1" bld="$2"
shift 2
if [ "${{ inputs.c-compiler }}" = "cl" ]; then
cmake -S "$src" -B "$bld" \
-DCMAKE_DISABLE_FIND_PACKAGE_MFC=TRUE \
-DCMAKE_INSTALL_PREFIX="$DEPS" \
-DCMAKE_PREFIX_PATH="$DEPS" \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=OFF \
"$@"
elif [ "${{ inputs.c-compiler }}" = "mingw" ]; then
cmake -S "$src" -B "$bld" -G "MinGW Makefiles" \
-DCMAKE_BUILD_TYPE="${{ inputs.build-type }}" \
-DCMAKE_INSTALL_PREFIX="$DEPS" \
-DCMAKE_PREFIX_PATH="$DEPS" \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=OFF \
"$@"
else
cmake -S "$src" -B "$bld" \
-DCMAKE_BUILD_TYPE="${{ inputs.build-type }}" \
-DCMAKE_C_COMPILER="${{ inputs.c-compiler }}" \
-DCMAKE_CXX_COMPILER="${{ inputs.cpp-compiler }}" \
-DCMAKE_INSTALL_PREFIX="$DEPS" \
-DCMAKE_PREFIX_PATH="$DEPS" \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=OFF \
"$@"
fi
}
cmake_build_install() {
local bld="$1"
if [ "${{ inputs.c-compiler }}" = "cl" ]; then
cmake --build "$bld" --config "${{ inputs.build-type }}" --parallel
cmake --install "$bld" --config "${{ inputs.build-type }}"
elif [ "${{ inputs.c-compiler }}" = "mingw" ]; then
cmake --build "$bld" --parallel 2
cmake --install "$bld"
else
cmake --build "$bld" --parallel
cmake --install "$bld"
fi
}
# STLSoft (required)
STLSRC="${RUNNER_TEMP}/stlsoft-src"
STLBUILD="${RUNNER_TEMP}/stlsoft-build"
git clone --depth 1 https://github.com/synesissoftware/STLSoft "$STLSRC"
cmake_configure "$STLSRC" "$STLBUILD"
cmake_build_install "$STLBUILD"
# Catch2 v2 + xTests (test-only)
if [ "${{ inputs.with-test-deps }}" = "true" ]; then
CATCHSRC="${RUNNER_TEMP}/catch2-src"
CATCHBUILD="${RUNNER_TEMP}/catch2-build"
git clone --depth 1 --branch v2.x https://github.com/catchorg/Catch2 "$CATCHSRC"
cmake_configure "$CATCHSRC" "$CATCHBUILD" \
-DCATCH_BUILD_TESTING=OFF \
-DCATCH_ENABLE_WERROR=OFF \
-DCATCH_INSTALL_DOCS=OFF
cmake_build_install "$CATCHBUILD"
XTSRC="${RUNNER_TEMP}/xtests-src"
XTBUILD="${RUNNER_TEMP}/xtests-build"
git clone --depth 1 https://github.com/synesissoftware/xTests "$XTSRC"
cmake_configure "$XTSRC" "$XTBUILD" -DNO_SHWILD=TRUE
cmake_build_install "$XTBUILD"
fi
# CLASP
if [ "${{ inputs.with-clasp }}" = "true" ]; then
CLASPSRC="${RUNNER_TEMP}/clasp-src"
CLASPBUILD="${RUNNER_TEMP}/clasp-build"
git clone --depth 1 https://github.com/synesissoftware/CLASP "$CLASPSRC"
cmake_configure "$CLASPSRC" "$CLASPBUILD"
cmake_build_install "$CLASPBUILD"
fi
# cstring
if [ "${{ inputs.with-cstring }}" = "true" ]; then
CSTRSRC="${RUNNER_TEMP}/cstring-src"
CSTRBUILD="${RUNNER_TEMP}/cstring-build"
git clone --depth 1 https://github.com/synesissoftware/cstring "$CSTRSRC"
cmake_configure "$CSTRSRC" "$CSTRBUILD"
cmake_build_install "$CSTRBUILD"
fi
- name: Configure
shell: bash
run: |
set -euo pipefail
DEPS="${{ env.SIS_DEPS }}"
if [ "${{ inputs.c-compiler }}" = "mingw" ]; then
export PATH="/mingw64/bin:$PATH"
fi
# Bare `cstring` link (rstrip) needs include/lib search paths beyond
# find_package(CLASP)-style imported targets.
if [ "${{ inputs.with-cstring }}" = "true" ]; then
if [ "${{ inputs.c-compiler }}" = "cl" ]; then
export INCLUDE="$(cygpath -w "$DEPS/include");${INCLUDE:-}"
export LIB="$(cygpath -w "$DEPS/lib");${LIB:-}"
else
export CPATH="$DEPS/include${CPATH:+:$CPATH}"
export LIBRARY_PATH="$DEPS/lib${LIBRARY_PATH:+:$LIBRARY_PATH}"
fi
fi
if [ "${{ inputs.c-compiler }}" = "cl" ]; then
cmake -B build -S . \
-DCMAKE_DISABLE_FIND_PACKAGE_MFC=TRUE \
-DCMAKE_PREFIX_PATH="$DEPS" \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=ON
elif [ "${{ inputs.c-compiler }}" = "mingw" ]; then
cmake -B build -G "MinGW Makefiles" \
-DCMAKE_BUILD_TYPE="${{ inputs.build-type }}" \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_CXX_COMPILER=g++ \
-DCMAKE_PREFIX_PATH="$DEPS" \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=ON
else
cmake -B build -S . \
-DCMAKE_BUILD_TYPE="${{ inputs.build-type }}" \
-DCMAKE_C_COMPILER="${{ inputs.c-compiler }}" \
-DCMAKE_CXX_COMPILER="${{ inputs.cpp-compiler }}" \
-DCMAKE_PREFIX_PATH="$DEPS" \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=ON
fi
- name: Build
shell: bash
run: |
set -euo pipefail
if [ "${{ inputs.c-compiler }}" = "mingw" ]; then
export PATH="/mingw64/bin:$PATH"
fi
if [ "${{ inputs.with-cstring }}" = "true" ]; then
DEPS="${{ env.SIS_DEPS }}"
if [ "${{ inputs.c-compiler }}" = "cl" ]; then
export INCLUDE="$(cygpath -w "$DEPS/include");${INCLUDE:-}"
export LIB="$(cygpath -w "$DEPS/lib");${LIB:-}"
else
export CPATH="$DEPS/include${CPATH:+:$CPATH}"
export LIBRARY_PATH="$DEPS/lib${LIBRARY_PATH:+:$LIBRARY_PATH}"
fi
fi
if [ "${{ inputs.c-compiler }}" = "cl" ]; then
cmake --build build --config "${{ inputs.build-type }}" --parallel
elif [ "${{ inputs.c-compiler }}" = "mingw" ]; then
cmake --build build --parallel 2
else
cmake --build build --parallel
fi
- name: Run tests
if: inputs.run-tests
shell: bash
run: |
set -euo pipefail
if [ "${{ inputs.c-compiler }}" = "mingw" ]; then
export PATH="/mingw64/bin:$PATH"
fi
export SIS_CMAKE_BUILD_DIR="${{ github.workspace }}/build"
if [ "${{ runner.os }}" = "Windows" ]; then
cmd.exe //c "run_all_unit_tests.cmd -M -v"
else
./run_all_unit_tests.sh -M -v
fi
- name: Install and verify
shell: bash
run: |
set -euo pipefail
PREFIX="${RUNNER_TEMP}/install-prefix"
PROJECT="$(tr -d '[:space:]' < .sis/project_name.txt)"
if [ "${{ inputs.c-compiler }}" = "mingw" ]; then
export PATH="/mingw64/bin:$PATH"
fi
if [ "${{ inputs.c-compiler }}" = "cl" ]; then
cmake --install build --config "${{ inputs.build-type }}" --prefix "$PREFIX"
else
cmake --install build --prefix "$PREFIX"
fi
if [ "${{ inputs.c-compiler }}" = "cl" ] || [ "${{ inputs.c-compiler }}" = "mingw" ]; then
test -f "$PREFIX/bin/${PROJECT}.exe"
else
test -x "$PREFIX/bin/${PROJECT}"
fi