-
Notifications
You must be signed in to change notification settings - Fork 0
596 lines (528 loc) · 19.1 KB
/
integration-tests.yml
File metadata and controls
596 lines (528 loc) · 19.1 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
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
name: Integration Tests
on:
push:
branches: [ main, feat/phase5-integration-testing ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
integration-tests-ubuntu:
name: Integration Tests (Ubuntu)
runs-on: ubuntu-latest
strategy:
matrix:
build-type: [Debug, Release]
# Note: Clang removed due to transient apt package conflicts on GitHub runners
# Main CI (ci.yml) still tests Clang with proper libc++ support
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install system dependencies
run: |
# Retry logic for apt-get to handle transient failures
for i in 1 2 3; do
echo "Attempt $i: Updating package list..."
sudo apt-get update && break || {
echo "apt-get update failed, retrying in 10 seconds..."
sleep 10
}
done
# Install dependencies with retry
# Note: GCC 13+ on ubuntu-latest (24.04) has full std::format support
for i in 1 2 3; do
echo "Attempt $i: Installing dependencies..."
sudo apt-get install -y \
cmake \
ninja-build \
gcc \
g++ && break || {
echo "apt-get install failed, retrying in 10 seconds..."
sleep 10
}
done
# Verify installation
gcc --version
g++ --version
cmake --version
ninja --version
# GTest is now fetched via CMake FetchContent - no system package needed
- name: Checkout common_system (optional dependency)
continue-on-error: true
run: |
cd ..
if [ ! -d "common_system" ]; then
git clone https://github.com/kcenon/common_system.git || echo "common_system not available"
fi
- name: Cache FetchContent dependencies
uses: actions/cache@v4
with:
path: |
build/_deps
key: ${{ runner.os }}-gcc-${{ matrix.build-type }}-fetchcontent-gtest-v1.14.0
restore-keys: |
${{ runner.os }}-gcc-${{ matrix.build-type }}-fetchcontent-gtest-v1.14.0
${{ runner.os }}-gcc-fetchcontent-gtest-v1.14.0
- name: Configure CMake
env:
CC: gcc
CXX: g++
run: |
BUILD_WITH_COMMON="OFF"
if [ -d "../common_system" ]; then
BUILD_WITH_COMMON="ON"
fi
echo "=== Build Configuration ==="
echo "Compiler: GCC"
echo "Build Type: ${{ matrix.build-type }}"
echo "Common System: $BUILD_WITH_COMMON"
echo "GTest: Will be fetched via FetchContent if needed"
echo "==========================="
cmake -B build \
-G Ninja \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DBUILD_INTEGRATION_TESTS=ON \
-DBUILD_WITH_COMMON_SYSTEM=$BUILD_WITH_COMMON \
-DCMAKE_PREFIX_PATH="/usr" \
--debug-find || {
echo "::error::CMake configuration failed"
echo "CMake logs:"
cat build/CMakeFiles/CMakeError.log 2>/dev/null || echo "No CMakeError.log found"
exit 1
}
- name: Build
run: |
echo "=== Building with GCC ==="
cmake --build build --config ${{ matrix.build-type }} --verbose || {
echo "::error::Build failed"
exit 1
}
- name: Run Smoke and Integration Tests
working-directory: build
timeout-minutes: 10
run: |
echo "=== Running Fast Tests (Smoke + Integration) ==="
# Debug builds run 2-3x slower due to no optimization, use longer timeout
if [ "${{ matrix.build-type }}" = "Debug" ]; then
ctest --output-on-failure --timeout 300 -L "smoke|integration" -C ${{ matrix.build-type }}
else
ctest --output-on-failure --timeout 120 -L "smoke|integration" -C ${{ matrix.build-type }}
fi
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: integration-test-results-ubuntu-gcc-${{ matrix.build-type }}
path: build/Testing/Temporary/LastTest.log
integration-tests-macos:
name: Integration Tests (macOS)
runs-on: macos-latest
strategy:
matrix:
build-type: [Debug, Release]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install system dependencies
run: |
# Note: macOS has built-in std::format support via Apple Clang
brew install cmake ninja
# GTest is now fetched via CMake FetchContent - no system package needed
- name: Checkout common_system (optional dependency)
continue-on-error: true
run: |
cd ..
if [ ! -d "common_system" ]; then
git clone https://github.com/kcenon/common_system.git || echo "common_system not available"
fi
- name: Cache FetchContent dependencies
uses: actions/cache@v4
with:
path: |
build/_deps
key: ${{ runner.os }}-${{ matrix.build-type }}-fetchcontent-gtest-v1.14.0
restore-keys: |
${{ runner.os }}-${{ matrix.build-type }}-fetchcontent-gtest-v1.14.0
${{ runner.os }}-fetchcontent-gtest-v1.14.0
- name: Configure CMake
run: |
BUILD_WITH_COMMON="OFF"
if [ -d "../common_system" ]; then
BUILD_WITH_COMMON="ON"
fi
echo "=== Build Configuration ==="
echo "Build Type: ${{ matrix.build-type }}"
echo "Common System: $BUILD_WITH_COMMON"
echo "GTest: Will be fetched via FetchContent if needed"
echo "==========================="
cmake -B build \
-G Ninja \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DBUILD_INTEGRATION_TESTS=ON \
-DBUILD_WITH_COMMON_SYSTEM=$BUILD_WITH_COMMON \
--debug-find || {
echo "::error::CMake configuration failed"
echo "CMake logs:"
cat build/CMakeFiles/CMakeError.log 2>/dev/null || echo "No CMakeError.log found"
exit 1
}
- name: Build
run: cmake --build build --config ${{ matrix.build-type }}
- name: Run Smoke and Integration Tests
working-directory: build
timeout-minutes: 10
run: |
echo "=== Running Fast Tests (Smoke + Integration) ==="
# Debug builds run 2-3x slower due to no optimization, use longer timeout
if [ "${{ matrix.build-type }}" = "Debug" ]; then
ctest --output-on-failure --timeout 300 -L "smoke|integration" -C ${{ matrix.build-type }}
else
ctest --output-on-failure --timeout 120 -L "smoke|integration" -C ${{ matrix.build-type }}
fi
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: integration-test-results-macos-${{ matrix.build-type }}
path: build/Testing/Temporary/LastTest.log
integration-tests-windows:
name: Integration Tests (Windows)
runs-on: windows-2022
strategy:
matrix:
build-type: [Debug, Release]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup MSVC Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1
- name: Install system dependencies
shell: pwsh
run: |
choco install ninja -y
# GTest is now fetched via CMake FetchContent - no system package needed
# Note: MSVC 19.29+ has full std::format support (version-based detection)
- name: Checkout common_system (optional dependency)
continue-on-error: true
shell: pwsh
run: |
cd ..
if (-not (Test-Path "common_system")) {
git clone https://github.com/kcenon/common_system.git
if ($LASTEXITCODE -ne 0) { Write-Host "common_system not available" }
}
- name: Cache FetchContent dependencies
uses: actions/cache@v4
with:
path: |
build/_deps
key: ${{ runner.os }}-msvc-${{ matrix.build-type }}-fetchcontent-gtest-v1.14.0
restore-keys: |
${{ runner.os }}-msvc-${{ matrix.build-type }}-fetchcontent-gtest-v1.14.0
${{ runner.os }}-msvc-fetchcontent-gtest-v1.14.0
- name: Configure CMake
shell: pwsh
run: |
# Check if common_system is available
if (Test-Path "../common_system") {
Write-Host "Building with common_system support"
$BUILD_WITH_COMMON = "ON"
} else {
Write-Host "Building without common_system support"
$BUILD_WITH_COMMON = "OFF"
}
Write-Host "=== Build Configuration ==="
Write-Host "Compiler: MSVC"
Write-Host "Build Type: ${{ matrix.build-type }}"
Write-Host "Common System: $BUILD_WITH_COMMON"
Write-Host "GTest: Will be fetched via FetchContent if needed"
Write-Host "==========================="
# Use Ninja with MSVC - feature detection uses version-based check
cmake -B build -G Ninja `
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} `
-DCMAKE_CXX_STANDARD=20 `
-DCMAKE_CXX_FLAGS="/std:c++20 /EHsc /Zc:__cplusplus /permissive-" `
-DBUILD_INTEGRATION_TESTS=ON `
-DBUILD_WITH_COMMON_SYSTEM=$BUILD_WITH_COMMON
if ($LASTEXITCODE -ne 0) {
Write-Host "::error::CMake configuration failed"
if (Test-Path "build/CMakeFiles/CMakeError.log") {
Get-Content "build/CMakeFiles/CMakeError.log"
}
exit 1
}
- name: Build
shell: pwsh
run: |
Write-Host "=== Building with MSVC ==="
cmake --build build --config ${{ matrix.build-type }} --verbose
if ($LASTEXITCODE -ne 0) {
Write-Host "::error::Build failed"
exit 1
}
- name: Run Smoke and Integration Tests
working-directory: build
timeout-minutes: 10
shell: pwsh
run: |
Write-Host "=== Running Fast Tests (Smoke + Integration) ==="
# Debug builds run 2-3x slower due to no optimization, use longer timeout
if ("${{ matrix.build-type }}" -eq "Debug") {
ctest --output-on-failure --timeout 300 -L "smoke|integration" -C ${{ matrix.build-type }}
} else {
ctest --output-on-failure --timeout 120 -L "smoke|integration" -C ${{ matrix.build-type }}
}
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: integration-test-results-windows-${{ matrix.build-type }}
path: build/Testing/Temporary/LastTest.log
coverage:
name: Integration Test Coverage
runs-on: ubuntu-latest
continue-on-error: true # Coverage is optional - don't fail workflow if it fails
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install system dependencies
run: |
# Retry logic for apt-get to handle transient failures
for i in 1 2 3; do
echo "Attempt $i: Updating package list..."
sudo apt-get update && break || {
echo "apt-get update failed, retrying in 10 seconds..."
sleep 10
}
done
# Install dependencies with retry
for i in 1 2 3; do
echo "Attempt $i: Installing dependencies..."
# GCC 13+ on ubuntu-latest has full std::format support
sudo apt-get install -y \
cmake \
ninja-build \
gcc \
g++ \
lcov && break || {
echo "apt-get install failed, retrying in 10 seconds..."
sleep 10
}
done
# Verify installation
gcc --version
g++ --version
cmake --version
ninja --version
lcov --version
# GTest is now fetched via CMake FetchContent - no system package needed
- name: Checkout common_system (optional dependency)
continue-on-error: true
run: |
cd ..
if [ ! -d "common_system" ]; then
git clone https://github.com/kcenon/common_system.git || echo "common_system not available"
fi
- name: Cache FetchContent dependencies
uses: actions/cache@v4
with:
path: |
build/_deps
key: ${{ runner.os }}-gcc-Debug-fetchcontent-gtest-v1.14.0-${{ hashFiles('cmake/ThreadSystemDependencies.cmake', 'integration_tests/CMakeLists.txt') }}
restore-keys: |
${{ runner.os }}-gcc-Debug-fetchcontent-gtest-v1.14.0-
${{ runner.os }}-fetchcontent-gtest-v1.14.0-
- name: Configure CMake with Coverage
env:
CC: gcc
CXX: g++
run: |
# Force clean build to ensure coverage flags are applied
# CMake cache can prevent new compiler flags from being picked up
rm -rf build
BUILD_WITH_COMMON="OFF"
if [ -d "../common_system" ]; then
BUILD_WITH_COMMON="ON"
fi
cmake -B build \
-G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_INTEGRATION_TESTS=ON \
-DBUILD_WITH_COMMON_SYSTEM=$BUILD_WITH_COMMON \
-DENABLE_COVERAGE=ON \
-DCMAKE_PREFIX_PATH="/usr"
- name: Build
run: |
echo "=== Building with coverage instrumentation ==="
echo "First 50 lines of verbose build to verify flags:"
cmake --build build --verbose 2>&1 | head -50
echo "..."
echo "=== Running full build ==="
cmake --build build
- name: Generate Coverage Report
timeout-minutes: 15 # Coverage tests run 5-10x slower due to instrumentation
run: |
cd build
# Create coverage directory
mkdir -p coverage/html
# Reset coverage counters
lcov --directory . --zerocounters
# Run tests with extended timeout
# Coverage instrumentation makes tests 5-10x slower, so use 600s timeout
echo "=== Running tests for coverage (smoke + integration) ==="
ctest --output-on-failure --timeout 600 -L "smoke|integration" || {
echo "::warning::Tests failed or timed out during coverage run"
exit 1
}
# Capture coverage data
# --ignore-errors: Handle common lcov issues gracefully
# - inconsistent: Function line detection issues (inline/template functions)
# - negative: Should not occur with -fprofile-update=atomic, but handle anyway
# - mismatch: gcov/gcc version compatibility
echo "=== Capturing coverage data ==="
lcov --directory . \
--capture \
--ignore-errors inconsistent,negative,mismatch \
--output-file coverage/all.info || {
echo "::error::Failed to capture coverage data"
echo "Attempting capture with all errors ignored..."
lcov --directory . \
--capture \
--ignore-errors all \
--output-file coverage/all.info || exit 1
}
# Filter coverage data
echo "=== Filtering coverage data ==="
lcov --remove coverage/all.info \
'/usr/*' \
'*/vcpkg/*' \
'*/build/*' \
'*/unittest/*' \
'*/benchmarks/*' \
'*/samples/*' \
'*/test/*' \
--ignore-errors inconsistent,unused \
--output-file coverage/all.cleaned.info || {
echo "::error::Failed to filter coverage data"
exit 1
}
# Generate HTML report
echo "=== Generating HTML coverage report ==="
genhtml \
--demangle-cpp \
--num-spaces 2 \
--sort \
--title "Thread System Integration Coverage" \
--function-coverage \
--branch-coverage \
--ignore-errors inconsistent,unused \
--output-directory coverage/html \
coverage/all.cleaned.info || {
echo "::error::Failed to generate HTML coverage report"
exit 1
}
echo "=== Coverage report generated successfully ==="
echo "Summary:"
lcov --summary coverage/all.cleaned.info || true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: build/coverage/all.cleaned.info
flags: integration-tests
name: integration-tests-coverage
performance-tests:
name: Performance Benchmarks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install system dependencies
run: |
# Retry logic for apt-get to handle transient failures
for i in 1 2 3; do
echo "Attempt $i: Updating package list..."
sudo apt-get update && break || {
echo "apt-get update failed, retrying in 10 seconds..."
sleep 10
}
done
# Install dependencies with retry
for i in 1 2 3; do
echo "Attempt $i: Installing dependencies..."
# GCC 13+ on ubuntu-latest has full std::format support
sudo apt-get install -y \
cmake \
ninja-build \
gcc \
g++ && break || {
echo "apt-get install failed, retrying in 10 seconds..."
sleep 10
}
done
# Verify installation
gcc --version
g++ --version
cmake --version
ninja --version
# GTest is now fetched via CMake FetchContent - no system package needed
- name: Checkout common_system (optional dependency)
continue-on-error: true
run: |
cd ..
if [ ! -d "common_system" ]; then
git clone https://github.com/kcenon/common_system.git || echo "common_system not available"
fi
- name: Cache FetchContent dependencies
uses: actions/cache@v4
with:
path: |
build/_deps
key: ${{ runner.os }}-gcc-Release-fetchcontent-gtest-v1.14.0-${{ hashFiles('cmake/ThreadSystemDependencies.cmake', 'integration_tests/CMakeLists.txt') }}
restore-keys: |
${{ runner.os }}-gcc-Release-fetchcontent-gtest-v1.14.0-
${{ runner.os }}-fetchcontent-gtest-v1.14.0-
- name: Configure CMake
env:
CC: gcc
CXX: g++
CI: true
run: |
BUILD_WITH_COMMON="OFF"
if [ -d "../common_system" ]; then
BUILD_WITH_COMMON="ON"
fi
cmake -B build \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_INTEGRATION_TESTS=ON \
-DBUILD_PERFORMANCE_TESTS=ON \
-DBUILD_WITH_COMMON_SYSTEM=$BUILD_WITH_COMMON \
-DCMAKE_PREFIX_PATH="/usr"
- name: Build
run: cmake --build build
- name: Run Performance Benchmarks
working-directory: build
timeout-minutes: 15
env:
CI: true
run: |
echo "=== Running Performance Benchmarks ==="
ctest --output-on-failure -L "performance" -V
echo "=== Generating JSON results ==="
./bin/performance_tests --gtest_output=json:performance-results.json
- name: Upload performance results
uses: actions/upload-artifact@v4
with:
name: performance-benchmark-results
path: |
build/performance-results.json
build/Testing/Temporary/LastTest.log