@@ -36,19 +36,20 @@ jobs:
3636 with-rocm : disable
3737 with-cuda : disable
3838 build-python-only : " disable"
39+ python-versions : ' ["3.10", "3.11", "3.12", "3.13"]'
40+
3941
4042 build :
4143 needs : generate-matrix
4244 strategy :
4345 fail-fast : false
4446 name : Build and Upload Windows wheel
45- # TODO: use @main
46- uses : nicolashug/test-infra/.github/workflows/build_wheels_windows.yml@build-platform-windows
47+ uses : pytorch/test-infra/.github/workflows/build_wheels_windows.yml@main
4748 with :
4849 repository : pytorch/torchcodec
4950 ref : " "
50- test-infra-repository : nicolashug /test-infra
51- test-infra-ref : build-platform-windows
51+ test-infra-repository : pytorch /test-infra
52+ test-infra-ref : main
5253 build-matrix : ${{ needs.generate-matrix.outputs.matrix }}
5354 pre-script : packaging/pre_build_script.sh
5455 # post-script: packaging/post_build_script.sh TODO: consider enabling post-build checks for Windows
6061 # The BUILD_AGAINST_ALL_FFMPEG_FROM_S3 var, needed to build the wheel, is
6162 # set in vc_env_helper.bat Couldn't find a way to set it from here.
6263 build-command : " python -m build --wheel -vvv --no-isolation"
64+
65+ install-and-test :
66+ runs-on : windows-latest
67+ strategy :
68+ fail-fast : false
69+ matrix :
70+ python-version : ['3.10']
71+ # TODO: FFmpeg 5 on Windows segfaults in avcodec_open2() when passing
72+ # bad parameters.
73+ # See https://github.com/pytorch/torchcodec/pull/806
74+ ffmpeg-version-for-tests : ['4.4.2', '6.1.1', '7.0.1']
75+ needs : build
76+ steps :
77+ - uses : actions/download-artifact@v4
78+ with :
79+ name : pytorch_torchcodec__${{ matrix.python-version }}_cpu_x64
80+ path : pytorch/torchcodec/dist/
81+ - name : Setup conda env
82+ uses : conda-incubator/setup-miniconda@v2
83+ with :
84+ auto-update-conda : true
85+ miniconda-version : " latest"
86+ activate-environment : test
87+ python-version : ${{ matrix.python-version }}
88+ - name : Update pip
89+ run : python -m pip install --upgrade pip
90+ - name : Install PyTorch
91+ run : |
92+ python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
93+ - name : Install torchcodec from the wheel
94+ run : |
95+ wheel_path=`find pytorch/torchcodec/dist -type f -name "*.whl"`
96+ echo Installing $wheel_path
97+ python -m pip install $wheel_path -vvv
98+ - name : Check out repo
99+ uses : actions/checkout@v3
100+ - name : Install ffmpeg, post build
101+ run : |
102+ # Ideally we would have checked for that before installing the wheel,
103+ # but we need to checkout the repo to access this file, and we don't
104+ # want to checkout the repo before installing the wheel to avoid any
105+ # side-effect. It's OK.
106+ source packaging/helpers.sh
107+ assert_ffmpeg_not_installed
108+ conda install "ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" -c conda-forge
109+ ffmpeg -version
110+ - name : Test torchcodec import after FFmpeg installation
111+ run : |
112+ echo "Testing torchcodec import after FFmpeg is installed and PATH is updated..."
113+ python -c "import torchcodec; print('TorchCodec import successful!')"
114+ - name : Install test dependencies
115+ run : |
116+ # Ideally we would find a way to get those dependencies from pyproject.toml
117+ python -m pip install numpy pytest pillow
118+ - name : Delete the src/ folder just for fun
119+ run : |
120+ # The only reason we checked-out the repo is to get access to the
121+ # tests. We don't care about the rest. Out of precaution, we delete
122+ # the src/ folder to be extra sure that we're running the code from
123+ # the installed wheel rather than from the source.
124+ # This is just to be extra cautious and very overkill because a)
125+ # there's no way the `torchcodec` package from src/ can be found from
126+ # the PythonPath: the main point of `src/` is precisely to protect
127+ # against that and b) if we ever were to execute code from
128+ # `src/torchcodec`, it would fail loudly because the built .so files
129+ # aren't present there.
130+ rm -r src/
131+ ls
132+ - name : Run Python tests
133+ run : |
134+ pytest test -vvv
0 commit comments