-
-
Notifications
You must be signed in to change notification settings - Fork 95
223 lines (190 loc) · 6.06 KB
/
ci.yml
File metadata and controls
223 lines (190 loc) · 6.06 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
name: CI
on:
pull_request:
merge_group:
push:
branches:
- "main"
tags:
- "*"
env:
UV_FROZEN: "true"
jobs:
tests:
strategy:
matrix:
include:
- python-version: "3.10"
postgres-version: "14"
- python-version: "3.11"
postgres-version: "15"
- python-version: "3.12"
postgres-version: "16"
- python-version: "3.13"
postgres-version: "17"
- python-version: "3.14"
postgres-version: "18"
name: "py${{ matrix.python-version }}"
runs-on: ubuntu-latest
services:
postgres:
image: postgres:${{ matrix.postgres-version }}
# Set health checks to wait until postgres has started
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
ports:
- 5432:5432
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0 # Fetch all history for the current branch, needed for checking migrations
- name: Install the latest version of uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version: ${{ matrix.python-version }}
- name: Run tests
run: uv run pytest --cov=procrastinate --cov-branch
env:
COVERAGE_FILE: ".coverage.${{ matrix.python-version }}"
PGHOST: localhost
PGUSER: postgres
PGPASSWORD: postgres
PY_COLORS: 1
- name: Store coverage file
uses: actions/upload-artifact@v7
with:
name: coverage-${{ matrix.python-version }}
path: .coverage.${{ matrix.python-version }}
include-hidden-files: true
acceptance-tests:
strategy:
matrix:
mode:
- "current_version_without_post_migration"
- "stable_version_without_post_migration"
name: "e2e ${{ matrix.mode }}"
runs-on: ubuntu-latest
services:
postgres:
image: postgres:18
# Set health checks to wait until postgres has started
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
ports:
- 5432:5432
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Install the latest version of uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version: "3.14"
- name: Get latest tag
id: get-latest-tag
run: gh release list --limit 1 --json tagName --jq '"latest_tag="+.[0].tagName' >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run tests
run: uv run --only-group migration_test nox -s ${{ matrix.mode }}
env:
PGHOST: localhost
PGUSER: postgres
PGPASSWORD: postgres
LATEST_TAG: ${{ steps.get-latest-tag.outputs.latest_tag }}
static-typing:
name: Run type checking
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
- name: Install deps
run: uv sync --all-groups
- name: Run type checker
run: uv run basedpyright
coverage:
name: Coverage
runs-on: ubuntu-latest
needs: [tests]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions/download-artifact@v8
with:
pattern: coverage-*
merge-multiple: true
- name: Display coverage
uses: ewjoachim/python-coverage-comment-action@v3
with:
MERGE_COVERAGE_FILES: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Store Pull Request comment to be posted
uses: actions/upload-artifact@v7
with:
name: python-coverage-comment-action
path: python-coverage-comment-action.txt
benchmark:
name: Benchmark
runs-on: ubuntu-latest
permissions:
deployments: write
contents: write
services:
postgres:
image: postgres:18
# Set health checks to wait until postgres has started
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
ports:
- 5432:5432
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Install the latest version of uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version: "3.14"
- name: Run benchmarks
run: uv run pytest -m "benchmark" --benchmark-json output.json
env:
PGHOST: localhost
PGUSER: postgres
PGPASSWORD: postgres
- name: Store benchmark result
if: github.event_name == 'push' && github.ref_type == 'branch'
uses: benchmark-action/github-action-benchmark@d48d326b4ca9ba73ca0cd0d59f108f9e02a381c7 # v1
with:
name: Procrastinate Benchmarks
tool: "pytest"
output-file-path: output.json
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
publish:
name: Publish package to PyPI
if: github.event_name == 'push' && github.ref_type == 'tag'
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
needs:
- tests
- static-typing
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-tags: true
ref: ${{ github.ref }}
- name: Build wheel & sdist
run: pipx run uv build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1