Skip to content

Commit 7fe658f

Browse files
author
AstroAir
committed
refactor: update web module, connection examples, tests framework and CI workflows
1 parent c6d0b8b commit 7fe658f

281 files changed

Lines changed: 45774 additions & 11237 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 129 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ name: Continuous Integration
88
branches: [main, develop]
99
workflow_dispatch:
1010

11-
env:
12-
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
13-
1411
jobs:
1512
# Quick code quality checks
1613
code-quality:
@@ -56,105 +53,155 @@ jobs:
5653
find atom/ -name "*.cpp" -o -name "*.hpp" | head -20 | \
5754
xargs cpplint --filter=-whitespace/tab,-build/include_subdir || true
5855
59-
# Build matrix using CMakePresets for multiple platforms and configurations
56+
# Build matrix using CMakePresets for multiple platforms, compilers, and module/features combinations
6057
build:
6158
name: Build (${{ matrix.name }})
6259
runs-on: ${{ matrix.os }}
60+
env:
61+
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
6362
strategy:
6463
fail-fast: false
6564
matrix:
6665
include:
67-
# Linux x64 builds
68-
- name: "Linux x64 Debug"
66+
# Linux GCC
67+
- name: "Linux GCC Debug (all modules)"
6968
os: ubuntu-latest
7069
preset: debug
7170
build_preset: debug
7271
triplet: x64-linux
7372
arch: x64
74-
- name: "Linux x64 Release"
73+
compiler: gcc
74+
module_set: all
75+
build_tests: true
76+
build_examples: true
77+
build_python: true
78+
build_docs: false
79+
- name: "Linux GCC Release (all modules)"
7580
os: ubuntu-latest
7681
preset: release
7782
build_preset: release
7883
triplet: x64-linux
7984
arch: x64
80-
- name: "Linux x64 RelWithDebInfo"
85+
compiler: gcc
86+
module_set: all
87+
build_tests: true
88+
build_examples: true
89+
build_python: true
90+
build_docs: false
91+
- name: "Linux GCC RelWithDebInfo (core modules)"
8192
os: ubuntu-latest
8293
preset: relwithdebinfo
8394
build_preset: relwithdebinfo
8495
triplet: x64-linux
8596
arch: x64
86-
- name: "Linux x64 Makefile Debug"
97+
compiler: gcc
98+
module_set: core
99+
build_tests: true
100+
build_examples: false
101+
build_python: false
102+
build_docs: false
103+
104+
# Linux Clang coverage of RelWithDebInfo + docs
105+
- name: "Linux Clang RelWithDebInfo (all modules + docs)"
87106
os: ubuntu-latest
88-
preset: debug-make
89-
build_preset: debug-make
107+
preset: relwithdebinfo
108+
build_preset: relwithdebinfo
90109
triplet: x64-linux
91110
arch: x64
92-
93-
# Windows x64 builds
94-
- name: "Windows x64 Debug"
95-
os: windows-latest
96-
preset: debug
97-
build_preset: debug
98-
triplet: x64-windows
99-
arch: x64
100-
- name: "Windows x64 Release"
111+
compiler: clang
112+
module_set: all
113+
build_tests: true
114+
build_examples: true
115+
build_python: true
116+
build_docs: true
117+
118+
# Windows MSVC (vcpkg)
119+
- name: "Windows MSVC Release (all modules)"
101120
os: windows-latest
102-
preset: release
103-
build_preset: release
121+
preset: release-vs
122+
build_preset: release-vs
104123
triplet: x64-windows
105124
arch: x64
106-
- name: "Windows x64 VS Debug"
125+
compiler: msvc
126+
module_set: all
127+
build_tests: true
128+
build_examples: true
129+
build_python: true
130+
build_docs: false
131+
- name: "Windows MSVC Debug (all modules)"
107132
os: windows-latest
108133
preset: debug-vs
109134
build_preset: debug-vs
110135
triplet: x64-windows
111136
arch: x64
112-
- name: "Windows x64 VS Release"
113-
os: windows-latest
114-
preset: release-vs
115-
build_preset: release-vs
116-
triplet: x64-windows
117-
arch: x64
118-
- name: "Windows x64 RelWithDebInfo"
137+
compiler: msvc
138+
module_set: all
139+
build_tests: true
140+
build_examples: false
141+
build_python: false
142+
build_docs: false
143+
- name: "Windows MSVC RelWithDebInfo (IO/NET modules)"
119144
os: windows-latest
120145
preset: relwithdebinfo-vs
121146
build_preset: relwithdebinfo-vs
122147
triplet: x64-windows
123148
arch: x64
124-
125-
# macOS Intel builds
126-
- name: "macOS x64 Debug"
127-
os: macos-13
128-
preset: debug
129-
build_preset: debug
130-
triplet: x64-osx
131-
arch: x64
132-
- name: "macOS x64 Release"
149+
compiler: msvc
150+
module_set: io_net
151+
build_tests: true
152+
build_examples: false
153+
build_python: false
154+
build_docs: false
155+
156+
# macOS Intel + Apple Silicon
157+
- name: "macOS x64 Release (all modules)"
133158
os: macos-13
134159
preset: release
135160
build_preset: release
136161
triplet: x64-osx
137162
arch: x64
138-
- name: "macOS x64 RelWithDebInfo"
163+
compiler: clang
164+
module_set: all
165+
build_tests: true
166+
build_examples: true
167+
build_python: true
168+
build_docs: false
169+
- name: "macOS x64 Debug (core modules)"
139170
os: macos-13
140-
preset: relwithdebinfo
141-
build_preset: relwithdebinfo
171+
preset: debug
172+
build_preset: debug
142173
triplet: x64-osx
143174
arch: x64
144-
145-
# macOS Apple Silicon builds
146-
- name: "macOS ARM64 Debug"
175+
compiler: clang
176+
module_set: core
177+
build_tests: true
178+
build_examples: false
179+
build_python: false
180+
build_docs: false
181+
- name: "macOS ARM64 RelWithDebInfo (core modules + docs)"
147182
os: macos-14
148-
preset: debug
149-
build_preset: debug
183+
preset: relwithdebinfo
184+
build_preset: relwithdebinfo
150185
triplet: arm64-osx
151186
arch: arm64
152-
- name: "macOS ARM64 Release"
187+
compiler: clang
188+
module_set: core
189+
build_tests: true
190+
build_examples: false
191+
build_python: false
192+
build_docs: true
193+
- name: "macOS ARM64 Release (all modules)"
153194
os: macos-14
154195
preset: release
155196
build_preset: release
156197
triplet: arm64-osx
157198
arch: arm64
199+
compiler: clang
200+
module_set: all
201+
build_tests: true
202+
build_examples: true
203+
build_python: true
204+
build_docs: false
158205

