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 :
@@ -78,61 +68,97 @@ jobs:
7868 with :
7969 name : pytorch_torchcodec__${{ matrix.python-version }}_cpu_
8070 path : pytorch/torchcodec/dist/
81- - name : Setup miniconda
82- uses : pytorch/test-infra/.github/actions/setup-miniconda@macbuildwheel
71+ # # start copying from test-infra/.github/actions/setup-binary-builds/action.yaml, line 84
72+ - name : Setup miniconda (for pytorch_pkg_helpers)
73+ uses :
conda-incubator/[email protected] 8374 with :
75+ # miniconda-version: "py39_4.12.0"
76+ miniconda-version : " latest" # changed by Scott
8477 python-version : ${{ matrix.python-version }}
85- - name : Update pip
78+ - name : Clean conda environment
79+ shell : bash -l {0}
80+ run : |
81+ set -euxo pipefail
82+ conda info | grep -i 'base environment'
83+ conda clean --all --quiet --yes
84+ - name : Reset channel priority
85+ shell : bash -l {0}
8686 run : |
87- python3 -m pip install --upgrade pip
87+ set -euxo pipefail
88+ conda config --set channel_priority false
89+ - name : Generate file from pytorch_pkg_helpers
90+ working-directory : " pytorch/torchcodec"
91+ shell : bash -l {0}
92+ run : |
93+ set -euxo pipefail
94+ CONDA_ENV="${RUNNER_TEMP}/pytorch_pkg_helpers_${GITHUB_RUN_ID}"
95+ conda create \
96+ --yes --quiet \
97+ --prefix "${CONDA_ENV}" \
98+ "python=3.9"
99+ CONDA_ENV="${CONDA_ENV}"
100+ CONDA_RUN="conda run -p ${CONDA_ENV}"
101+ ${CONDA_RUN} python -m pip install ${GITHUB_WORKSPACE}/test-infra/tools/pkg-helpers
102+ BUILD_ENV_FILE="${RUNNER_TEMP}/build_env_${GITHUB_RUN_ID}"
103+ ${CONDA_RUN} python -m pytorch_pkg_helpers > "${BUILD_ENV_FILE}"
104+ cat "${BUILD_ENV_FILE}"
105+ echo "BUILD_ENV_FILE=${BUILD_ENV_FILE}" >> "${GITHUB_ENV}"
106+ - name : Setup conda environment for build
107+ shell : bash -l {0}
108+ env :
109+ PYTHON_VERSION : ${{ matrix.python-version }}
110+ run : |
111+ set -euxo pipefail
112+ CONDA_ENV="${RUNNER_TEMP}/conda_environment_${GITHUB_RUN_ID}"
113+ if [[ "${PACKAGE_TYPE:-}" == "conda" ]]; then
114+ # For conda package host python version is irrelevant
115+ export PYTHON_VERSION=3.9
116+ export CONDA_BUILD_EXTRA="conda=24.4.0 conda-build=24.3.0 python-libarchive-c=2.9"
117+ else
118+ # For wheel builds we don't need neither conda nor conda-build
119+ export CONDA_BUILD_EXTRA=""
120+ fi
121+
122+ conda create \
123+ --yes --quiet \
124+ --prefix "${CONDA_ENV}" \
125+ "python=${PYTHON_VERSION}" \
126+ cmake=3.26 \
127+ ninja=1.10 \
128+ pkg-config=0.29 \
129+ ${CONDA_BUILD_EXTRA} \
130+ wheel=0.37
131+
132+ echo "CONDA_ENV=${CONDA_ENV}" >> "${GITHUB_ENV}"
133+ echo "CONDA_RUN=conda run -p ${CONDA_ENV}" >> "${GITHUB_ENV}"
134+ # # end copying
135+ - name : Update pip
136+ run : python -m pip install --upgrade pip
88137 - name : Install PyTorch
89138 run : |
90- python3 -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
139+ ${CONDA_RUN} python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
91140 - name : Install torchcodec from the wheel
92141 run : |
93142 wheel_path=`find pytorch/torchcodec/dist -type f -name "*.whl"`
94143 echo Installing $wheel_path
95- python3 -m pip install $wheel_path -vvv
96-
144+ ${CONDA_RUN} python -m pip install $wheel_path -vvv
97145 - name : Check out repo
98146 uses : actions/checkout@v3
99147 - name : Install ffmpeg, post build
100148 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-
110149 conda install "ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" -c conda-forge
111150 ffmpeg -version
112-
113151 - name : Install test dependencies
114152 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-
153+ ${CONDA_RUN} python -m pip install --pre torchvision --index-url https://download.pytorch.org/whl/nightly/cpu
154+ ${CONDA_RUN} python -m pip install numpy pytest pillow
119155 - name : Delete the src/ folder just for fun
120156 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.
131157 rm -r src/
132158 ls
133159 - name : Smoke test
134160 run : |
135- python3 test/decoders/manual_smoke_test.py
161+ ${CONDA_RUN} python test/decoders/manual_smoke_test.py
136162 - name : Run Python tests
137163 run : |
138- pytest test
164+ ${CONDA_RUN} pytest test
0 commit comments