tests #1272
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: tests | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
jobs: | |
package-source: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.9" | |
- name: Build source package | |
run: | | |
pip install cython | |
python scripts/fetch-vendor.py --config-file scripts/ffmpeg-6.1.json /tmp/vendor | |
PKG_CONFIG_PATH=/tmp/vendor/lib/pkgconfig python setup.py sdist | |
- name: Upload source package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist/ | |
package-wheel: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: macos-latest | |
arch: arm64 | |
- os: macos-13 | |
arch: x86_64 | |
- os: ubuntu-latest | |
arch: aarch64 | |
- os: ubuntu-latest | |
arch: i686 | |
- os: ubuntu-latest | |
arch: x86_64 | |
- os: windows-latest | |
arch: AMD64 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.9" | |
- name: Set up QEMU | |
if: matrix.os == 'ubuntu-latest' | |
uses: docker/setup-qemu-action@v3 | |
- name: Install packages | |
if: matrix.os == 'macos-13' | |
run: | | |
brew update | |
brew install pkg-config | |
- name: Build wheels | |
env: | |
CIBW_ARCHS: ${{ matrix.arch }} | |
CIBW_BEFORE_ALL_LINUX: yum install -y alsa-lib libxcb | |
CIBW_BEFORE_BUILD: python scripts/fetch-vendor.py --config-file scripts/ffmpeg-6.1.json /tmp/vendor | |
CIBW_BEFORE_BUILD_WINDOWS: python scripts\fetch-vendor.py --config-file scripts\ffmpeg-6.1.json C:\cibw\vendor | |
CIBW_ENVIRONMENT_LINUX: LD_LIBRARY_PATH=/tmp/vendor/lib:$LD_LIBRARY_PATH PKG_CONFIG_PATH=/tmp/vendor/lib/pkgconfig | |
CIBW_ENVIRONMENT_MACOS: PKG_CONFIG_PATH=/tmp/vendor/lib/pkgconfig LDFLAGS=-headerpad_max_install_names | |
CIBW_ENVIRONMENT_WINDOWS: INCLUDE=C:\\cibw\\vendor\\include LIB=C:\\cibw\\vendor\\lib PYAV_SKIP_TESTS=unicode_filename | |
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: delvewheel repair --add-path C:\cibw\vendor\bin -w {dest_dir} {wheel} | |
CIBW_SKIP: "*-musllinux*" | |
CIBW_TEST_COMMAND: mv {project}/av {project}/av.disabled && python -m unittest discover -t {project} -s tests && mv {project}/av.disabled {project}/av | |
CIBW_TEST_REQUIRES: numpy | |
# skip tests when there are no binary wheels of numpy | |
CIBW_TEST_SKIP: pp* *_i686 | |
run: | | |
pip install cibuildwheel delvewheel | |
cibuildwheel --output-dir dist | |
shell: bash | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist/ | |
publish: | |
runs-on: ubuntu-latest | |
needs: [package-source, package-wheel] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist/ | |
- name: Publish to PyPI | |
if: github.event_name == 'release' && github.event.action == 'published' | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} |