Skip to content

Commit 97d30d3

Browse files
committed
Add CI for Windows
1 parent 6582c77 commit 97d30d3

4 files changed

Lines changed: 154 additions & 0 deletions

File tree

.github/scripts/build_windows.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
3+
# Used by Windows CI build jobs.
4+
5+
set -x
6+
7+
curl -LsSf https://astral.sh/uv/install.sh | sh
8+
set -ex
9+
10+
py_ver="${1}"
11+
if [[ "${2}" == 'ft' ]]; then
12+
py_ver="${py_ver}t"
13+
fi
14+
15+
export PATH="${PATH}:${HOME}/.local/bin/"
16+
17+
uv python pin "${py_ver}"
18+
uv python list --only-installed
19+
uv venv
20+
uv build --no-python-downloads --all-packages --wheel
21+
mv ./dist ./package

.github/scripts/check_package.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
# Used by Windows CI build jobs.
4+
5+
pip install -r ./packaging/requirements.txt
6+
twine check --strict ./package/*.whl
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: " - Wheel (Windows)"
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
python-version:
7+
required: true
8+
type: string
9+
free-threaded:
10+
description: 'Whether FT Python or not. Valid value is "ft" or not.'
11+
default: ''
12+
type: string
13+
run-test:
14+
required: false
15+
default: 'false'
16+
type: string
17+
os:
18+
default: "windows-latest"
19+
type: string
20+
21+
env:
22+
ARTIFACT: wheel-win-py${{ inputs.python-version }}${{ inputs.free-threaded }}
23+
24+
jobs:
25+
build:
26+
runs-on: "${{ inputs.os }}"
27+
steps:
28+
- uses: actions/checkout@v4
29+
with:
30+
persist-credentials: false
31+
32+
- name: Build
33+
env:
34+
SPDL_USE_TRACING: 0
35+
SPDL_BUILD_STUB: 0
36+
shell: cmd
37+
run: |
38+
packaging/vc_env_helper.bat ^
39+
bash ^
40+
.github/scripts/build_windows.sh ^
41+
"${{ inputs.python-version }}" ^
42+
"${{ inputs.free-threaded }}"
43+
44+
- uses: actions/upload-artifact@v4
45+
name: Upload build artifact
46+
with:
47+
name: "${{ env.ARTIFACT }}"
48+
path: package
49+
if-no-files-found: error
50+
retention-days: 7
51+
overwrite: true
52+
53+
- name: Check package
54+
shell: cmd
55+
run: |
56+
packaging/vc_env_helper.bat ^
57+
bash ^
58+
.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/

.github/workflows/packaging.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,25 @@ jobs:
3434
# free-threaded: "${{ matrix.free-threaded }}"
3535
# run-test: "false"
3636

37+
#############################################################################
38+
# Windows
39+
#############################################################################
40+
windows:
41+
name: "Windows"
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
python-version: ["3.10", "3.11", "3.12", "3.13"]
46+
free-threaded: [""]
47+
include:
48+
- python-version: "3.13"
49+
free-threaded: "ft"
50+
uses: ./.github/workflows/_build_windows.yml
51+
with:
52+
python-version: "${{ matrix.python-version }}"
53+
free-threaded: "${{ matrix.free-threaded }}"
54+
run-test: "${{ matrix.python-version == '3.11'}}"
55+
3756
#############################################################################
3857
# Linux (CPU)
3958
#############################################################################

0 commit comments

Comments
 (0)