Skip to content

Commit c229dfc

Browse files
committed
Add CI for Windows
1 parent 3bf531c commit c229dfc

2 files changed

Lines changed: 63 additions & 5 deletions

File tree

.github/workflows/_build_windows.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,53 @@ jobs:
5656
packaging/vc_env_helper.bat ^
5757
bash ^
5858
.github/scripts/check_package.sh
59+
60+
unit-test:
61+
if: "${{ inputs.run-test == 'true' }}"
62+
name: "test ffmpeg"
63+
needs: ["build"]
64+
strategy:
65+
fail-fast: false
66+
matrix:
67+
ffmpeg-version: ["4.4.2", "5.1", "6.1", "7.1", "8.0"]
68+
runs-on: "${{ inputs.os }}"
69+
defaults:
70+
run:
71+
shell: bash -el {0}
72+
steps:
73+
- uses: actions/checkout@v4
74+
with:
75+
persist-credentials: false
76+
77+
- uses: actions/download-artifact@v4
78+
with:
79+
name: "${{ env.ARTIFACT }}"
80+
path: package
81+
82+
- uses: conda-incubator/setup-miniconda@v3
83+
with:
84+
python-version: ${{ inputs.python-version }}
85+
conda-remove-defaults: "true"
86+
87+
- name: Unit test
88+
run: |
89+
if [[ "${{ inputs.free-threaded }}" == 'ft' ]]; then
90+
conda install -q -c conda-forge python-freethreading
91+
fi
92+
93+
# Install SPDL
94+
pip install $(find package -name '*.whl' -depth -maxdepth 1)
95+
96+
# Install PyTorch and others
97+
if [[ "${{ inputs.free-threaded }}" == 'ft' ]]; then
98+
pip install torch numpy pytest
99+
else
100+
pip install torch numpy numba pytest
101+
fi
102+
103+
# Install FFmpeg
104+
conda install -q -c conda-forge "ffmpeg==${{ matrix.ffmpeg-version }}"
105+
106+
pytest -v \
107+
tests/spdl_unittest/io/ \
108+
tests/spdl_unittest/dataloader/

tests/spdl_unittest/io/audio_encoding_test.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
# pyre-unsafe
88

9+
import os
10+
import sys
911
from tempfile import NamedTemporaryFile
1012

1113
import numpy as np
@@ -200,8 +202,18 @@ def test_encode_audio_integer_planar(sample_fmt):
200202
np.testing.assert_array_equal(hyp.T, ref)
201203

202204

205+
# On Windows GHA CI, the default mp3 encoder is `mp3_mf`, which does not
206+
# support s16p. `libmp3lame` seems to be not available.
207+
_WIN_CI = sys.platform == "win32" and "GITHUB_ACTIONS" in os.environ
208+
209+
203210
@pytest.mark.parametrize(
204-
"ext,sample_fmt", [(".mp3", "s16p"), (".flac", "s16"), (".aac", "fltp")]
211+
"ext,sample_fmt",
212+
[
213+
(".mp3", "s16" if _WIN_CI else "s16p"),
214+
(".flac", "s16"),
215+
(".aac", "fltp"),
216+
],
205217
)
206218
def test_encode_audio_smoke_test(ext, sample_fmt):
207219
"""Can save audio data in commoly used format."""
@@ -234,10 +246,6 @@ def test_encode_audio_smoke_test(ext, sample_fmt):
234246
sample_fmt=sample_fmt,
235247
sample_rate=sample_rate,
236248
),
237-
# on Windows, the default might be mp3_mf, which
238-
# does not support planar format.
239-
# So we specify lame
240-
encoder="libmp3lame" if ext == ".mp3" else None,
241249
)
242250

243251
frame_size = encoder.frame_size or 1024

0 commit comments

Comments
 (0)