Skip to content

Commit 097ab0e

Browse files
chicogongclaude
andcommitted
ci: Add Windows support, code coverage, and sanitizers
- Add Windows CI build with vcpkg dependency management - Add code coverage reporting with Codecov integration - Add AddressSanitizer + UndefinedBehaviorSanitizer job - Optimize Windows matrix (Python 3.11-3.12 only) - RNNoise disabled on Windows (MSVC VLA incompatibility) Improves CI robustness and code quality assurance. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 7f9ab54 commit 097ab0e

File tree

1 file changed

+129
-4
lines changed

1 file changed

+129
-4
lines changed

.github/workflows/ci.yml

Lines changed: 129 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
os: [ubuntu-latest, macos-latest]
16+
os: [ubuntu-latest, macos-latest, windows-latest]
1717
python-version: ['3.9', '3.10', '3.11', '3.12']
18+
exclude:
19+
# Reduce Windows matrix to save CI time
20+
- os: windows-latest
21+
python-version: '3.9'
22+
- os: windows-latest
23+
python-version: '3.10'
1824

1925
steps:
2026
- name: Checkout code
@@ -36,21 +42,46 @@ jobs:
3642
run: |
3743
brew install ffmpeg portaudio flac cmake ninja
3844
45+
- name: Install dependencies (Windows)
46+
if: runner.os == 'Windows'
47+
run: |
48+
choco install cmake ninja -y
49+
# Use vcpkg for dependencies
50+
vcpkg install ffmpeg[core]:x64-windows portaudio:x64-windows flac:x64-windows
51+
echo "VCPKG_ROOT=C:\vcpkg" >> $GITHUB_ENV
52+
shell: bash
53+
3954
- name: Install Python dependencies
4055
run: |
4156
python -m pip install --upgrade pip
4257
pip install build pytest numpy
4358
44-
- name: Build C++ library
59+
- name: Build C++ library (Unix)
60+
if: runner.os != 'Windows'
4561
run: |
4662
mkdir -p build && cd build
4763
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON -DBUILD_PYTHON=OFF -DENABLE_RNNOISE=ON -DENABLE_WHISPER=ON -GNinja
4864
ninja
4965
50-
- name: Run C++ tests
66+
- name: Build C++ library (Windows)
67+
if: runner.os == 'Windows'
68+
run: |
69+
mkdir build && cd build
70+
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON -DBUILD_PYTHON=OFF -DENABLE_RNNOISE=OFF -DENABLE_WHISPER=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -GNinja
71+
ninja
72+
shell: bash
73+
74+
- name: Run C++ tests (Unix)
75+
if: runner.os != 'Windows'
5176
run: |
5277
cd build && ./tests/ffvoice_tests --gtest_brief=1
5378
79+
- name: Run C++ tests (Windows)
80+
if: runner.os == 'Windows'
81+
run: |
82+
cd build && ./tests/ffvoice_tests.exe --gtest_brief=1
83+
shell: bash
84+
5485
- name: Build Python package
5586
run: pip install -e .
5687

@@ -62,12 +93,98 @@ jobs:
6293
run: |
6394
pytest python/tests -v || echo "Tests completed"
6495
96+
code-coverage:
97+
name: Code Coverage
98+
runs-on: ubuntu-latest
99+
100+
steps:
101+
- name: Checkout code
102+
uses: actions/checkout@v4
103+
104+
- name: Set up Python
105+
uses: actions/setup-python@v5
106+
with:
107+
python-version: '3.11'
108+
109+
- name: Install dependencies
110+
run: |
111+
sudo apt-get update
112+
sudo apt-get install -y libavcodec-dev libavformat-dev libavutil-dev libswresample-dev portaudio19-dev libflac-dev cmake ninja-build lcov
113+
114+
- name: Build with coverage
115+
run: |
116+
mkdir -p build && cd build
117+
cmake .. -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON -DBUILD_PYTHON=OFF -DENABLE_RNNOISE=ON -DENABLE_WHISPER=ON -GNinja
118+
ninja
119+
120+
- name: Run tests
121+
run: |
122+
cd build && ./tests/ffvoice_tests
123+
124+
- name: Generate coverage report
125+
run: |
126+
cd build
127+
lcov --capture --directory . --output-file coverage.info
128+
lcov --remove coverage.info '/usr/*' '*/tests/*' '*/googletest/*' '*/build/_deps/*' --output-file coverage.info
129+
lcov --list coverage.info
130+
131+
- name: Upload to Codecov
132+
uses: codecov/codecov-action@v4
133+
with:
134+
files: ./build/coverage.info
135+
flags: unittests
136+
name: codecov-umbrella
137+
fail_ci_if_error: false
138+
verbose: true
139+
140+
sanitizers:
141+
name: Sanitizers (ASan + UBSan)
142+
runs-on: ubuntu-latest
143+
144+
steps:
145+
- name: Checkout code
146+
uses: actions/checkout@v4
147+
148+
- name: Set up Python
149+
uses: actions/setup-python@v5
150+
with:
151+
python-version: '3.11'
152+
153+
- name: Install dependencies
154+
run: |
155+
sudo apt-get update
156+
sudo apt-get install -y libavcodec-dev libavformat-dev libavutil-dev libswresample-dev portaudio19-dev libflac-dev cmake ninja-build clang
157+
158+
- name: Build with sanitizers
159+
run: |
160+
mkdir -p build && cd build
161+
cmake .. \
162+
-DCMAKE_BUILD_TYPE=Debug \
163+
-DBUILD_TESTS=ON \
164+
-DBUILD_PYTHON=OFF \
165+
-DENABLE_RNNOISE=ON \
166+
-DENABLE_WHISPER=ON \
167+
-DCMAKE_C_COMPILER=clang \
168+
-DCMAKE_CXX_COMPILER=clang++ \
169+
-DCMAKE_CXX_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer -g" \
170+
-DCMAKE_C_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer -g" \
171+
-DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address,undefined" \
172+
-GNinja
173+
ninja
174+
175+
- name: Run tests with sanitizers
176+
run: |
177+
cd build
178+
export ASAN_OPTIONS=detect_leaks=1:check_initialization_order=1:strict_init_order=1
179+
export UBSAN_OPTIONS=print_stacktrace=1
180+
./tests/ffvoice_tests --gtest_brief=1
181+
65182
build-wheels:
66183
name: Build wheels
67184
runs-on: ${{ matrix.os }}
68185
strategy:
69186
matrix:
70-
os: [ubuntu-latest, macos-latest]
187+
os: [ubuntu-latest, macos-latest, windows-latest]
71188

72189
steps:
73190
- name: Checkout code
@@ -89,6 +206,14 @@ jobs:
89206
run: |
90207
brew install ffmpeg portaudio flac cmake
91208
209+
- name: Install dependencies (Windows)
210+
if: runner.os == 'Windows'
211+
run: |
212+
choco install cmake -y
213+
vcpkg install ffmpeg[core]:x64-windows portaudio:x64-windows flac:x64-windows
214+
echo "VCPKG_ROOT=C:\vcpkg" >> $GITHUB_ENV
215+
shell: bash
216+
92217
- name: Build wheel
93218
run: |
94219
pip install build

0 commit comments

Comments
 (0)