-
Notifications
You must be signed in to change notification settings - Fork 2
127 lines (106 loc) · 3.44 KB
/
ci.yml
File metadata and controls
127 lines (106 loc) · 3.44 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
123
124
125
126
127
name: CI
permissions:
contents: read
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
FORCE_COLOR: 3
PYTHON_VERSIONS: '["3.11", "3.13", "3.14"]'
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
outputs:
python-versions: ${{ env.PYTHON_VERSIONS }}
oldest-python: ${{ steps.versions.outputs.oldest }}
newest-python: ${{ steps.versions.outputs.newest }}
steps:
- id: versions
run: |
versions='${{ env.PYTHON_VERSIONS }}'
oldest=$(echo "$versions" | jq -r '.[0]')
newest=$(echo "$versions" | jq -r '.[-1]')
echo "oldest=$oldest" >> $GITHUB_OUTPUT
echo "newest=$newest" >> $GITHUB_OUTPUT
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Install uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
- name: Install
run: uv sync --no-default-groups --group lint --locked
- name: Checks with prek
run: uv run --frozen prek run --all-files
tests:
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: [lint, setup]
strategy:
fail-fast: false
matrix:
python-version: ${{ fromJson(needs.setup.outputs.python-versions) }}
os: [ubuntu-latest]
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
python-version: ${{ matrix.python-version }}
- name: Install
run: uv sync --no-default-groups --group tests --locked
- name: Test with pytest
run: uv run --frozen pytest
oldest-supported:
name: Oldest supported deps
runs-on: ubuntu-latest
needs: [lint, setup]
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
python-version: ${{ needs.setup.outputs.oldest-python }}
- name: Install the project
run:
uv sync --no-default-groups --group tests --resolution lowest-direct
- name: Test package
run: uv run --frozen pytest
newest-supported:
name: Newest supported deps
runs-on: ubuntu-latest
needs: [lint, setup]
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
python-version: ${{ needs.setup.outputs.newest-python }}
- name: Install the project
run: uv sync --no-default-groups --group tests --upgrade
- name: Test package
run: uv run --no-sync pytest
ci-pass:
name: CI Pass
runs-on: ubuntu-latest
needs: [lint, setup, tests, oldest-supported, newest-supported]
if: always()
steps:
- name: All required jobs passed
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
with:
jobs: ${{ toJSON(needs) }}