fixup #309
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: Test | |
on: [push, pull_request] | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ | |
"ubuntu-20.04", | |
"macos-11", | |
] | |
python-version: [ | |
"pypy-3.7", | |
"3.10", | |
"3.9", | |
"3.8", | |
"3.7", | |
"2.7", | |
] | |
libavif-version: [ "0.11.0" ] | |
include: | |
- python-version: "3.9" | |
os: "ubuntu-20.04" | |
libavif-version: "1.0.1" | |
- python-version: "3.7" | |
PYTHONOPTIMIZE: 1 | |
- python-version: "3.8" | |
PYTHONOPTIMIZE: 2 | |
# Include new variables for Codecov | |
- os: ubuntu-20.04 | |
codecov-flag: GHA_Ubuntu | |
- os: macos-11 | |
codecov-flag: GHA_macOS | |
exclude: | |
- python-version: "2.7" | |
os: "macos-11" | |
runs-on: ${{ matrix.os }} | |
name: ${{ matrix.os }} Python ${{ matrix.python-version }} (libavif ${{ matrix.libavif-version }}) | |
container: | |
image: ${{ matrix.python-version == '2.7' && 'python:2.7-buster' || null }} | |
env: | |
LIBAVIF_VERSION: ${{ matrix.libavif-version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
if: matrix.python-version != '2.7' | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache build | |
id: build-cache | |
uses: actions/cache@v3 | |
with: | |
path: depends/libavif-${{ env.LIBAVIF_VERSION }} | |
key: | |
${{ env.LIBAVIF_VERSION }}-${{ hashFiles('.github/workflows/*.sh', '.github/workflows/test.yml', 'depends/*') }}-${{ matrix.os }} | |
- name: Install nasm | |
if: steps.build-cache.outputs.cache-hit != 'true' | |
uses: ilammy/setup-nasm@v1 | |
with: | |
version: 2.15.05 | |
- name: Install dependencies | |
run: | | |
.github/workflows/install.sh | |
env: | |
GHA_PYTHON_VERSION: ${{ matrix.python-version }} | |
- name: Test | |
run: | | |
tox | |
env: | |
PYTHONOPTIMIZE: ${{ matrix.PYTHONOPTIMIZE }} | |
- name: Prepare to upload errors | |
if: failure() | |
run: | | |
mkdir -p tests/errors | |
- name: Upload errors | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: errors | |
path: tests/errors | |
- name: Combine coverage | |
run: tox -e coverage-report | |
env: | |
CODECOV_NAME: ${{ matrix.os }} Python ${{ matrix.python-version }} | |
- name: Upload coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ./coverage.xml | |
msys: | |
runs-on: windows-latest | |
name: MinGW | |
defaults: | |
run: | |
shell: bash.exe --login -eo pipefail "{0}" | |
env: | |
MSYSTEM: MINGW64 | |
CHERE_INVOKING: 1 | |
SETUPTOOLS_USE_DISTUTILS: stdlib | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up shell | |
run: echo "C:\msys64\usr\bin\" >> $env:GITHUB_PATH | |
shell: pwsh | |
- name: Install dependencies | |
run: | | |
pacman -S --noconfirm \ | |
base-devel \ | |
git \ | |
mingw-w64-x86_64-gcc \ | |
mingw-w64-x86_64-toolchain \ | |
mingw-w64-x86_64-python3-pip \ | |
mingw-w64-x86_64-python3-setuptools \ | |
mingw-w64-x86_64-libjpeg-turbo \ | |
mingw-w64-x86_64-libtiff \ | |
mingw-w64-x86_64-libpng \ | |
mingw-w64-x86_64-openjpeg2 \ | |
mingw-w64-x86_64-zlib \ | |
mingw-w64-x86_64-libavif | |
- name: Install Dependencies | |
run: | | |
python3 -m pip install pytest pytest-cov pillow mock | |
- name: Build pillow-avif-plugin | |
run: CFLAGS="-coverage" python3 -m pip install . | |
- name: Test pillow-avif-plugin | |
run: | | |
python3 -m pytest -vx --cov pillow_avif --cov tests --cov-report term --cov-report xml tests | |
- name: Upload coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ./coverage.xml | |
flags: GHA_Windows | |
name: "MSYS2 MinGW" | |
success: | |
needs: [build, msys] | |
runs-on: ubuntu-latest | |
name: Test Successful | |
steps: | |
- name: Success | |
run: echo Test Successful |