Add HEIC decoder #2830
Workflow file for this run
This file contains hidden or 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: Windows CPU | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - nightly | |
| - main | |
| - release/* | |
| tags: | |
| - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.ref_type == 'branch' && github.sha }}-${{ github.event_name == 'workflow_dispatch' }} | |
| cancel-in-progress: true | |
| permissions: | |
| id-token: write | |
| contents: write | |
| defaults: | |
| run: | |
| shell: bash -l -eo pipefail {0} | |
| jobs: | |
| generate-matrix: | |
| uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main | |
| with: | |
| package-type: wheel | |
| os: windows | |
| test-infra-repository: pytorch/test-infra | |
| test-infra-ref: main | |
| with-xpu: disable | |
| with-rocm: disable | |
| with-cuda: disable | |
| build-python-only: "disable" | |
| python-versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]' | |
| build: | |
| needs: generate-matrix | |
| strategy: | |
| fail-fast: false | |
| name: Build and Upload wheel | |
| uses: pytorch/test-infra/.github/workflows/build_wheels_windows.yml@main | |
| with: | |
| repository: meta-pytorch/torchcodec | |
| ref: "" | |
| test-infra-repository: pytorch/test-infra | |
| test-infra-ref: main | |
| build-matrix: ${{ needs.generate-matrix.outputs.matrix }} | |
| pre-script: packaging/pre_build_script.sh | |
| # Via `bash` because vc_env_helper.bat runs the post-script in cmd. | |
| post-script: bash packaging/post_build_script.sh | |
| env-script: packaging/vc_env_helper.bat | |
| smoke-test-script: packaging/fake_smoke_test.py | |
| package-name: torchcodec | |
| trigger-event: ${{ github.event_name }} | |
| build-platform: "python-build-package" | |
| # The BUILD_AGAINST_ALL_FFMPEG_FROM_S3 var, needed to build the wheel, is | |
| # set in vc_env_helper.bat Couldn't find a way to set it from here. | |
| build-command: "python -m build --wheel -vvv --no-isolation" | |
| install-and-test: | |
| runs-on: windows-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ['3.10'] | |
| # TODO: FFmpeg 5 on Windows segfaults in avcodec_open2() when passing | |
| # bad parameters. | |
| # See https://github.com/pytorch/torchcodec/pull/806 | |
| ffmpeg-version-for-tests: ['4', '6', '7', '8'] | |
| needs: build | |
| steps: | |
| - name: Check out repo | |
| uses: actions/checkout@v6 | |
| - name: Remove src/ folder | |
| run: bash packaging/remove_src.sh | |
| - name: Setup conda env | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| auto-update-conda: true | |
| # Using miniforge instead of miniconda ensures that the default | |
| # conda channel is conda-forge instead of main/default. This ensures | |
| # ABI consistency between dependencies: | |
| # https://conda-forge.org/docs/user/transitioning_from_defaults/ | |
| miniforge-version: latest | |
| activate-environment: test | |
| python-version: ${{ matrix.python-version }} | |
| - name: Update pip | |
| run: python -m pip install --upgrade pip | |
| - name: Install PyTorch | |
| run: bash packaging/install_pytorch.sh cpu "torch torchvision" | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: meta-pytorch_torchcodec__${{ matrix.python-version }}_cpu_x64 | |
| path: dist/ | |
| - name: Install torchcodec from the wheel | |
| run: bash packaging/install_torchcodec_wheel.sh | |
| - name: Install ffmpeg, post build | |
| # need -l for conda to be exposed | |
| run: bash -l packaging/install_ffmpeg.sh ${{ matrix.ffmpeg-version-for-tests }} | |
| # -l exposes conda (the plain-bash shell here has no conda on PATH). The | |
| # ffmpeg version lets install_test_dependencies.sh install libheif (the | |
| # optional HEIC runtime dep) into the same env and set FAIL_WITHOUT_HEIC | |
| # (skipped on FFmpeg 4; the HEIC-exercising full suite only runs on FFmpeg | |
| # 8 below). On Windows load_heic_library() finds libheif.dll via | |
| # os.add_dll_directory($CONDA_PREFIX/Library/bin). | |
| - name: Install test dependencies | |
| run: bash -l packaging/install_test_dependencies.sh ${{ matrix.ffmpeg-version-for-tests }} | |
| - name: Run Python smoke tests | |
| run: | | |
| FAIL_WITHOUT_JPEG=1 FAIL_WITHOUT_PNG=1 FAIL_WITHOUT_WEBP=1 FAIL_WITHOUT_AVIF=1 pytest --override-ini="addopts=-v" test/smoke_test.py --tb=short | |
| - name: Run Python tests | |
| if: ${{ matrix.ffmpeg-version-for-tests == '8' && !startsWith(github.ref, 'refs/heads/release/') }} | |
| run: | | |
| FAIL_WITHOUT_JPEG=1 FAIL_WITHOUT_PNG=1 FAIL_WITHOUT_WEBP=1 FAIL_WITHOUT_AVIF=1 pytest --override-ini="addopts=-v" test |