159206
steps:
160207
- uses: actions/checkout@v4
@@ -189,10 +236,10 @@ jobs:
189236
with:
190237
path: build
191238
key: >-
192-
${{ runner.os }}-${{ matrix.arch }}-cmake-${{ matrix.preset }}-
193-
${{ hashFiles('CMakeLists.txt', 'cmake/**') }}
239+
${{ runner.os }}-${{ matrix.arch }}-${{ matrix.compiler }}-cmake-${{ matrix.preset }}-
240+
${{ hashFiles('CMakeLists.txt', 'cmake/**', 'CMakePresets.json') }}
194241
restore-keys: |
195-
${{ runner.os }}-${{ matrix.arch }}-cmake-${{ matrix.preset }}-
242+
${{ runner.os }}-${{ matrix.arch }}-${{ matrix.compiler }}-cmake-${{ matrix.preset }}-
196243
197244
- name: Install system dependencies (Ubuntu)
198245
if: startsWith(matrix.os, 'ubuntu')
@@ -222,16 +269,42 @@ jobs:
222269
ccache --set-config=max_size=2G
223270
ccache --zero-stats
224271
272+
- name: Select compiler (clang/GCC)
273+
if: matrix.compiler == 'clang'
274+
run: |
275+
echo "CC=clang" >> $GITHUB_ENV
276+
echo "CXX=clang++" >> $GITHUB_ENV
277+
225278
- name: Configure with CMakePresets
279+
shell: bash
226280
run: |
281+
MODULE_ARGS=()
282+
case "${{ matrix.module_set }}" in
283+
all)
284+
MODULE_ARGS+=(-DATOM_BUILD_ALL=ON)
285+
;;
286+
core)
287+
MODULE_ARGS+=(-DATOM_BUILD_ALL=OFF -DATOM_BUILD_ERROR=ON -DATOM_BUILD_UTILS=ON)
288+
MODULE_ARGS+=(-DATOM_BUILD_TYPE=ON -DATOM_BUILD_LOG=ON -DATOM_BUILD_META=ON -DATOM_BUILD_COMPONENTS=ON)
289+
;;
290+
io_net)
291+
MODULE_ARGS+=(-DATOM_BUILD_ALL=OFF -DATOM_BUILD_IO=ON -DATOM_BUILD_IMAGE=ON)
292+
MODULE_ARGS+=(-DATOM_BUILD_SERIAL=ON -DATOM_BUILD_CONNECTION=ON -DATOM_BUILD_WEB=ON -DATOM_BUILD_ASYNC=ON)
293+
;;
294+
*)
295+
MODULE_ARGS+=(-DATOM_BUILD_ALL=ON)
296+
;;
297+
esac
298+
227299
cmake --preset ${{ matrix.preset }} \
228300
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake \
229301
-DUSE_VCPKG=ON \
230302
-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} \
231-
-DATOM_BUILD_EXAMPLES=ON \
232-
-DATOM_BUILD_TESTS=ON \
233-
-DATOM_BUILD_PYTHON_BINDINGS=ON \
234-
-DATOM_BUILD_DOCS=ON
303+
-DATOM_BUILD_TESTS=${{ matrix.build_tests }} \
304+
-DATOM_BUILD_EXAMPLES=${{ matrix.build_examples }} \
305+
-DATOM_BUILD_PYTHON_BINDINGS=${{ matrix.build_python }} \
306+
-DATOM_BUILD_DOCS=${{ matrix.build_docs }} \
307+
"${MODULE_ARGS[@]}"
235308
236309
- name: Build with CMakePresets
237310
run: |
@@ -285,7 +358,7 @@ jobs:
285358
run: ccache --show-stats
286359

