CI #652
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: CI | |
on: | |
push: | |
pull_request: | |
release: | |
types: [published] | |
schedule: | |
# Daily at 9:21 | |
- cron: "21 9 * * *" | |
env: | |
PIP_DISABLE_PIP_VERSION_CHECK: "1" | |
PIP_NO_PYTHON_VERSION_WARNING: "1" | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- uses: pre-commit/action@v3.0.1 | |
list: | |
runs-on: ubuntu-latest | |
outputs: | |
noxenvs: ${{ steps.noxenvs-matrix.outputs.noxenvs }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up nox | |
uses: wntrblm/nox@2024.03.02 | |
- id: noxenvs-matrix | |
run: | | |
echo >>$GITHUB_OUTPUT noxenvs=$( | |
nox --list-sessions --json | jq '[.[].session]' | |
) | |
ci: | |
needs: list | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest, ubuntu-latest] | |
noxenv: ${{ fromJson(needs.list.outputs.noxenvs) }} | |
posargs: [""] | |
include: | |
- os: ubuntu-latest | |
noxenv: tests-3.11 | |
posargs: coverage github | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get install -y libenchant-2-dev | |
if: runner.os == 'Linux' && startsWith(matrix.noxenv, 'docs') | |
- name: Install dependencies | |
run: brew install enchant | |
if: runner.os == 'macOS' && startsWith(matrix.noxenv, 'docs') | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: | | |
3.10 | |
3.11 | |
3.12 | |
pypy3.10 | |
allow-prereleases: true | |
- name: Set up nox | |
uses: wntrblm/nox@2024.03.02 | |
- name: Install libavif | |
run: > | |
curl -L 'https://github.com/AOMediaCodec/libavif/archive/v0.11.1.tar.gz' | tar xzf - && | |
cd libavif* && | |
mkdir build && cd build && | |
cmake .. && | |
make -j $(($(nproc) + 1)) && | |
sudo make install | |
- name: Add /usr/local/lib to LD_LIBRARY_PATH | |
run: echo 'LD_LIBRARY_PATH=/usr/local/lib' >>$GITHUB_ENV | |
- name: Run nox | |
run: nox -s "${{ matrix.noxenv }}" -- ${{ matrix.posargs }} | |
packaging: | |
needs: ci | |
runs-on: ubuntu-latest | |
environment: | |
name: PyPI | |
url: https://pypi.org/p/avif | |
permissions: | |
contents: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install libavif | |
run: > | |
curl -L 'https://github.com/AOMediaCodec/libavif/archive/v0.11.1.tar.gz' | tar xzf - && | |
cd libavif* && | |
mkdir build && cd build && | |
cmake .. && | |
make -j $(($(nproc) + 1)) && | |
sudo make install | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Install dependencies | |
run: python -m pip install build | |
- name: Create packages | |
run: python -m build . | |
- name: Publish to PyPI | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
- name: Create a Release | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
dist/* | |
generate_release_notes: true |