Skip to content

Merge pull request #16 from onyphe/dependabot/github_actions/astral-s… #14

Merge pull request #16 from onyphe/dependabot/github_actions/astral-s…

Merge pull request #16 from onyphe/dependabot/github_actions/astral-s… #14

Workflow file for this run

name: CI
on:
push:
branches: [main, master]
pull_request:
workflow_dispatch:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
# Least privilege by default: no job here needs to write anything back.
permissions:
contents: read
env:
# Fail the build if uv.lock no longer matches pyproject.toml, instead of
# silently re-resolving.
UV_FROZEN: "1"
jobs:
lint:
name: Lint, types and workflow audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# Do not leave the job token behind in .git/config.
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Install the project
run: uv sync --dev
- name: Ruff (lint)
run: uv run ruff check --output-format=github .
- name: Ruff (format)
run: uv run ruff format --check --diff .
- name: Type check
run: uv run ty check
- name: Audit the workflows
run: uv run zizmor --format plain .github/workflows
test:
name: Tests py${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12", "3.13"]
exclude:
- os: macos-latest
python-version: "3.10"
- os: macos-latest
python-version: "3.11"
- os: windows-latest
python-version: "3.10"
- os: windows-latest
python-version: "3.11"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
cache-dependency-glob: "pyproject.toml"
- name: Install the project
run: uv sync --dev
- name: Pytest
run: uv run pytest -m 'not integration' --cov --cov-report=xml --cov-report=term-missing
- name: Upload coverage
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: coverage
path: coverage.xml
build:
name: Build distributions
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
- name: Build sdist and wheel
run: uv build
- name: Check metadata
run: |
uv sync --dev
uv run twine check dist/*
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: dist
path: dist/