Build the wheel, install it on a separate machine, run the tests. Profit. #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build wheel | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
concurrency: | |
group: unit-test${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_number || github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash -l -eo pipefail {0} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v3 | |
- name: Setup conda env | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
miniconda-version: "latest" | |
activate-environment: test | |
python-version: '3.8' | |
- name: Update pip | |
run: python -m pip install --upgrade pip | |
- name: Install Pytorch | |
run: | | |
python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu | |
- name: Build the torchcodec wheel | |
run: | | |
if command -v "ffmpeg" &> /dev/null | |
then | |
echo "ffmpeg is installed, but it shouldn't! Exiting!!" | |
exit 1 | |
fi | |
python -m pip install build | |
BUILD_AGAINST_ALL_FFMPEG_FROM_S3=1 python -m build . --wheel -vvv --no-isolation | |
wheel=`ls dist/*.whl` | |
unzip -l $wheel | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: the-sdist | |
path: dist/* | |
install-and-test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.8', '3.12'] | |
ffmpeg-version-for-tests: ['4.4.2', '5.1.2', '6.1.1', '7.0.1'] | |
needs: build | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: the-sdist | |
path: dist/ | |
- name: Check out repo | |
uses: actions/checkout@v3 | |
- name: Setup conda env | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
miniconda-version: "latest" | |
activate-environment: test | |
python-version: ${{ matrix.python-version }} | |
- name: Update pip | |
run: python -m pip install --upgrade pip | |
# - name: Install dependencies | |
# run: | | |
# python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu | |
- name: Install torchcodec wheel | |
run: | | |
if command -v "ffmpeg" &> /dev/null | |
then | |
echo "ffmpeg is installed, but it shouldn't! Exiting!!" | |
exit 1 | |
fi | |
echo "LS" | |
ls | |
echo "LS DIST" | |
ls dist | |
wheel=`ls dist` | |
echo Installing $wheel | |
python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu | |
python -m pip install $wheel | |
- name: Install ffmpeg, post build | |
run: | | |
conda install "ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" -c conda-forge | |
ffmpeg -version | |
- name: Install test dependencies | |
run: | | |
python -m pip install --pre torchvision --index-url https://download.pytorch.org/whl/nightly/cpu | |
python -m pip install numpy pytest pillow opencv-python | |
- name: Smoke test | |
run: | | |
python test/decoders/manual_smoke_test.py | |
# TODO: diff the output frame with its expeceted value | |
- name: Run Python tests | |
run: | | |
pytest test |