Skip to content

Commit fbf600d

Browse files
feature: added GitHub Actions CI
1 parent a027445 commit fbf600d

3 files changed

Lines changed: 620 additions & 6 deletions

File tree

.github/workflows/ci-cell.yml

Lines changed: 332 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,332 @@
1+
name: CI cell
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
cell-id:
7+
required: true
8+
type: string
9+
os:
10+
required: true
11+
type: string
12+
c-compiler:
13+
required: true
14+
type: string
15+
cpp-compiler:
16+
required: true
17+
type: string
18+
build-type:
19+
required: false
20+
type: string
21+
default: Release
22+
23+
jobs:
24+
build:
25+
name: Build (${{ inputs.cell-id }})
26+
runs-on: ${{ inputs.os }}
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- name: Install Clang (Ubuntu)
32+
if: runner.os == 'Linux' && inputs.c-compiler == 'clang'
33+
run: sudo apt-get update && sudo apt-get install -y clang
34+
35+
- name: Setup MSYS2 MinGW
36+
if: runner.os == 'Windows' && inputs.c-compiler == 'mingw'
37+
uses: msys2/setup-msys2@v2
38+
with:
39+
msystem: MINGW64
40+
update: true
41+
install: >-
42+
mingw-w64-x86_64-toolchain
43+
mingw-w64-x86_64-cmake
44+
mingw-w64-x86_64-make
45+
46+
- name: Install test dependencies (STLSoft + shwild + xTests)
47+
shell: bash
48+
run: |
49+
set -euxo pipefail
50+
51+
DEPS="${RUNNER_TEMP}/sis-deps"
52+
STLSRC="${RUNNER_TEMP}/stlsoft-src"
53+
STLBUILD="${RUNNER_TEMP}/stlsoft-build"
54+
SHWSRC="${RUNNER_TEMP}/shwild-src"
55+
SHWBUILD="${RUNNER_TEMP}/shwild-build"
56+
XTSRC="${RUNNER_TEMP}/xtests-src"
57+
XTBUILD="${RUNNER_TEMP}/xtests-build"
58+
59+
mkdir -p "$DEPS"
60+
61+
# 1. STLSoft
62+
git clone --depth 1 https://github.com/synesissoftware/STLSoft "$STLSRC"
63+
if [ "${{ inputs.c-compiler }}" = "cl" ]; then
64+
cmake -S "$STLSRC" -B "$STLBUILD" \
65+
-DCMAKE_DISABLE_FIND_PACKAGE_MFC=TRUE \
66+
-DCMAKE_INSTALL_PREFIX="$DEPS" \
67+
-DBUILD_EXAMPLES=OFF \
68+
-DBUILD_TESTING=OFF
69+
cmake --build "$STLBUILD" --config "${{ inputs.build-type }}" --parallel
70+
cmake --install "$STLBUILD" --config "${{ inputs.build-type }}"
71+
elif [ "${{ inputs.c-compiler }}" = "mingw" ]; then
72+
export PATH="/mingw64/bin:$PATH"
73+
cmake -S "$STLSRC" -B "$STLBUILD" -G "MinGW Makefiles" \
74+
-DCMAKE_BUILD_TYPE="${{ inputs.build-type }}" \
75+
-DCMAKE_INSTALL_PREFIX="$DEPS" \
76+
-DBUILD_EXAMPLES=OFF \
77+
-DBUILD_TESTING=OFF
78+
cmake --build "$STLBUILD" --parallel 2
79+
cmake --install "$STLBUILD"
80+
else
81+
cmake -S "$STLSRC" -B "$STLBUILD" \
82+
-DCMAKE_BUILD_TYPE="${{ inputs.build-type }}" \
83+
-DCMAKE_C_COMPILER="${{ inputs.c-compiler }}" \
84+
-DCMAKE_CXX_COMPILER="${{ inputs.cpp-compiler }}" \
85+
-DCMAKE_INSTALL_PREFIX="$DEPS" \
86+
-DBUILD_EXAMPLES=OFF \
87+
-DBUILD_TESTING=OFF
88+
cmake --build "$STLBUILD" --parallel
89+
cmake --install "$STLBUILD"
90+
fi
91+
92+
# 2. shwild
93+
git clone --depth 1 https://github.com/synesissoftware/shwild "$SHWSRC"
94+
if [ "${{ inputs.c-compiler }}" = "cl" ]; then
95+
cmake -S "$SHWSRC" -B "$SHWBUILD" \
96+
-DCMAKE_DISABLE_FIND_PACKAGE_MFC=TRUE \
97+
-DCMAKE_INSTALL_PREFIX="$DEPS" \
98+
-DCMAKE_PREFIX_PATH="$DEPS" \
99+
-DBUILD_EXAMPLES=OFF \
100+
-DBUILD_TESTING=OFF
101+
cmake --build "$SHWBUILD" --config "${{ inputs.build-type }}" --parallel
102+
cmake --install "$SHWBUILD" --config "${{ inputs.build-type }}"
103+
elif [ "${{ inputs.c-compiler }}" = "mingw" ]; then
104+
export PATH="/mingw64/bin:$PATH"
105+
cmake -S "$SHWSRC" -B "$SHWBUILD" -G "MinGW Makefiles" \
106+
-DCMAKE_BUILD_TYPE="${{ inputs.build-type }}" \
107+
-DCMAKE_INSTALL_PREFIX="$DEPS" \
108+
-DCMAKE_PREFIX_PATH="$DEPS" \
109+
-DBUILD_EXAMPLES=OFF \
110+
-DBUILD_TESTING=OFF
111+
cmake --build "$SHWBUILD" --parallel 2
112+
cmake --install "$SHWBUILD"
113+
else
114+
cmake -S "$SHWSRC" -B "$SHWBUILD" \
115+
-DCMAKE_BUILD_TYPE="${{ inputs.build-type }}" \
116+
-DCMAKE_C_COMPILER="${{ inputs.c-compiler }}" \
117+
-DCMAKE_CXX_COMPILER="${{ inputs.cpp-compiler }}" \
118+
-DCMAKE_INSTALL_PREFIX="$DEPS" \
119+
-DCMAKE_PREFIX_PATH="$DEPS" \
120+
-DBUILD_EXAMPLES=OFF \
121+
-DBUILD_TESTING=OFF
122+
cmake --build "$SHWBUILD" --parallel
123+
cmake --install "$SHWBUILD"
124+
fi
125+
126+
# 3. xTests
127+
git clone --depth 1 https://github.com/synesissoftware/xTests "$XTSRC"
128+
if [ "${{ inputs.c-compiler }}" = "cl" ]; then
129+
cmake -S "$XTSRC" -B "$XTBUILD" \
130+
-DCMAKE_DISABLE_FIND_PACKAGE_MFC=TRUE \
131+
-DCMAKE_INSTALL_PREFIX="$DEPS" \
132+
-DCMAKE_PREFIX_PATH="$DEPS" \
133+
-DBUILD_EXAMPLES=OFF \
134+
-DBUILD_TESTING=OFF
135+
cmake --build "$XTBUILD" --config "${{ inputs.build-type }}" --parallel
136+
cmake --install "$XTBUILD" --config "${{ inputs.build-type }}"
137+
elif [ "${{ inputs.c-compiler }}" = "mingw" ]; then
138+
export PATH="/mingw64/bin:$PATH"
139+
cmake -S "$XTSRC" -B "$XTBUILD" -G "MinGW Makefiles" \
140+
-DCMAKE_BUILD_TYPE="${{ inputs.build-type }}" \
141+
-DCMAKE_INSTALL_PREFIX="$DEPS" \
142+
-DCMAKE_PREFIX_PATH="$DEPS" \
143+
-DBUILD_EXAMPLES=OFF \
144+
-DBUILD_TESTING=OFF
145+
cmake --build "$XTBUILD" --parallel 2
146+
cmake --install "$XTBUILD"
147+
else
148+
cmake -S "$XTSRC" -B "$XTBUILD" \
149+
-DCMAKE_BUILD_TYPE="${{ inputs.build-type }}" \
150+
-DCMAKE_C_COMPILER="${{ inputs.c-compiler }}" \
151+
-DCMAKE_CXX_COMPILER="${{ inputs.cpp-compiler }}" \
152+
-DCMAKE_INSTALL_PREFIX="$DEPS" \
153+
-DCMAKE_PREFIX_PATH="$DEPS" \
154+
-DBUILD_EXAMPLES=OFF \
155+
-DBUILD_TESTING=OFF
156+
cmake --build "$XTBUILD" --parallel
157+
cmake --install "$XTBUILD"
158+
fi
159+
160+
- name: Configure
161+
shell: bash
162+
run: |
163+
set -euo pipefail
164+
if [ "${{ inputs.c-compiler }}" = "cl" ]; then
165+
cmake -B build -S . \
166+
-DCMAKE_DISABLE_FIND_PACKAGE_MFC=TRUE \
167+
-DCMAKE_PREFIX_PATH="${RUNNER_TEMP}/sis-deps" \
168+
-DBUILD_EXAMPLES=ON \
169+
-DBUILD_TESTING=ON
170+
elif [ "${{ inputs.c-compiler }}" = "mingw" ]; then
171+
export PATH="/mingw64/bin:$PATH"
172+
cmake -B build -G "MinGW Makefiles" \
173+
-DCMAKE_BUILD_TYPE="${{ inputs.build-type }}" \
174+
-DCMAKE_C_COMPILER=gcc \
175+
-DCMAKE_CXX_COMPILER=g++ \
176+
-DCMAKE_PREFIX_PATH="${RUNNER_TEMP}/sis-deps" \
177+
-DBUILD_EXAMPLES=ON \
178+
-DBUILD_TESTING=ON
179+
else
180+
cmake -B build -S . \
181+
-DCMAKE_BUILD_TYPE="${{ inputs.build-type }}" \
182+
-DCMAKE_C_COMPILER="${{ inputs.c-compiler }}" \
183+
-DCMAKE_CXX_COMPILER="${{ inputs.cpp-compiler }}" \
184+
-DCMAKE_PREFIX_PATH="${RUNNER_TEMP}/sis-deps" \
185+
-DBUILD_EXAMPLES=ON \
186+
-DBUILD_TESTING=ON
187+
fi
188+
189+
- name: Build
190+
shell: bash
191+
run: |
192+
set -euo pipefail
193+
if [ "${{ inputs.c-compiler }}" = "cl" ]; then
194+
cmake --build build --config "${{ inputs.build-type }}" --parallel
195+
elif [ "${{ inputs.c-compiler }}" = "mingw" ]; then
196+
export PATH="/mingw64/bin:$PATH"
197+
cmake --build build --parallel 2
198+
else
199+
cmake --build build --parallel
200+
fi
201+
202+
- name: Upload build tree
203+
uses: actions/upload-artifact@v4
204+
with:
205+
name: sis-build-${{ inputs.cell-id }}
206+
path: build
207+
retention-days: 1
208+
209+
run-examples:
210+
name: Examples (${{ inputs.cell-id }})
211+
needs: build
212+
runs-on: ${{ inputs.os }}
213+
214+
steps:
215+
- uses: actions/checkout@v4
216+
217+
- name: Setup MSYS2 MinGW
218+
if: runner.os == 'Windows' && inputs.c-compiler == 'mingw'
219+
uses: msys2/setup-msys2@v2
220+
with:
221+
msystem: MINGW64
222+
update: true
223+
install: mingw-w64-x86_64-toolchain
224+
225+
- name: Download build tree
226+
uses: actions/download-artifact@v4
227+
with:
228+
name: sis-build-${{ inputs.cell-id }}
229+
path: build
230+
231+
- name: Run examples
232+
shell: bash
233+
run: |
234+
set -euo pipefail
235+
if [ "${{ inputs.c-compiler }}" = "mingw" ]; then
236+
export PATH="/mingw64/bin:$PATH"
237+
fi
238+
SIS_CMAKE_BUILD_DIR="${{ github.workspace }}/build" ./run_all_examples.sh -M
239+
240+
test-unit:
241+
name: Unit tests (${{ inputs.cell-id }})
242+
needs: build
243+
runs-on: ${{ inputs.os }}
244+
245+
steps:
246+
- uses: actions/checkout@v4
247+
248+
- name: Setup MSYS2 MinGW
249+
if: runner.os == 'Windows' && inputs.c-compiler == 'mingw'
250+
uses: msys2/setup-msys2@v2
251+
with:
252+
msystem: MINGW64
253+
update: true
254+
install: mingw-w64-x86_64-toolchain
255+
256+
- name: Download build tree
257+
uses: actions/download-artifact@v4
258+
with:
259+
name: sis-build-${{ inputs.cell-id }}
260+
path: build
261+
262+
- name: Run unit tests
263+
shell: bash
264+
run: |
265+
set -euo pipefail
266+
if [ "${{ inputs.c-compiler }}" = "mingw" ]; then
267+
export PATH="/mingw64/bin:$PATH"
268+
fi
269+
SIS_CMAKE_BUILD_DIR="${{ github.workspace }}/build" ./run_all_unit_tests.sh -M --unit-only
270+
271+
test-component:
272+
name: Component tests (${{ inputs.cell-id }})
273+
needs: build
274+
runs-on: ${{ inputs.os }}
275+
276+
steps:
277+
- uses: actions/checkout@v4
278+
279+
- name: Setup MSYS2 MinGW
280+
if: runner.os == 'Windows' && inputs.c-compiler == 'mingw'
281+
uses: msys2/setup-msys2@v2
282+
with:
283+
msystem: MINGW64
284+
update: true
285+
install: mingw-w64-x86_64-toolchain
286+
287+
- name: Download build tree
288+
uses: actions/download-artifact@v4
289+
with:
290+
name: sis-build-${{ inputs.cell-id }}
291+
path: build
292+
293+
- name: Run component tests
294+
shell: bash
295+
run: |
296+
set -euo pipefail
297+
if [ "${{ inputs.c-compiler }}" = "mingw" ]; then
298+
export PATH="/mingw64/bin:$PATH"
299+
fi
300+
SIS_CMAKE_BUILD_DIR="${{ github.workspace }}/build" ./run_all_unit_tests.sh -M --component-only
301+
302+
test-scratch:
303+
name: Scratch tests (${{ inputs.cell-id }})
304+
needs: build
305+
continue-on-error: true
306+
runs-on: ${{ inputs.os }}
307+
308+
steps:
309+
- uses: actions/checkout@v4
310+
311+
- name: Setup MSYS2 MinGW
312+
if: runner.os == 'Windows' && inputs.c-compiler == 'mingw'
313+
uses: msys2/setup-msys2@v2
314+
with:
315+
msystem: MINGW64
316+
update: true
317+
install: mingw-w64-x86_64-toolchain
318+
319+
- name: Download build tree
320+
uses: actions/download-artifact@v4
321+
with:
322+
name: sis-build-${{ inputs.cell-id }}
323+
path: build
324+
325+
- name: Run scratch tests
326+
shell: bash
327+
run: |
328+
set -euo pipefail
329+
if [ "${{ inputs.c-compiler }}" = "mingw" ]; then
330+
export PATH="/mingw64/bin:$PATH"
331+
fi
332+
SIS_CMAKE_BUILD_DIR="${{ github.workspace }}/build" ./run_all_scratch_tests.sh -M

0 commit comments

Comments
 (0)