1- name : TaskflowLite CI
1+ name : CI Extras
22
33on :
44 push :
@@ -14,11 +14,9 @@ concurrency:
1414 cancel-in-progress : true
1515
1616jobs :
17- # ============================================================================
18- # 代码格式检查(clang-format)
19- # ============================================================================
17+ # clang-format
2018 clang-format :
21- name : clang-format check
19+ name : clang-format
2220 runs-on : ubuntu-latest
2321 steps :
2422 - uses : actions/checkout@v4
@@ -27,175 +25,20 @@ jobs:
2725 - name : Run clang-format
2826 run : find taskflowlite -name '*.hpp' -o -name '*.cpp' | xargs clang-format-18 --dry-run --Werror
2927
30- # ============================================================================
31- # 编译 + 测试矩阵(OS × BuildType × Sanitizer)
32- # ============================================================================
33- build-and-test :
34- name : ${{ matrix.os }} | ${{ matrix.build_type }} | San=${{ matrix.sanitizer }}
35- runs-on : ${{ matrix.os }}
36- needs : clang-format
37- strategy :
38- fail-fast : false
39- matrix :
40- include :
41- # ── Ubuntu GCC ──
42- - os : ubuntu-latest
43- compiler : gcc
44- build_type : Release
45- sanitizer : OFF
46- - os : ubuntu-latest
47- compiler : gcc
48- build_type : Debug
49- sanitizer : ASAN
50- - os : ubuntu-latest
51- compiler : gcc
52- build_type : Debug
53- sanitizer : TSAN
54-
55- # ── Ubuntu Clang ──
56- - os : ubuntu-latest
57- compiler : clang
58- build_type : Release
59- sanitizer : OFF
60- - os : ubuntu-latest
61- compiler : clang
62- build_type : Debug
63- sanitizer : ASAN
64-
65- # ── macOS ──
66- - os : macos-latest
67- compiler : clang
68- build_type : Release
69- sanitizer : OFF
70- - os : macos-latest
71- compiler : clang
72- build_type : Debug
73- sanitizer : ASAN
74- - os : macos-latest
75- compiler : clang
76- build_type : Debug
77- sanitizer : TSAN
78-
79- # ── Windows MSVC ──
80- - os : windows-latest
81- compiler : msvc
82- build_type : Release
83- sanitizer : OFF
84- - os : windows-latest
85- compiler : msvc
86- build_type : Debug
87- sanitizer : ASAN
88-
89- steps :
90- - name : Checkout
91- uses : actions/checkout@v4
92-
93- # ── 编译器配置 ──
94- - name : Setup GCC
95- if : matrix.compiler == 'gcc'
96- run : |
97- sudo apt-get update -qq
98- sudo apt-get install -y -qq g++-14
99- echo "CC=gcc-14" >> $GITHUB_ENV
100- echo "CXX=g++-14" >> $GITHUB_ENV
101-
102- - name : Setup Clang
103- if : matrix.compiler == 'clang'
104- run : |
105- wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
106- sudo add-apt-repository -y "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main"
107- sudo apt-get update -qq
108- sudo apt-get install -y -qq clang-18 libc++-18-dev libc++abi-18-dev
109- echo "CC=clang-18" >> $GITHUB_ENV
110- echo "CXX=clang++-18" >> $GITHUB_ENV
111-
112- # ── ccache 加速 ──
113- - name : Setup ccache
114- if : matrix.os != 'windows-latest'
115- uses : hendrikmuhs/ccache-action@v1
116- with :
117- key : ${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.build_type }}
118-
119- - name : Configure ccache (MSVC)
120- if : matrix.os == 'windows-latest'
121- uses : actions/cache@v4
122- with :
123- path : ~/ccache
124- key : ccache-${{ matrix.os }}-${{ matrix.build_type }}-${{ github.run_id }}
125- restore-keys : ccache-${{ matrix.os }}-${{ matrix.build_type }}-
126-
127- # ── CMake 配置 ──
128- - name : Configure CMake
129- run : >
130- cmake -S . -B build
131- -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
132- -DTASKFLOWLITE_BUILD_TESTS=ON
133- -DTASKFLOWLITE_BUILD_EXAMPLES=ON
134- -DTASKFLOWLITE_SANITIZER=${{ matrix.sanitizer }}
135- ${{ matrix.os == 'windows-latest' && '-T ClangCL' || '' }}
136-
137- # ── 编译 ──
138- - name : Build
139- run : cmake --build build --config ${{ matrix.build_type }} --parallel ${{ runner.os == 'macOS' && '3' || '4' }}
140-
141- # ── Windows ASan DLL 准备 ──
142- - name : Copy ASan DLLs (Windows)
143- if : matrix.os == 'windows-latest' && matrix.sanitizer == 'ASAN'
144- shell : pwsh
145- working-directory : ${{ github.workspace }}/build
146- run : |
147- $vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath
148- $msvcVer = (Get-ChildItem "$vsPath\VC\Tools\MSVC" | Sort-Object Name -Descending | Select-Object -First 1).Name
149- $asanDir = "$vsPath\VC\Tools\MSVC\$msvcVer\bin\Hostx64\x64"
150- Get-ChildItem -Path . -Filter "TaskflowLiteTest.exe" -Recurse | ForEach-Object {
151- Copy-Item -Path "$asanDir\clang_rt.asan*.dll" -Destination $_.DirectoryName -Force
152- }
153-
154- # ── 运行测试 (Unix) ──
155- - name : Run Tests (Unix)
156- if : matrix.os != 'windows-latest'
157- working-directory : ${{ github.workspace }}/build
158- env :
159- TSAN_OPTIONS : ${{ matrix.sanitizer == 'TSAN' && format('suppressions={0}/tsan_suppressions.txt second_deadlock_stack=1 history_size=7', github.workspace) || '' }}
160- ASAN_OPTIONS : ${{ matrix.sanitizer == 'ASAN' && 'halt_on_error=1:abort_on_error=1:print_stacktrace=1:detect_leaks=1' || '' }}
161- UBSAN_OPTIONS : ${{ matrix.sanitizer == 'ASAN' && 'halt_on_error=1:print_stacktrace=1' || '' }}
162- CTEST_OUTPUT_ON_FAILURE : ' 1'
163- run : |
164- if [ "${{ matrix.sanitizer }}" = "TSAN" ]; then
165- printf '%s\n' \
166- 'race:Catch::RunContext' \
167- 'race:Catch::Detail' \
168- 'race:Catch::StringStreams' \
169- 'race:Catch::OutputRedirect' \
170- 'race:Catch::ConsoleReporter' \
171- 'race:__sanitizer::IsAccessibleMemoryRange' \
172- > ${{ github.workspace }}/tsan_suppressions.txt
173- fi
174- ctest -C ${{ matrix.build_type }} --output-on-failure -j2
175-
176- # ── 运行测试 (Windows) ──
177- - name : Run Tests (Windows)
178- if : matrix.os == 'windows-latest'
179- working-directory : ${{ github.workspace }}/build
180- run : ctest -C ${{ matrix.build_type }} --output-on-failure -j2
181-
182- # ============================================================================
183- # 额外:Clang-Tidy 静态分析
184- # ============================================================================
28+ # clang-tidy (PR only)
18529 clang-tidy :
186- name : clang-tidy analysis
30+ name : clang-tidy
18731 runs-on : ubuntu-latest
188- needs : clang-format
18932 if : github.event_name == 'pull_request'
19033 steps :
19134 - uses : actions/checkout@v4
192- - name : Install tools
35+ - name : Install clang-tidy
19336 run : |
19437 wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
19538 sudo add-apt-repository -y "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main"
19639 sudo apt-get update -qq
19740 sudo apt-get install -y -qq clang-tidy-18
198- - name : Configure CMake
41+ - name : Configure
19942 run : cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTASKFLOWLITE_BUILD_TESTS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
20043 - name : Run clang-tidy
20144 run : |
@@ -204,24 +47,20 @@ jobs:
20447 --checks='-*,bugprone-*,performance-*,modernize-use-nullptr,modernize-use-override' \
20548 --warnings-as-errors='bugprone-*'
20649
207- # ============================================================================
208- # 发布构建验证(Install + 消费测试)
209- # ============================================================================
50+ # install + consumer test
21051 install-test :
211- name : install + consumer test
52+ name : install + consumer
21253 runs-on : ubuntu-latest
213- needs : clang-format
21454 steps :
21555 - uses : actions/checkout@v4
21656 - name : Configure
21757 run : cmake -S . -B build -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install
21858 - name : Install
21959 run : cmake --install build
220- - name : Verify installed files
60+ - name : Verify
22161 run : |
22262 test -f install/include/taskflowlite/taskflowlite.hpp
22363 test -f install/lib/cmake/TaskflowLite/TaskflowLiteConfig.cmake
224- echo "Install verified OK"
22564 - name : Consumer test
22665 run : |
22766 mkdir -p /tmp/test-consumer
24584 cmake -S /tmp/test-consumer -B /tmp/test-consumer/build \
24685 -DCMAKE_PREFIX_PATH=${{ github.workspace }}/install
24786 cmake --build /tmp/test-consumer/build
248- echo "Consumer build OK"
0 commit comments