Skip to content

Merge pull request #703 from la-niche/dependabot/uv/uv-lock-patches-6… #2894

Merge pull request #703 from la-niche/dependabot/uv/uv-lock-patches-6…

Merge pull request #703 from la-niche/dependabot/uv/uv-lock-patches-6… #2894

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
paths-ignore:
- README.md
schedule:
# run this once a week (wednesday) at 3 am UTC
- cron: 0 3 * * 3
workflow_dispatch:
permissions: {}
jobs:
tests:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
python-version:
- '3.10'
- '3.11'
- '3.12'
- '3.13'
- '3.14'
label: ['']
include:
- os: ubuntu-22.04
python-version: '3.10'
label: (oldest-deps-minimal)
install-args: --resolution=lowest
- os: ubuntu-22.04
python-version: '3.10'
label: (oldest-deps-full)
install-args: --resolution=lowest --all-extras --compile-bytecode
- os: ubuntu-latest
python-version: '3.14'
install-args: --all-extras
label: (full)
- os: macos-latest
python-version: '3.14'
- os: windows-latest
python-version: '3.14'
name: ${{ matrix.os }}-py${{ matrix.python-version }} ${{ matrix.label }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
prune-cache: false
cache-suffix: ${{ matrix.label }}
- name: Build
run: uv sync --all-packages --group covcheck ${{ matrix.install-args }}
- name: Run pytest
shell: bash
run: uv run --no-sync coverage run --parallel-mode -m pytest --color=yes
- name: Upload coverage data
# only using reports from ubuntu because
# combining reports from multiple platforms is tricky (or impossible ?)
if: startsWith(matrix.os, 'ubuntu')
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: nonos_coverage_data-${{ matrix.os }}-${{ matrix.python-version }}${{ matrix.label }}
path: .coverage.*
if-no-files-found: ignore
include-hidden-files: true
type-check:
strategy:
matrix:
python-version:
# we do not check on 3.10 because numpy 2.2.x isn't specific enough and we'd get false positives
# - '3.10'
- '3.11'
- '3.12'
- '3.13'
- '3.14'
runs-on: ubuntu-latest
name: type-checking
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
prune-cache: false
cache-suffix: type-check
- name: Typecheck
run: |
uv run --frozen --no-editable --group typecheck mypy src
image-tests:
name: Image tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
with:
python-version: '3.13'
enable-cache: true
prune-cache: false
cache-suffix: image-test
- name: Run Image Tests
run: |
uv run --frozen --no-editable --group test \
pytest tests --color=yes --mpl -m mpl_image_compare \
--mpl-generate-summary=html \
--mpl-results-path=nonos_pytest_mpl_results \
--mpl-baseline-path=tests/pytest_mpl_baseline
- name: Generate new image baseline
if: failure()
run: |
uv run --frozen --no-editable --group test \
pytest tests --color=yes --mpl -m mpl_image_compare \
--mpl-generate-path=nonos_pytest_mpl_new_baseline \
--last-failed
# always attempt to upload artifacts, even
# (and especially) in case of failure.
- name: Upload pytest-mpl report
if: always()
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: nonos_pytest_mpl_results
path: nonos_pytest_mpl_results/*
- name: Upload pytest-mpl baseline
if: always()
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: nonos_pytest_mpl_new_baseline
path: nonos_pytest_mpl_new_baseline/*
if-no-files-found: ignore
coverage:
name: Combine coverage reports
runs-on: ubuntu-latest
needs: tests
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
with:
# Use latest Python, so it understands all syntax.
python-version: '3.13'
enable-cache: true
prune-cache: false
cache-suffix: coverage
- run: uv tool install coverage
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: nonos_coverage_data-*
merge-multiple: true
- name: Check coverage
run: |
coverage combine
coverage html --skip-covered --skip-empty
coverage report --skip-covered --format=markdown >> "$GITHUB_STEP_SUMMARY"
coverage report --fail-under=92
- name: Upload HTML report
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: nonos_coverage_report
path: htmlcov
if: ${{ always() }}
docs:
runs-on: ubuntu-latest
name: docs
concurrency:
group: ${{ github.ref }}-docs
cancel-in-progress: true
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
with:
enable-cache: true
prune-cache: false
cache-suffix: docs
- name: Build
run: |
uv run --frozen --group docs mkdocs build
- name: Upload artifacts
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: site
path: site
pre-publish-checks:
runs-on: ubuntu-latest
name: pre-publication checks
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false
- uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
with:
enable-cache: true
prune-cache: false
cache-suffix: pre-publish-checks
- run: uv run scripts/pre_publish_checks.py