-
Notifications
You must be signed in to change notification settings - Fork 36
226 lines (211 loc) · 7.21 KB
/
Copy pathchecks.yml
File metadata and controls
226 lines (211 loc) · 7.21 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
224
225
226
name: Checks
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
env:
RUST_BACKTRACE: 1
# We rely on setup-python action to install Python,
# because it does better caching and works with 32-bit Python on Windows.
UV_PYTHON_DOWNLOADS: never
UV_NO_MANAGED_PYTHON: "true"
jobs:
test-rust:
name: Test Rust (internal tests)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: "1.93"
# even though we only test rust, we need CPython to link against
- uses: actions/setup-python@v7
with:
python-version: "3.14"
- name: Build and test
run: |
cargo test
test-rust-ext:
name: Test ubuntu, ${{ matrix.python-version }} Rust extension
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [
# NOTE: 3.10, 3.14t are absent since we test them in the OS job matrix
"3.11",
"3.12",
"3.13",
"3.14",
"3.15",
"3.15t"
]
steps:
- uses: actions/checkout@v7
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: "1.93"
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
# Testing without integrations (e.g. pydantic, time_machine) to ensure there's no accidental dependency on them
- name: Test (debug, no dependency integrations)
shell: bash
run: |
uv sync --locked --group test
uv run pytest tests/ -s -v
# Testing with integrations to ensure they work
- name: Test (debug, all dependency integrations)
if: ${{ matrix.python-version != '3.15' && matrix.python-version != '3.15t' }}
shell: bash
run: |
uv sync --locked --group test --group integrations
uv run pytest tests/ -s -v
# Release mode sometimes surfaces issues not seen in debug
- name: Test (release mode)
shell: bash
run: |
uv sync --locked --reinstall-package whenever --no-editable --group test
uv run pytest tests/ -s -v
- run: |
sudo apt-get install -y tzdata # for the zdump command
uv run python scripts/smoketest_*.py
test-os:
name: Test ${{ matrix.os }}, ${{matrix.python-version}} ${{ matrix.no_build_ext && 'pure Python' || 'Rust extension' }} ${{ matrix.architecture }}
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
no_build_ext: ["", "1"]
architecture: [null]
# To keep the matrix size reasonable, we only test oldest and newest Python versions on each OS.
python-version: ["3.10", "3.14t"]
include:
# For windows, we also test 32-bit Python
- os: windows
architecture: x86
no_build_ext: ""
steps:
- uses: actions/checkout@v7
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: "1.93"
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78
- name: Add win32 target
if: ${{ matrix.os == 'windows' && matrix.architecture == 'x86' }}
run: rustup target add i686-pc-windows-msvc
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
- name: Sync Python environment
run: uv sync --locked --group test
env:
WHENEVER_NO_BUILD_RUST_EXT: ${{ matrix.no_build_ext }}
- name: Install and test
shell: bash
run: |
uv run pytest tests/ -s -v
# NOTE: yes, we test twice: once with optional deps, once without
uv sync --locked --group test --group integrations
uv run pytest tests/ -s -v
env:
WHENEVER_NO_BUILD_RUST_EXT: ${{ matrix.no_build_ext }}
test-pure-python:
name: Test ubuntu, ${{ matrix.python-version }} pure Python
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [
# NOTE: 3.10, 3.14t are absent since we test them in the OS job matrix
"3.11",
"3.12",
"3.13",
"3.14",
"3.15",
"3.15t",
"pypy3.11"
]
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Sync Python environment
run: uv sync --locked --group test
env:
WHENEVER_NO_BUILD_RUST_EXT: "1"
# NOTE: we end up running pytest twice in the following sections.
# This is because we want to test the code with and without optional dependencies.
- run: uv run pytest tests/
- if: ${{ !contains(fromJSON('["pypy3.11", "3.15", "3.15t"]'), matrix.python-version) }}
run: uv sync --locked --group test --group integrations
# NOTE: we only care about coverage once. We arbitrarily choose one of the Python versions to run it on
- if: ${{ matrix.python-version == '3.14' }}
run: |
uv run pytest tests/ --cov=whenever --cov-report term-missing
- if: ${{ !contains(fromJSON('["pypy3.11", "3.15", "3.15t", "3.14"]'), matrix.python-version) }}
run: |
uv run pytest tests/
- run: |
sudo apt-get install -y tzdata # for the zdump command
uv run python scripts/smoketest_*.py
lint:
name: Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78
- uses: actions/setup-python@v7
with:
python-version: '3.14'
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: "1.93"
components: "clippy, rustfmt"
- run: uv sync --locked --group dev-extra
env:
WHENEVER_NO_BUILD_RUST_EXT: "1"
- run: make ci-lint
env:
WHENEVER_NO_BUILD_RUST_EXT: "1"
typecheck:
name: Typecheck Python code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78
- uses: actions/setup-python@v7
with:
python-version: '3.14'
- run: uv sync --locked --all-groups --no-install-project
env:
WHENEVER_NO_BUILD_RUST_EXT: "1"
- run: make typecheck
env:
WHENEVER_NO_BUILD_RUST_EXT: "1"
# https://github.com/marketplace/actions/alls-green#why
all-green:
name: Are all checks green?
if: always()
needs:
- test-rust-ext
- test-rust
- test-os
- test-pure-python
- lint
- typecheck
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}