Create a path toward sharing memory from a numpy buffer #857
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: tests | |
on: [push, pull_request] | |
jobs: | |
style: | |
name: "${{ matrix.config.suite }}" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
config: | |
- {suite: black} | |
- {suite: flake8} | |
- {suite: isort} | |
env: | |
PYAV_PYTHON: python3 | |
PYAV_LIBRARY: ffmpeg-4.3 # doesn't matter | |
steps: | |
- uses: actions/checkout@v3 | |
name: Checkout | |
- name: Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.7 | |
- name: Environment | |
run: env | sort | |
- name: Packages | |
run: | | |
. scripts/activate.sh | |
# A bit of a hack that we can get away with this. | |
python -m pip install ${{ matrix.config.suite }} | |
- name: "${{ matrix.config.suite }}" | |
run: | | |
. scripts/activate.sh | |
./scripts/test ${{ matrix.config.suite }} | |
nix: | |
name: "py-${{ matrix.config.python }} lib-${{ matrix.config.ffmpeg }} ${{matrix.config.os}}" | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- {os: ubuntu-latest, python: 3.7, ffmpeg: "5.1", extras: true} | |
- {os: ubuntu-latest, python: 3.7, ffmpeg: "5.0"} | |
- {os: ubuntu-latest, python: 3.7, ffmpeg: "4.4"} | |
- {os: ubuntu-latest, python: 3.7, ffmpeg: "4.3"} | |
- {os: ubuntu-latest, python: pypy3.9, ffmpeg: "4.4"} | |
- {os: macos-latest, python: 3.7, ffmpeg: "4.4"} | |
env: | |
PYAV_PYTHON: python${{ matrix.config.python }} | |
PYAV_LIBRARY: ffmpeg-${{ matrix.config.ffmpeg }} | |
steps: | |
- uses: actions/checkout@v3 | |
name: Checkout | |
- name: Python ${{ matrix.config.python }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.config.python }} | |
- name: OS Packages | |
run: | | |
case ${{ matrix.config.os }} in | |
ubuntu-latest) | |
sudo apt-get update | |
sudo apt-get install autoconf automake build-essential cmake \ | |
libtool mercurial pkg-config texinfo wget yasm zlib1g-dev | |
sudo apt-get install libass-dev libfreetype6-dev libjpeg-dev \ | |
libtheora-dev libvorbis-dev libx264-dev | |
if [[ "${{ matrix.config.extras }}" ]]; then | |
sudo apt-get install doxygen | |
fi | |
;; | |
macos-latest) | |
brew update | |
brew install automake libtool nasm pkg-config shtool texi2html wget | |
brew install libass libjpeg libpng libvorbis libvpx opus theora x264 | |
;; | |
esac | |
- name: Pip and FFmpeg | |
run: | | |
. scripts/activate.sh ffmpeg-${{ matrix.config.ffmpeg }} | |
scripts/build-deps | |
- name: Build | |
run: | | |
. scripts/activate.sh ffmpeg-${{ matrix.config.ffmpeg }} | |
scripts/build | |
- name: Test | |
run: | | |
. scripts/activate.sh ffmpeg-${{ matrix.config.ffmpeg }} | |
python -m av --version # Assert it can import. | |
scripts/test | |
- name: Docs | |
if: matrix.config.extras | |
run: | | |
. scripts/activate.sh ffmpeg-${{ matrix.config.ffmpeg }} | |
make -C docs html | |
- name: Doctest | |
if: matrix.config.extras | |
run: | | |
. scripts/activate.sh ffmpeg-${{ matrix.config.ffmpeg }} | |
scripts/test doctest | |
- name: Examples | |
if: matrix.config.extras | |
run: | | |
. scripts/activate.sh ffmpeg-${{ matrix.config.ffmpeg }} | |
scripts/test examples | |
- name: Source Distribution | |
if: matrix.config.extras | |
run: | | |
. scripts/activate.sh ffmpeg-${{ matrix.config.ffmpeg }} | |
scripts/test sdist | |
windows: | |
name: "py-${{ matrix.config.python }} lib-${{ matrix.config.ffmpeg }} ${{matrix.config.os}}" | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- {os: windows-latest, python: 3.7, ffmpeg: "5.1"} | |
- {os: windows-latest, python: 3.7, ffmpeg: "5.0"} | |
- {os: windows-latest, python: 3.7, ffmpeg: "4.4"} | |
- {os: windows-latest, python: 3.7, ffmpeg: "4.3"} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Conda | |
shell: bash | |
run: | | |
. $CONDA/etc/profile.d/conda.sh | |
conda config --set always_yes true | |
conda config --add channels conda-forge | |
conda create -q -n pyav \ | |
cython \ | |
numpy \ | |
pillow \ | |
python=${{ matrix.config.python }} \ | |
setuptools | |
if [[ "${{ matrix.config.ffmpeg }}" == "5.1" ]]; then | |
curl -L -o ffmpeg.tar.gz https://github.com/PyAV-Org/pyav-ffmpeg/releases/download/5.1.2-1/ffmpeg-win_amd64.tar.gz | |
elif [[ "${{ matrix.config.ffmpeg }}" == "5.0" ]]; then | |
curl -L -o ffmpeg.tar.gz https://github.com/PyAV-Org/pyav-ffmpeg/releases/download/5.0.1-1/ffmpeg-win_amd64.tar.gz | |
elif [[ "${{ matrix.config.ffmpeg }}" == "4.4" ]]; then | |
curl -L -o ffmpeg.tar.gz https://github.com/PyAV-Org/pyav-ffmpeg/releases/download/4.4.1-8/ffmpeg-win_amd64.tar.gz | |
else | |
conda install -q -n pyav ffmpeg=${{ matrix.config.ffmpeg }} | |
fi | |
- name: Build | |
shell: bash | |
run: | | |
. $CONDA/etc/profile.d/conda.sh | |
conda activate pyav | |
if [[ "${{ matrix.config.ffmpeg }}" != "4.3" ]]; then | |
tar -xf ffmpeg.tar.gz -C $CONDA_PREFIX/Library/ | |
fi | |
python setup.py build_ext --inplace --ffmpeg-dir=$CONDA_PREFIX/Library | |
- name: Test | |
shell: bash | |
run: | | |
. $CONDA/etc/profile.d/conda.sh | |
conda activate pyav | |
python setup.py test | |
package-source: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.7 | |
- name: Build source package | |
run: | | |
pip install cython | |
python scripts/fetch-vendor.py /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-latest | |
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@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.7 | |
- name: Set up QEMU | |
if: matrix.os == 'ubuntu-latest' | |
uses: docker/setup-qemu-action@v2 | |
- name: Install packages | |
if: matrix.os == 'macos-latest' | |
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: pip install cython && python scripts/fetch-vendor.py /tmp/vendor | |
CIBW_BEFORE_BUILD_WINDOWS: pip install cython && python scripts\fetch-vendor.py 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: cp36-* pp36-* pp38-win* *-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: cp37-* 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@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist/ | |
- name: Publish to PyPI | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} |