Skip to content

Build Mac wheels in CI #398

Build Mac wheels in CI

Build Mac wheels in CI #398

Workflow file for this run

name: Build and test MacOS wheels
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@macbuildwheel
with:
package-type: wheel
os: macos-arm64
test-infra-repository: pytorch/test-infra
test-infra-ref: main
with-xpu: disable
with-rocm: disable
with-cuda: disable
build:
needs: generate-matrix
strategy:
fail-fast: false
name: Build and Upload Mac wheel
uses: pytorch/test-infra/.github/workflows/build_wheels_macos.yml@macbuildwheel
with:
repository: pytorch/torchcodec
ref: ""
test-infra-repository: pytorch/test-infra
test-infra-ref: macbuildwheel
build-matrix: ${{ needs.generate-matrix.outputs.matrix }}
post-script: packaging/post_build_script.sh
smoke-test-script: packaging/fake_smoke_test.py
runner-type: macos-m1-stable
package-name: torchcodec
trigger-event: ${{ github.event_name }}
build-platform: "python-build-package"
build-command: "BUILD_AGAINST_ALL_FFMPEG_FROM_S3=1 ${CONDA_RUN} python3 -m build --wheel -vvv --no-isolation"
validate-binaries:
needs: build
uses: pytorch/test-infra/.github/workflows/validate-domain-library.yml@main
with:
package_type: "wheel"
os: "macos-arm64"
channel: "nightly"
repository: "pytorch/torchcodec"
smoke_test: "source ./packaging/validate_wheel.sh"
install_torch: true
# install-and-test:
# runs-on: macos-m1-stable
# strategy:
# fail-fast: false
# matrix:
# python-version: ['3.9']
# ffmpeg-version-for-tests: ['4.4.2', '5.1.2', '6.1.1', '7.0.1']
# if: ${{ always() }}
# needs: build
# steps:
# - uses: actions/download-artifact@v3
# with:
# name: pytorch_torchcodec__${{ matrix.python-version }}_cpu_
# path: pytorch/torchcodec/dist/
# - name: Setup miniconda
# uses: pytorch/test-infra/.github/actions/setup-miniconda@macbuildwheel
# with:
# python-version: ${{ matrix.python-version }}
# - name: Update pip
# run: |
# python3 -m pip install --upgrade pip
# - name: Install PyTorch
# run: |
# python3 -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
# - name: Install torchcodec from the wheel
# run: |
# wheel_path=`find pytorch/torchcodec/dist -type f -name "*.whl"`
# echo Installing $wheel_path
# python3 -m pip install $wheel_path -vvv
#
# - name: Check out repo
# uses: actions/checkout@v3
# - name: Install ffmpeg, post build
# run: |
# # Ideally we would have checked for that before installing the wheel,
# # but we need to checkout the repo to access this file, and we don't
# # want to checkout the repo before installing the wheel to avoid any
# # side-effect. It's OK.
# source packaging/helpers.sh
#
# # below was failing, but when I just try to call "ffmpeg -version" that also fails?
# #assert_ffmpeg_not_installed
#
# conda install "ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" -c conda-forge
# ffmpeg -version
#
# - name: Install test dependencies
# run: |
# python3 -m pip install --pre torchvision --index-url https://download.pytorch.org/whl/nightly/cpu
# # Ideally we would find a way to get those dependencies from pyproject.toml
# python3 -m pip install numpy pytest pillow
#
# - name: Delete the src/ folder just for fun
# run: |
# # The only reason we checked-out the repo is to get access to the
# # tests. We don't care about the rest. Out of precaution, we delete
# # the src/ folder to be extra sure that we're running the code from
# # the installed wheel rather than from the source.
# # This is just to be extra cautious and very overkill because a)
# # there's no way the `torchcodec` package from src/ can be found from
# # the PythonPath: the main point of `src/` is precisely to protect
# # against that and b) if we ever were to execute code from
# # `src/torchcodec`, it would fail loudly because the built .so files
# # aren't present there.
# rm -r src/
# ls
# - name: Smoke test
# run: |
# python3 test/decoders/manual_smoke_test.py
# - name: Run Python tests
# run: |
# pytest test -vvv