287360
- name: Generate documentation
288-
if: matrix.os == 'ubuntu-latest' && matrix.preset == 'release'
361+
if: matrix.build_docs == true
289362
run: |
290363
cmake --build build --target doc
291364

.github/workflows/code-quality.yml

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ on:
99
- cron: "0 2 * * 1" # Weekly on Monday at 2 AM
1010
workflow_dispatch:
1111

12-
env:
13-
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
14-
1512
jobs:
1613
# Static analysis with multiple tools
1714
static-analysis:
1815
name: Static Analysis
1916
runs-on: ubuntu-latest
17+
env:
18+
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
2019
steps:
2120
- uses: actions/checkout@v4
2221
with:
@@ -40,6 +39,14 @@ jobs:
4039
iwyu include-what-you-use \
4140
valgrind lcov cmake ninja-build
4241
42+
- name: Setup vcpkg
43+
uses: lukka/run-vcpkg@v11
44+
with:
45+
vcpkgGitCommitId: "dbe35ceb30c688bf72e952ab23778e009a578f18"
46+
47+
- name: Setup CMake
48+
uses: lukka/get-cmake@latest
49+
4350
- name: Setup Python
4451
uses: actions/setup-python@v5
4552
with:
@@ -49,6 +56,35 @@ jobs:
4956
run: |
5057
pip install cpplint lizard complexity-report
5158
59+
- name: Cache vcpkg
60+
uses: actions/cache@v4
61+
with:
62+
path: |
63+
${{ github.workspace }}/vcpkg
64+
~/.cache/vcpkg
65+
key: ${{ runner.os }}-analysis-vcpkg-${{ hashFiles('vcpkg.json') }}
66+
restore-keys: |
67+
${{ runner.os }}-analysis-vcpkg-
68+
69+
- name: Cache CMake configure (compile commands)
70+
uses: actions/cache@v4
71+
with:
72+
path: build
73+
key: >-
74+
${{ runner.os }}-analysis-cmake-${{ hashFiles('CMakeLists.txt', 'cmake/**', 'CMakePresets.json') }}
75+
restore-keys: |
76+
${{ runner.os }}-analysis-cmake-
77+
78+
- name: Configure project (compile_commands)
79+
run: |
80+
cmake --preset debug \
81+
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake \
82+
-DUSE_VCPKG=ON \
83+
-DATOM_BUILD_TESTS=ON \
84+
-DATOM_BUILD_EXAMPLES=OFF \
85+
-DATOM_BUILD_PYTHON_BINDINGS=OFF \
86+
-DATOM_BUILD_DOCS=OFF
87+
5288
- name: Run cppcheck
5389
run: |
5490
cppcheck --enable=all \
@@ -64,9 +100,6 @@ jobs:
64100
65101
- name: Run clang-tidy
66102
run: |
67-
# Generate compile commands using CMakePresets
68-
cmake --preset debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
69-
70103
# Run clang-tidy on source files
71104
find atom/ -name "*.cpp" | head -20 | xargs -I {} \
72105
clang-tidy {} -p build/ \
@@ -271,12 +304,14 @@ jobs:
271304
lcov --list coverage.info
272305
273306
- name: Upload coverage to Codecov
307+
env:
308+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
309+
if: ${{ env.CODECOV_TOKEN != '' }}
274310
uses: codecov/codecov-action@v4
275311
with:
276312
file: build/coverage.info
277313
flags: unittests
278314
name: codecov-umbrella
279-
token: ${{ secrets.CODECOV_TOKEN }}
280315

281316
# Documentation quality
282317
documentation-quality:

0 commit comments

Comments
 (0)