Repository navigation
122 lines (98 loc) · 3.34 KB
/
Copy pathci.yml
File metadata and controls
122 lines (98 loc) · 3.34 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]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions: {}
env:
FORCE_COLOR: "1"
jobs:
lint:
name: Lint and type check
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
steps:
- name: Check out the repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up uv
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
- name: Install the project
run: uv sync --locked
- name: Run the pre-commit hooks
run: uv run --locked prek run --all-files --show-diff-on-failure
- name: Type check
run: uv run --locked mypy
test:
name: Test (${{ matrix.os }}, Python ${{ matrix.python-version }}, ${{ matrix.resolution }})
runs-on: ${{ matrix.os }}
timeout-minutes: 15
permissions:
contents: read
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.14", "3.15"]
resolution: [locked]
include:
# The oldest dependency versions allowed by pyproject.toml.
- os: ubuntu-latest
python-version: "3.14"
resolution: lowest-direct
# The free-threaded (no-GIL) build.
- os: ubuntu-latest
python-version: "3.14t"
resolution: locked
steps:
- name: Check out the repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up uv
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Test with the locked dependencies
if: matrix.resolution == 'locked'
run: uv run --locked --no-default-groups --group test pytest
- name: Test with the oldest allowed dependencies
if: matrix.resolution == 'lowest-direct'
run: uv run --resolution lowest-direct --no-default-groups --group test pytest
build:
name: Build distributions
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
steps:
- name: Check out the repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up uv
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
- name: Build the sdist and wheel
run: uv build --no-sources
- name: Smoke test the wheel
run: uv run --isolated --no-project --with dist/*.whl template-python CI
- name: Smoke test the sdist
run: uv run --isolated --no-project --with dist/*.tar.gz python -m template_python CI
all-green:
name: All checks passed
if: always()
needs: [lint, test, build]
runs-on: ubuntu-latest
timeout-minutes: 5
permissions: {}
steps:
- name: Fail if any required job did not succeed
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1