-
Notifications
You must be signed in to change notification settings - Fork 1
367 lines (325 loc) · 12.4 KB
/
ci.yml
File metadata and controls
367 lines (325 loc) · 12.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
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
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
build:
name: ${{ matrix.os }} / ${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
env:
BUILD_TYPE: Debug
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
VCPKG_FEATURE_FLAGS: "manifests,registries,versions,binarycaching"
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
compiler: gcc
triplet: x64-linux
# Note: Ubuntu clang removed due to incomplete std::format support
# when using libstdc++ (default on Ubuntu). C++20 std::format requires
# either GCC 13+, MSVC, or Clang with libc++.
- os: macos-14
compiler: clang
triplet: arm64-osx
- os: windows-2022
compiler: msvc
triplet: x64-windows
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
persist-credentials: true
clean: true
fetch-depth: 1
token: ${{ secrets.GITHUB_TOKEN }}
# Dependencies are cloned from HEAD of each repo's default branch.
# If a dependency has test failures, they must be fixed upstream first.
# To debug: check the "Log dependency versions" step for exact commits used.
- name: Checkout dependencies (Unix)
if: runner.os != 'Windows'
run: |
cd ..
git clone --depth 1 https://github.com/kcenon/common_system.git
git clone --depth 1 https://github.com/kcenon/thread_system.git
git clone --depth 1 https://github.com/kcenon/logger_system.git
git clone --depth 1 https://github.com/kcenon/container_system.git
git clone --depth 1 https://github.com/kcenon/network_system.git
git clone --depth 1 https://github.com/kcenon/monitoring_system.git
- name: Checkout dependencies (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
cd ..
git clone --depth 1 https://github.com/kcenon/common_system.git
git clone --depth 1 https://github.com/kcenon/thread_system.git
git clone --depth 1 https://github.com/kcenon/logger_system.git
git clone --depth 1 https://github.com/kcenon/container_system.git
git clone --depth 1 https://github.com/kcenon/network_system.git
git clone --depth 1 https://github.com/kcenon/monitoring_system.git
- name: Log dependency versions (Unix)
if: runner.os != 'Windows'
run: |
echo "=== Dependency commits cloned for this CI run ==="
for dep in common_system thread_system logger_system container_system network_system monitoring_system; do
commit=$(git -C "../$dep" rev-parse HEAD)
echo "$dep: $commit"
done
- name: Log dependency versions (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
Write-Host "=== Dependency commits cloned for this CI run ==="
foreach ($dep in @("common_system","thread_system","logger_system","container_system","network_system","monitoring_system")) {
$commit = git -C "../$dep" rev-parse HEAD
Write-Host "${dep}: $commit"
}
- name: Install dependencies (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install -y cmake build-essential gdb pkg-config curl zip unzip tar autoconf automake autoconf-archive ninja-build
sudo apt install -y clang lld
sudo apt install -y libgtest-dev libgmock-dev libyaml-cpp-dev
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install ninja pkg-config curl zip unzip autoconf automake autoconf-archive yaml-cpp googletest
- name: Setup Visual Studio (Windows)
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v2
- name: Setup Visual Studio environment (Windows)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Check architecture (Linux)
if: runner.os == 'Linux'
run: |
if [ "$(uname -m)" = "aarch64" ]; then
echo "VCPKG_FORCE_SYSTEM_BINARIES=arm" >> $GITHUB_ENV
fi
- name: Cache vcpkg
uses: actions/cache@v4
id: vcpkg-cache
with:
path: |
${{ github.workspace }}/vcpkg
!${{ github.workspace }}/vcpkg/buildtrees
!${{ github.workspace }}/vcpkg/packages
!${{ github.workspace }}/vcpkg/downloads
key: ${{ runner.os }}-${{ matrix.compiler }}-vcpkg-tool-${{ hashFiles('vcpkg.json') }}
restore-keys: |
${{ runner.os }}-${{ matrix.compiler }}-vcpkg-tool-
- name: Set up vcpkg (Unix)
if: runner.os != 'Windows'
run: |
if [ ! -d "vcpkg" ]; then
git clone https://github.com/Microsoft/vcpkg.git
fi
cd vcpkg
if [ "${{ steps.vcpkg-cache.outputs.cache-hit }}" != "true" ]; then
git pull
./bootstrap-vcpkg.sh
fi
cd ..
- name: Set up vcpkg (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
if (!(Test-Path "vcpkg")) {
git clone https://github.com/Microsoft/vcpkg.git
}
cd vcpkg
if ("${{ steps.vcpkg-cache.outputs.cache-hit }}" -ne "true") {
git pull
.\bootstrap-vcpkg.bat
}
cd ..
- name: Determine vcpkg commit (Unix)
if: runner.os != 'Windows'
id: vcpkg-commit-unix
run: echo "commit=$(git -C vcpkg rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Determine vcpkg commit (Windows)
if: runner.os == 'Windows'
id: vcpkg-commit-windows
shell: pwsh
run: |
$commit = git -C vcpkg rev-parse HEAD
"commit=$commit" >> $env:GITHUB_OUTPUT
# Cache vcpkg_installed for Unix only (Windows uses vcpkg binary caching via x-gha)
- name: Cache vcpkg installed (Unix)
if: runner.os != 'Windows'
uses: actions/cache@v4
id: vcpkg-installed
with:
path: ${{ github.workspace }}/vcpkg_installed
key: ${{ runner.os }}-${{ matrix.compiler }}-vcpkg-installed-${{ matrix.triplet }}-testing-${{ hashFiles('vcpkg.json', 'vcpkg-configuration.json') }}-${{ steps.vcpkg-commit-unix.outputs.commit }}
restore-keys: |
${{ runner.os }}-${{ matrix.compiler }}-vcpkg-installed-${{ matrix.triplet }}-testing-
- name: Install dependencies with vcpkg (Unix)
if: runner.os != 'Windows' && steps.vcpkg-installed.outputs.cache-hit != 'true'
run: |
./vcpkg/vcpkg install --x-manifest-root=. --x-install-root=${{ github.workspace }}/vcpkg_installed --triplet ${{ matrix.triplet }} --x-feature=testing || echo "vcpkg install failed, will use system libraries"
# Windows: vcpkg toolchain handles installation in manifest mode
# Uses binary caching (VCPKG_BINARY_SOURCES) for build speed
- name: Prepare build directory
if: runner.os != 'Windows'
run: |
rm -rf build
mkdir -p build
- name: Prepare build directory (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
if (Test-Path build) { Remove-Item -Recurse -Force build }
New-Item -ItemType Directory -Path build
- name: Configure CMake (Unix)
if: runner.os != 'Windows'
run: |
cd build
cmake .. \
-G Ninja \
-DMESSAGING_BUILD_TESTS=ON \
-DMESSAGING_BUILD_EXAMPLES=OFF \
-DMESSAGING_USE_LOCAL_SYSTEMS=ON \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DCMAKE_C_COMPILER=${{ matrix.compiler == 'gcc' && 'gcc' || 'clang' }} \
-DCMAKE_CXX_COMPILER=${{ matrix.compiler == 'gcc' && 'g++' || 'clang++' }}
- name: Configure CMake (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
cd build
cmake .. `
-G "Visual Studio 17 2022" `
-A x64 `
-DMESSAGING_BUILD_TESTS=ON `
-DMESSAGING_BUILD_INTEGRATION_TESTS=OFF `
-DMESSAGING_BUILD_EXAMPLES=OFF `
-DMESSAGING_USE_LOCAL_SYSTEMS=ON `
-DCMAKE_BUILD_TYPE=$env:BUILD_TYPE `
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake `
-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} `
-DVCPKG_MANIFEST_FEATURES=testing
- name: Build (Unix)
if: runner.os != 'Windows'
run: |
cd build
cmake --build . --parallel
- name: Build (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
cd build
# Use maximum available CPU cores for faster build
$cores = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors
Write-Host "Building with $cores parallel jobs"
cmake --build . --config $env:BUILD_TYPE --parallel $cores
- name: Run tests (Unix)
if: runner.os != 'Windows'
run: |
cd build
# On Linux, exclude task integration tests due to known threading issues
# These tests pass on macOS and Windows but have issues on Linux
if [ "$RUNNER_OS" = "Linux" ]; then
ctest --output-on-failure --timeout 120 \
-E "TaskLifecycleTest|WorkerScenariosTest|FailureRecoveryTest|SchedulingTest|ConcurrentLoadTest"
else
ctest --output-on-failure --timeout 120
fi
- name: Run tests (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
cd build
# Exclude test_request_reply due to known flaky behavior on Windows
ctest -C $env:BUILD_TYPE --output-on-failure --timeout 120 --parallel 4 -E "test_request_reply"
if ($LASTEXITCODE -ne 0) {
Write-Host "::error::Some tests failed on Windows"
exit $LASTEXITCODE
}
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}-${{ matrix.compiler }}
path: |
build/Testing/
build/**/*.log
retention-days: 7
if-no-files-found: ignore
- name: Upload build artifacts on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: build-failure-${{ matrix.os }}-${{ matrix.compiler }}
path: |
build/CMakeFiles/CMakeOutput.log
build/CMakeFiles/CMakeError.log
build/**/*.log
retention-days: 7
if-no-files-found: ignore
# Build without network_system (stub mode)
build-without-network:
name: Build without network_system
runs-on: ubuntu-24.04
timeout-minutes: 30
env:
BUILD_TYPE: Debug
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
persist-credentials: true
clean: true
fetch-depth: 1
token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout dependencies (without network_system)
run: |
cd ..
git clone --depth 1 https://github.com/kcenon/common_system.git
git clone --depth 1 https://github.com/kcenon/thread_system.git
git clone --depth 1 https://github.com/kcenon/logger_system.git
git clone --depth 1 https://github.com/kcenon/container_system.git
git clone --depth 1 https://github.com/kcenon/monitoring_system.git
# Note: network_system is intentionally not cloned
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y cmake build-essential ninja-build
sudo apt install -y libgtest-dev libgmock-dev libyaml-cpp-dev
- name: Prepare build directory
run: |
rm -rf build
mkdir -p build
- name: Configure CMake (without network_system)
run: |
cd build
cmake .. \
-G Ninja \
-DMESSAGING_BUILD_TESTS=ON \
-DMESSAGING_BUILD_EXAMPLES=OFF \
-DMESSAGING_USE_LOCAL_SYSTEMS=ON \
-DKCENON_WITH_NETWORK_SYSTEM=OFF \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_CXX_COMPILER=g++
- name: Build
run: |
cd build
cmake --build . --parallel
- name: Run tests
run: |
cd build
ctest --output-on-failure --timeout 120 \
-E "TaskLifecycleTest|WorkerScenariosTest|FailureRecoveryTest|SchedulingTest|ConcurrentLoadTest"
# Sanitizer testing disabled temporarily due to fmt dependency issues
# Will be re-enabled once thread_system fmt dependency is resolved