Skip to content

Build Mac wheels in CI #545

Build Mac wheels in CI

Build Mac wheels in CI #545

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"
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:
- name: Setup miniconda
uses: pytorch/test-infra/.github/actions/setup-miniconda@macbuildwheel
with:
python-version: ${{ matrix.python-version }}
# - name: Update conda
# run: |
# # See: https://github.com/conda/conda-libmamba-solver/issues/283#issuecomment-1949560105
# conda config --remove channels defaults
# conda config --add channels conda-forge
# conda update --all
- name: Check out torchcodec repo
uses: actions/checkout@v3
- name: Check out test-infra repo
uses: actions/checkout@v3
with:
repository: pytorch/test-infra
ref: macbuildwheel
path: test-infra
- name: Download wheel
uses: actions/download-artifact@v3
with:
name: pytorch_torchcodec__${{ matrix.python-version }}_cpu_
path: pytorch/torchcodec/dist/
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install ffmpeg
run: |
${CONDA_INSTALL} "ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" -c conda-forge
${CONDA_RUN} ffmpeg -version
- name: Install PyTorch
run: |
${CONDA_RUN} python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
- name: Install torchcodec from the wheel
run: |
${CONDA_RUN} wheel_path=`find pytorch/torchcodec/dist -type f -name "*.whl"`
${CONDA_RUN} echo Installing $wheel_path
${CONDA_RUN} python -m pip install $wheel_path -vvv
- name: Install test dependencies
run: |
${CONDA_RUN} python -m pip install --pre torchvision --index-url https://download.pytorch.org/whl/nightly/cpu
${CONDA_RUN} python -m pip install numpy pytest pillow
- name: Delete the src/ folder just for fun
run: |
rm -r src/
ls -lh
- name: Smoke test
run: |
${CONDA_RUN} python -X faulthandler test/decoders/manual_smoke_test.py
- name: Run Python tests
run: |
${CONDA_RUN} pytest test -vvv