| 1 |
name: CI |
| 2 |
on: |
| 3 |
push: |
| 4 |
branches: |
| 5 |
- main |
| 6 |
tags: |
| 7 |
- v* |
| 8 |
pull_request: |
| 9 |
|
| 10 |
permissions: |
| 11 |
contents: read |
| 12 |
|
| 13 |
env: |
| 14 |
UV_SYSTEM_PYTHON: 1 |
| 15 |
|
| 16 |
jobs: |
| 17 |
test: |
| 18 |
runs-on: ${{ matrix.os }} |
| 19 |
strategy: |
| 20 |
fail-fast: false |
| 21 |
matrix: |
| 22 |
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] |
| 23 |
os: [macOS-latest, ubuntu-latest, windows-latest] |
| 24 |
|
| 25 |
steps: |
| 26 |
- name: Checkout |
| 27 |
uses: actions/checkout@v4 |
| 28 |
- name: Set Up Python ${{ matrix.python-version }} |
| 29 |
uses: actions/setup-python@v5 |
| 30 |
with: |
| 31 |
python-version: ${{ matrix.python-version }} |
| 32 |
allow-prereleases: true |
| 33 |
- uses: astral-sh/setup-uv@v3 |
| 34 |
with: |
| 35 |
enable-cache: true |
| 36 |
cache-dependency-glob: pyproject.toml |
| 37 |
cache-suffix: ${{ matrix.python-version }} |
| 38 |
- name: Install |
| 39 |
run: make EXTRAS=dev install |
| 40 |
- name: Test |
| 41 |
run: make test |
| 42 |
- name: Lint |
| 43 |
run: make lint |
| 44 |
|
| 45 |
build: |
| 46 |
needs: test |
| 47 |
runs-on: ubuntu-latest |
| 48 |
steps: |
| 49 |
- uses: actions/checkout@v4 |
| 50 |
- uses: actions/setup-python@v5 |
| 51 |
with: |
| 52 |
python-version: '3.12' |
| 53 |
- uses: astral-sh/setup-uv@v3 |
| 54 |
with: |
| 55 |
enable-cache: true |
| 56 |
cache-dependency-glob: pyproject.toml |
| 57 |
- name: Install |
| 58 |
run: make EXTRAS=dev install |
| 59 |
- name: Build |
| 60 |
run: python -m build |
| 61 |
- name: Upload |
| 62 |
uses: actions/upload-artifact@v4 |
| 63 |
with: |
| 64 |
name: sdist |
| 65 |
path: dist |
| 66 |
|
| 67 |
publish: |
| 68 |
needs: build |
| 69 |
runs-on: ubuntu-latest |
| 70 |
if: startsWith(github.ref, 'refs/tags/v') |
| 71 |
permissions: |
| 72 |
id-token: write |
| 73 |
steps: |
| 74 |
- uses: actions/download-artifact@v4 |
| 75 |
with: |
| 76 |
name: sdist |
| 77 |
path: dist |
| 78 |
- uses: pypa/gh-action-pypi-publish@release/v1 |