1- name : Build and test MacOS
1+ name : Build and test MacOS wheel
22
33on :
44 pull_request :
@@ -24,15 +24,54 @@ defaults:
2424 shell : bash -l -eo pipefail {0}
2525
2626jobs :
27+
28+ generate-matrix :
29+ uses : pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
30+ with :
31+ package-type : wheel
32+ os : macos-arm64
33+ test-infra-repository : pytorch/test-infra
34+ test-infra-ref : main
35+ with-xpu : disable
36+ with-rocm : disable
37+ with-cuda : disable
38+ build-python-only : " disable"
39+
40+ build :
41+ needs : generate-matrix
42+ strategy :
43+ fail-fast : false
44+ name : Build and Upload Mac wheel
45+ uses : pytorch/test-infra/.github/workflows/build_wheels_macos.yml@main
46+ with :
47+ repository : pytorch/torchcodec
48+ ref : " "
49+ test-infra-repository : pytorch/test-infra
50+ test-infra-ref : main
51+ build-matrix : ${{ needs.generate-matrix.outputs.matrix }}
52+ post-script : packaging/post_build_script.sh
53+ smoke-test-script : packaging/fake_smoke_test.py
54+ runner-type : macos-m1-stable
55+ package-name : torchcodec
56+ trigger-event : ${{ github.event_name }}
57+ build-platform : " python-build-package"
58+ build-command : " BUILD_AGAINST_ALL_FFMPEG_FROM_S3=1 python -m build --wheel -vvv --no-isolation"
59+
2760 install-and-test :
28- runs-on : macos-m1-stable
61+ runs-on : macos-14-xlarge
2962 strategy :
3063 fail-fast : false
3164 matrix :
3265 python-version : ['3.9']
3366 ffmpeg-version-for-tests : ['4.4.2', '5.1.2', '6.1.1', '7.0.1']
34- if : ${{ always() }}
67+ needs : build
3568 steps :
69+ - name : Download wheel
70+ uses : actions/download-artifact@v3
71+ with :
72+ name : pytorch_torchcodec__${{ matrix.python-version }}_cpu_
73+ path : pytorch/torchcodec/dist/
74+
3675 - name : Setup conda env
3776 uses : conda-incubator/setup-miniconda@v3
3877 with :
@@ -42,36 +81,49 @@ jobs:
4281 python-version : ${{ matrix.python-version }}
4382 - name : Update pip
4483 run : python -m pip install --upgrade pip
84+
4585 - name : Install PyTorch
4686 run : |
4787 python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
48- - name : Check out repo
88+
89+ - name : Install torchcodec from the wheel
90+ run : |
91+ wheel_path=`find pytorch/torchcodec/dist -type f -name "*.whl"`
92+ echo Installing $wheel_path
93+ python -m pip install $wheel_path -vvv
94+
95+ - name : Check out torchcodec repo
4996 uses : actions/checkout@v3
50- - name : Install compile from source dependencies
97+
98+ - name : Install ffmpeg
5199 run : |
52- conda install cmake pkg-config -c conda-forge
100+ conda install "ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" -c conda-forge
101+ ffmpeg -version
102+
53103 - name : Install test dependencies
54104 run : |
55105 python -m pip install --pre torchvision --index-url https://download.pytorch.org/whl/nightly/cpu
56- # Ideally we would find a way to get those dependencies from pyproject.toml
57106 python -m pip install numpy pytest pillow
58- - name : Install torchcodec from source, building against non-GPL FFmpeg
59- run : |
60- BUILD_AGAINST_ALL_FFMPEG_FROM_S3=1 pip install -e ".[dev]" --no-build-isolation
61- - name : Install ffmpeg, post build
107+
108+ - name : Delete the src/ folder just for fun
62109 run : |
63- # Ideally we would have checked for that before installing the wheel,
64- # but we need to checkout the repo to access this file, and we don't
65- # want to checkout the repo before installing the wheel to avoid any
66- # side-effect. It's OK.
67- source packaging/helpers.sh
68- assert_ffmpeg_not_installed
110+ # The only reason we checked-out the repo is to get access to the
111+ # tests. We don't care about the rest. Out of precaution, we delete
112+ # the src/ folder to be extra sure that we're running the code from
113+ # the installed wheel rather than from the source.
114+ # This is just to be extra cautious and very overkill because a)
115+ # there's no way the `torchcodec` package from src/ can be found from
116+ # the PythonPath: the main point of `src/` is precisely to protect
117+ # against that and b) if we ever were to execute code from
118+ # `src/torchcodec`, it would fail loudly because the built .so files
119+ # aren't present there.
120+ rm -r src/
121+ ls -lh
69122
70- conda install "ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" -c conda-forge
71- ffmpeg -version
72123 - name : Smoke test
73124 run : |
74- python test/decoders/manual_smoke_test.py
125+ python -X faulthandler test/decoders/manual_smoke_test.py
126+
75127 - name : Run Python tests
76128 run : |
77129 pytest test -vvv
0 commit comments