Skip to content

chore: simpler nox file by a bit (#924) #2631

chore: simpler nox file by a bit (#924)

chore: simpler nox file by a bit (#924) #2631

Workflow file for this run

name: CI
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
- v[0123456789]*
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
FORCE_COLOR: 3
jobs:
lint:
name: Format
runs-on: ubuntu-latest
timeout-minutes: 8
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: astral-sh/setup-uv@v3
- name: Install nox
run: uv tool install nox
- uses: pre-commit/action@v3.0.1
with:
extra_args: --all-files
- name: Run PyLint
run: nox -s pylint -- --output-format=github
- name: Run nox generator
run: |
nox -t gen
git diff --exit-code
checks:
name:
🐍 ${{ matrix.python-version }} • CMake ${{ matrix.cmake-version }}
on ${{ matrix.runs-on }}
runs-on: ${{ matrix.runs-on }}
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "pypy-3.9", "3.12", "3.13"]
runs-on: [ubuntu-latest, macos-13]
cmake-version: ["3.15.x"]
include:
- python-version: "3.7"
runs-on: windows-2022
cmake-version: "3.21.x"
- python-version: "pypy-3.8"
runs-on: windows-2022
cmake-version: "3.21.x"
- python-version: "3.11"
runs-on: windows-2022
cmake-version: "3.26.x"
- python-version: "pypy-3.7"
runs-on: ubuntu-latest
cmake-version: "3.15.x"
- python-version: "pypy-3.10"
runs-on: ubuntu-latest
cmake-version: "3.15.x"
- python-version: "3.8"
runs-on: ubuntu-latest
cmake-version: "3.21.x"
- python-version: "3.9"
runs-on: ubuntu-latest
cmake-version: "3.20.x"
- python-version: "3.9"
runs-on: macos-13
cmake-version: "3.18.x"
- python-version: "3.12"
runs-on: macos-14
cmake-version: "3.29.x"
- python-version: "3.10"
runs-on: ubuntu-latest
cmake-version: "3.22.x"
- python-version: "3.11"
runs-on: ubuntu-latest
cmake-version: "3.26.x"
- python-version: "3.8"
runs-on: windows-2019
cmake-version: "3.24.x"
- python-version: "3.12"
runs-on: windows-latest
cmake-version: "3.26.x"
- python-version: "3.13"
runs-on: windows-latest
cmake-version: "3.26.x"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- uses: astral-sh/setup-uv@v3
if:
matrix.python-version != '3.7' && matrix.python-version != 'pypy-3.8'
&& matrix.python-version != 'pypy-3.7'
- name: Install package (uv)
if:
matrix.python-version != '3.7' && matrix.python-version != 'pypy-3.8'
&& matrix.python-version != 'pypy-3.7'
run:
uv pip install
-e.[test,test-meta,test-numpy,test-schema,test-hatchling,wheels,cov,wheel-free-setuptools]
--system
- name: Install package (pip)
if:
matrix.python-version == '3.7' || matrix.python-version == 'pypy-3.8'
|| matrix.python-version == 'pypy-3.7'
run: pip install -e.[test,test-meta,test-numpy,test-schema,wheels,cov,wheel-free-setuptools]
- name: Test package
if: "!contains(matrix.python_version, 'pypy')"
run: >-
pytest -ra --showlocals --cov --cov-report=xml --cov-report=term
--durations=20
- name: Test package (two attempts)
uses: nick-fields/retry@v3
if: "contains(matrix.python_version, 'pypy')"
with:
max_attempts: 2
retry_on: error
timeout_seconds: 5
command: >-
pytest -ra --showlocals --cov --cov-report=xml --cov-report=term
--durations=20
- name: Upload coverage report
uses: codecov/codecov-action@v4
with:
name:
${{ runner.os }}-${{ matrix.python-version }}-${{
matrix.cmake-version }}
verbose: true
token: 6d9cc0e0-158a-41ee-b8f4-0318d3595ac2
min:
name: Min 🐍 ${{ matrix.python-version }} on ${{ matrix.runs-on }}
runs-on: ${{ matrix.runs-on }}
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.11"]
runs-on: [ubuntu-latest, macos-13, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: astral-sh/setup-uv@v3
# The min requirements are not compatible with some of the extra test
# deps, so limit to just built-in deps.
- name: Install extra helpers
run: uv pip install ninja --system
- name: Install min requirements
run: |
uv pip install -e .[test,pyproject] --resolution=lowest-direct --system
- name: Setup CMake 3.15
uses: jwlawson/actions-setup-cmake@v2.0
if: runner.os != 'Windows'
with:
cmake-version: "3.15.x"
# First version to support VS 17.0
- name: Setup CMake 3.21
uses: jwlawson/actions-setup-cmake@v2.0
if: runner.os == 'Windows'
with:
cmake-version: "3.21.x"
- name: Show installed packages
run: pip list
- name: Test min package
run: pytest -ra --showlocals -Wdefault
manylinux:
name: Manylinux on 🐍 3.13 • Free-threaded
runs-on: ubuntu-latest
timeout-minutes: 40
container: quay.io/pypa/musllinux_1_2_x86_64:latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare venv
run: python3.13t -m venv /venv
- name: Install deps
run: /venv/bin/pip install -e .[test] ninja
- name: Test package
run: /venv/bin/pytest
cygwin:
name: Tests on 🐍 3.9 • cygwin
runs-on: windows-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: cygwin/cygwin-install-action@v4
with:
platform: x86_64
packages:
cmake ninja git make gcc-g++ python39 python39-devel python39-pip
- name: Install
run: python3.9 -m pip install .[test]
- name: Test package
run:
python3.9 -m pytest -ra --showlocals -m "not virtualenv"
--durations=20
msys:
name: Tests on 🐍 3 • msys UCRT
runs-on: windows-latest
timeout-minutes: 30
defaults:
run:
shell: msys2 {0}
steps:
- uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
path-type: minimal
update: true
install: >-
base-devel git
pacboy: >-
python:p python-pip:p gcc:p cmake:p
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install
run: python -m pip install .[test]
- name: Test package
run: >-
python -m pytest -ra --showlocals -m "not broken_on_urct"
--durations=20
mingw64:
name: Tests on 🐍 3 • mingw64
runs-on: windows-latest
timeout-minutes: 30
defaults:
run:
shell: msys2 {0}
steps:
- uses: msys2/setup-msys2@v2
with:
msystem: mingw64
path-type: minimal
update: true
install: >-
base-devel git
pacboy: >-
python:p python-pip:p gcc:p cmake:p
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install
run: python -m pip install .[test]
- name: Test package
run: >-
python -m pytest -ra --showlocals -m "not setuptools" --durations=20
env:
SETUPTOOLS_USE_DISTUTILS: "local"
dist:
name: Distribution build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: hynek/build-and-inspect-python-package@v2
docs:
name: Docs on ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
runs-on: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.runs-on }}
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: astral-sh/setup-uv@v3
- uses: wntrblm/nox@2024.04.15
with:
python-versions: "3.12"
- name: Linkcheck
run: nox -s docs -- -b linkcheck
- name: Manpage
run: nox -s docs -- -b man -W
- name: Build docs with warnings as errors
run: nox -s docs -- -W
- name: Check examples
run: nox -s test_doc_examples
- name: Verify no changes required to API docs
run: |
nox -s build_api_docs
git diff --exit-code
pass:
if: always()
needs: [lint, checks, min, cygwin, dist, docs]
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}