-
Notifications
You must be signed in to change notification settings - Fork 3
242 lines (206 loc) · 8.4 KB
/
test.yml
File metadata and controls
242 lines (206 loc) · 8.4 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
# SPDX-License-Identifier: MIT
# Copyright (c) 2020-2026 Sam Urmian, Mateus de Oliveira Oliveira, and contributors.
name: TreeWidzard CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
jobs:
build-and-test:
name: Build and Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y bison flex cmake build-essential
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install bison flex cmake
- name: Install dependencies (Windows)
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: false
install: >-
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-cmake
mingw-w64-x86_64-ninja
- name: Configure CMake (Unix)
if: runner.os != 'Windows'
run: cmake -S . -B out/build/ci -DCMAKE_BUILD_TYPE=Release
- name: Configure CMake (Windows)
if: runner.os == 'Windows'
shell: msys2 {0}
run: cmake -S . -B out/build/ci -G Ninja -DCMAKE_BUILD_TYPE=Release
- name: Build TreeWidzard (Unix)
if: runner.os != 'Windows'
run: cmake --build out/build/ci -j $(nproc 2>/dev/null || sysctl -n hw.ncpu)
- name: Build TreeWidzard (Windows)
if: runner.os == 'Windows'
shell: msys2 {0}
run: cmake --build out/build/ci -j "$(nproc)"
- name: Run CTest (Unix)
if: runner.os != 'Windows'
run: |
ctest --test-dir out/build/ci --output-on-failure \
-j "$(nproc 2>/dev/null || sysctl -n hw.ncpu)" \
--output-junit ctest_results.xml
- name: Run CTest (Windows)
if: runner.os == 'Windows'
shell: msys2 {0}
run: |
ctest --test-dir out/build/ci --output-on-failure \
-j "$(nproc)" \
--output-junit ctest_results.xml
- name: Configure shared install smoke build (Unix)
if: runner.os != 'Windows'
run: cmake -S . -B out/build/install -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBUILD_TESTS=OFF
- name: Configure shared install smoke build (Windows)
if: runner.os == 'Windows'
shell: msys2 {0}
run: cmake -S . -B out/build/install -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBUILD_TESTS=OFF
- name: Build shared install smoke tree (Unix)
if: runner.os != 'Windows'
run: cmake --build out/build/install -j "$(nproc 2>/dev/null || sysctl -n hw.ncpu)"
- name: Build shared install smoke tree (Windows)
if: runner.os == 'Windows'
shell: msys2 {0}
run: cmake --build out/build/install -j "$(nproc)"
- name: Install and relocate TreeWidzard (Unix)
if: runner.os != 'Windows'
run: |
rm -rf out/install_tree out/relocated_tree out/smoke_build
cmake --install out/build/install --prefix out/install_tree
mv out/install_tree out/relocated_tree
- name: Install and relocate TreeWidzard (Windows)
if: runner.os == 'Windows'
shell: msys2 {0}
run: |
rm -rf out/install_tree out/relocated_tree out/smoke_build
cmake --install out/build/install --prefix out/install_tree
mv out/install_tree out/relocated_tree
- name: Bundle Windows runtime DLLs for relocated smoke
if: runner.os == 'Windows'
shell: msys2 {0}
run: |
set -euo pipefail
install_bin="$PWD/out/relocated_tree/bin"
runtime_dir="$PWD/out/relocated_tree/libexec/treewidzard"
deps_file="$PWD/out/windows-runtime-deps.txt"
: > "$deps_file"
export PATH="$install_bin:$runtime_dir:$PATH"
ldd "$runtime_dir/treewidzard.exe" | awk '/=> \// { print $3 }' >> "$deps_file"
find "$runtime_dir/DPCores" "$runtime_dir/SearchStrategies" -name '*.dll' -print0 |
while IFS= read -r -d '' dll; do
ldd "$dll" | awk '/=> \// { print $3 }' >> "$deps_file"
done
sort -u "$deps_file" | while IFS= read -r dep; do
if [ -n "$dep" ]; then
cp -f "$dep" "$runtime_dir/"
fi
done
- name: Smoke test relocated launcher (Unix)
if: runner.os != 'Windows'
run: |
relocated_root="$PWD/out/relocated_tree"
output="$("$relocated_root/bin/treewidzard" -atp tw=2 BreadthFirstSearch "$PWD/examples/conjectures/simple_implies.txt")"
echo "$output"
grep -q "PROPERTY SATISFIED" <<< "$output"
- name: Smoke test relocated launcher (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$root = Join-Path $pwd 'out/relocated_tree'
$property = Join-Path $pwd 'examples/conjectures/simple_implies.txt'
$output = & (Join-Path $root 'bin/treewidzard.bat') -atp tw=2 BreadthFirstSearch $property 2>&1 | Out-String
Write-Host $output
if ($LASTEXITCODE -ne 0 -or $output -notmatch 'PROPERTY SATISFIED') {
exit 1
}
- name: Build install smoke consumer (Unix)
if: runner.os != 'Windows'
run: |
cmake -S tests/install_smoke -B out/smoke_build -DTREEWIDZARD_INSTALL_PREFIX="$PWD/out/relocated_tree"
cmake --build out/smoke_build -j "$(nproc 2>/dev/null || sysctl -n hw.ncpu)"
- name: Build install smoke consumer (Windows)
if: runner.os == 'Windows'
shell: msys2 {0}
run: |
cmake -S tests/install_smoke -B out/smoke_build -G Ninja -DTREEWIDZARD_INSTALL_PREFIX="$PWD/out/relocated_tree"
cmake --build out/smoke_build -j "$(nproc)"
- name: Run install smoke consumer (Unix)
if: runner.os != 'Windows'
run: ./out/smoke_build/treewidzard_install_smoke
- name: Run install smoke consumer (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$root = Join-Path $pwd 'out/relocated_tree'
$runtime = Join-Path $root 'libexec/treewidzard'
$env:PATH = (Join-Path $root 'bin') + ';' + $runtime + ';' + $env:PATH
& (Join-Path $pwd 'out/smoke_build/treewidzard_install_smoke.exe')
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}
path: |
out/build/ci/ctest_results.xml
out/build/ci/Testing/**
- name: Test Summary (Unix)
if: always() && runner.os != 'Windows'
run: |
echo "## Test Results" >> $GITHUB_STEP_SUMMARY
echo "Build completed on ${{ matrix.os }}" >> $GITHUB_STEP_SUMMARY
if [ -f out/build/ci/ctest_results.xml ]; then
echo "✅ ctest completed and produced JUnit output" >> $GITHUB_STEP_SUMMARY
else
echo "❌ ctest did not produce JUnit output" >> $GITHUB_STEP_SUMMARY
fi
- name: Test Summary (Windows)
if: always() && runner.os == 'Windows'
shell: pwsh
run: |
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value "## Test Results"
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value "Build completed on ${{ matrix.os }}"
if (Test-Path 'out/build/ci/ctest_results.xml') {
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value "ctest completed and produced JUnit output"
} else {
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value "ctest did not produce JUnit output"
}
code-quality:
name: Code Quality Checks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y bison flex cmake build-essential
- name: Check for compilation warnings
run: |
set -o pipefail
cmake -S . -B out/build/warnings -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-Werror"
cmake --build out/build/warnings -j "$(nproc)" 2>&1 | tee out/build_output.txt
warning_count=$(grep -c "warning:" out/build_output.txt || true)
echo "Found $warning_count warnings"
echo "## Build Warnings: $warning_count" >> $GITHUB_STEP_SUMMARY
if [ "$warning_count" -ne 0 ]; then
echo "Warnings are treated as failures in this job." >&2
exit 1
fi