5454 build-platform : " python-build-package"
5555 build-command : " BUILD_AGAINST_ALL_FFMPEG_FROM_S3=1 ${CONDA_RUN} python3 -m build --wheel -vvv --no-isolation"
5656
57- validate-binaries :
58- uses : pytorch/test-infra/.github/workflows/validate-domain-library.yml@main
59- with :
60- package_type : " wheel"
61- os : " macos-arm64"
62- channel : " nightly"
63- repository : " pytorch/torchcodec"
64- smoke_test : " source ./packaging/validate_wheel.sh"
65- install_torch : true
66-
6757 install-and-test :
6858 runs-on : macos-m1-stable
6959 strategy :
@@ -82,57 +72,107 @@ jobs:
8272 uses : pytorch/test-infra/.github/actions/setup-miniconda@macbuildwheel
8373 with :
8474 python-version : ${{ matrix.python-version }}
85- - name : Update pip
75+ - name : Check out torchcodec repo
76+ uses : actions/checkout@v3
77+ - name : Check out tet-infra repo
78+ uses : actions/checkout@v3
79+ with :
80+ repository : pytorch/test-infra
81+ ref : macbuildwheel
82+ path : test-infra
83+
84+ # # start copying from test-infra/.github/actions/setup-binary-builds/action.yaml
85+ - name : Clean conda environment
86+ shell : bash -l {0}
87+ run : |
88+ set -euxo pipefail
89+ conda info | grep -i 'base environment'
90+ conda clean --all --quiet --yes
91+ - name : Reset channel priority
92+ shell : bash -l {0}
93+ run : |
94+ set -euxo pipefail
95+ conda config --set channel_priority false
96+ - name : Discover dir structure
97+ shell : bash -l {0}
98+ run : |
99+ echo "pwd"
100+ pwd
101+ echo "ls -lh"
102+ ls -lh
103+ - name : Generate file from pytorch_pkg_helpers
104+ # below does not seem necessary in our context
105+ # working-directory: "pytorch/torchcodec"
106+ shell : bash -l {0}
107+ run : |
108+ set -euxo pipefail
109+ CONDA_ENV="${RUNNER_TEMP}/pytorch_pkg_helpers_${GITHUB_RUN_ID}"
110+ conda create \
111+ --yes --quiet \
112+ --prefix "${CONDA_ENV}" \
113+ "python=3.9"
114+ CONDA_ENV="${CONDA_ENV}"
115+ CONDA_RUN="conda run -p ${CONDA_ENV}"
116+ ${CONDA_RUN} python -m pip install ${GITHUB_WORKSPACE}/test-infra/tools/pkg-helpers
117+ BUILD_ENV_FILE="${RUNNER_TEMP}/build_env_${GITHUB_RUN_ID}"
118+ ${CONDA_RUN} python -m pytorch_pkg_helpers > "${BUILD_ENV_FILE}"
119+ cat "${BUILD_ENV_FILE}"
120+ echo "BUILD_ENV_FILE=${BUILD_ENV_FILE}" >> "${GITHUB_ENV}"
121+ - name : Setup conda environment for build
122+ shell : bash -l {0}
123+ env :
124+ PYTHON_VERSION : ${{ matrix.python-version }}
86125 run : |
87- python3 -m pip install --upgrade pip
126+ set -euxo pipefail
127+ CONDA_ENV="${RUNNER_TEMP}/conda_environment_${GITHUB_RUN_ID}"
128+ if [[ "${PACKAGE_TYPE:-}" == "conda" ]]; then
129+ # For conda package host python version is irrelevant
130+ export PYTHON_VERSION=3.9
131+ export CONDA_BUILD_EXTRA="conda=24.4.0 conda-build=24.3.0 python-libarchive-c=2.9"
132+ else
133+ # For wheel builds we don't need neither conda nor conda-build
134+ export CONDA_BUILD_EXTRA=""
135+ fi
136+
137+ conda create \
138+ --yes --quiet \
139+ --prefix "${CONDA_ENV}" \
140+ "python=${PYTHON_VERSION}" \
141+ cmake=3.26 \
142+ ninja=1.10 \
143+ pkg-config=0.29 \
144+ ${CONDA_BUILD_EXTRA} \
145+ wheel=0.37
146+
147+ echo "CONDA_ENV=${CONDA_ENV}" >> "${GITHUB_ENV}"
148+ echo "CONDA_RUN=conda run -p ${CONDA_ENV}" >> "${GITHUB_ENV}"
149+ # # end copying
150+
151+ - name : Update pip
152+ run : python -m pip install --upgrade pip
88153 - name : Install PyTorch
89154 run : |
90- python3 -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
155+ ${CONDA_RUN} python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
91156 - name : Install torchcodec from the wheel
92157 run : |
93158 wheel_path=`find pytorch/torchcodec/dist -type f -name "*.whl"`
94159 echo Installing $wheel_path
95- python3 -m pip install $wheel_path -vvv
96-
97- - name : Check out repo
98- uses : actions/checkout@v3
160+ ${CONDA_RUN} python -m pip install $wheel_path -vvv
99161 - name : Install ffmpeg, post build
100162 run : |
101- # Ideally we would have checked for that before installing the wheel,
102- # but we need to checkout the repo to access this file, and we don't
103- # want to checkout the repo before installing the wheel to avoid any
104- # side-effect. It's OK.
105- source packaging/helpers.sh
106-
107- # below was failing, but when I just try to call "ffmpeg -version" that also fails?
108- #assert_ffmpeg_not_installed
109-
110163 conda install "ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" -c conda-forge
111164 ffmpeg -version
112-
113165 - name : Install test dependencies
114166 run : |
115- python3 -m pip install --pre torchvision --index-url https://download.pytorch.org/whl/nightly/cpu
116- # Ideally we would find a way to get those dependencies from pyproject.toml
117- python3 -m pip install numpy pytest pillow
118-
167+ ${CONDA_RUN} python -m pip install --pre torchvision --index-url https://download.pytorch.org/whl/nightly/cpu
168+ ${CONDA_RUN} python -m pip install numpy pytest pillow
119169 - name : Delete the src/ folder just for fun
120170 run : |
121- # The only reason we checked-out the repo is to get access to the
122- # tests. We don't care about the rest. Out of precaution, we delete
123- # the src/ folder to be extra sure that we're running the code from
124- # the installed wheel rather than from the source.
125- # This is just to be extra cautious and very overkill because a)
126- # there's no way the `torchcodec` package from src/ can be found from
127- # the PythonPath: the main point of `src/` is precisely to protect
128- # against that and b) if we ever were to execute code from
129- # `src/torchcodec`, it would fail loudly because the built .so files
130- # aren't present there.
131171 rm -r src/
132172 ls
133173 - name : Smoke test
134174 run : |
135- python3 test/decoders/manual_smoke_test.py
175+ ${CONDA_RUN} python test/decoders/manual_smoke_test.py
136176 - name : Run Python tests
137177 run : |
138- pytest test
178+ ${CONDA_RUN} pytest test
0 commit comments