-
Notifications
You must be signed in to change notification settings - Fork 4
122 lines (101 loc) · 3.35 KB
/
Copy pathci.yml
File metadata and controls
122 lines (101 loc) · 3.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
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:
# hatch-vcs needs the tags to compute the version.
fetch-depth: 0
# 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:
fetch-depth: 0
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:
fetch-depth: 0
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/