Skip to content

Commit 560480e

Browse files
authored
Merge branch 'trunk' into sql-storage
2 parents e172cbb + 44b356e commit 560480e

26 files changed

+340
-266
lines changed

.codecov.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ coverage:
1313
default:
1414
informational: false
1515
target: 100%
16+
17+
ignore:
18+
- "src/klein/test/typing_*.py"

.coveragerc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
branch = True
33
parallel = True
44
source = klein
5+
omit = src/klein/test/typing_*.py
56

67
[paths]
78
source=

.github/dependabot.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates
2+
3+
version: 2
4+
5+
updates:
6+
7+
- package-ecosystem: "pip"
8+
directory: "/"
9+
allow:
10+
- dependency-type: "all"
11+
schedule:
12+
interval: weekly
13+
open-pull-requests-limit: 10
14+
labels:
15+
- "dependencies"
16+
17+
- package-ecosystem: "github-actions"
18+
directory: "/"
19+
schedule:
20+
interval: weekly
21+
labels:
22+
- "dependencies"

.github/workflows/cicd.yml

Lines changed: 76 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,28 @@ jobs:
2525
steps:
2626

2727
- name: Checkout source code
28-
uses: actions/checkout@v2
28+
uses: actions/checkout@v4
2929

3030
- name: Install Python
31-
uses: actions/setup-python@v3
31+
uses: actions/setup-python@v4
3232
with:
33-
python-version: "3.10"
33+
python-version: "3.11"
3434

3535
- name: System Python Information
3636
uses: twisted/python-info-action@v1
3737

3838
- name: Set up Tox environment
3939
run: |
40-
pip install 'tox<4'
41-
tox -e lint --notest
40+
pip install tox
41+
tox run -e lint --notest
4242
4343
- name: Tox Python Information
4444
uses: twisted/python-info-action@v1
4545
with:
4646
python-path: .tox/lint/*/python
4747

4848
- name: Run Linters
49-
run: tox -e lint
49+
run: tox run -e lint
5050

5151

5252
mypy:
@@ -59,28 +59,28 @@ jobs:
5959
steps:
6060

6161
- name: Checkout source code
62-
uses: actions/checkout@v2
62+
uses: actions/checkout@v4
6363

6464
- name: Install Python
65-
uses: actions/setup-python@v3
65+
uses: actions/setup-python@v4
6666
with:
67-
python-version: "3.10"
67+
python-version: "3.11"
6868

6969
- name: System Python Information
7070
uses: twisted/python-info-action@v1
7171

7272
- name: Set up Tox environment
7373
run: |
74-
pip install 'tox<4'
75-
tox -e mypy --notest
74+
pip install tox
75+
tox run -e mypy --notest
7676
7777
- name: Tox Python Information
7878
uses: twisted/python-info-action@v1
7979
with:
8080
python-path: .tox/mypy/*/python
8181

8282
- name: Run Mypy
83-
run: tox -e mypy
83+
run: tox run -e mypy
8484

8585

8686
docs:
@@ -93,28 +93,28 @@ jobs:
9393
steps:
9494

9595
- name: Checkout source code
96-
uses: actions/checkout@v2
96+
uses: actions/checkout@v4
9797

9898
- name: Install Python
99-
uses: actions/setup-python@v3
99+
uses: actions/setup-python@v4
100100
with:
101-
python-version: "3.10"
101+
python-version: "3.11"
102102

103103
- name: System Python Information
104104
uses: twisted/python-info-action@v1
105105

106106
- name: Set up Tox environment
107107
run: |
108-
pip install 'tox<4'
109-
tox -e docs --notest
108+
pip install tox
109+
tox run -e docs --notest
110110
111111
- name: Tox Python Information
112112
uses: twisted/python-info-action@v1
113113
with:
114114
python-path: .tox/docs/*/python
115115

116116
- name: Build documentation
117-
run: tox -e docs
117+
run: tox run -e docs
118118

119119

120120
docs-linkcheck:
@@ -127,28 +127,28 @@ jobs:
127127
steps:
128128

129129
- name: Checkout source code
130-
uses: actions/checkout@v2
130+
uses: actions/checkout@v4
131131

132132
- name: Install Python
133-
uses: actions/setup-python@v3
133+
uses: actions/setup-python@v4
134134
with:
135-
python-version: "3.10"
135+
python-version: "3.11"
136136

137137
- name: System Python Information
138138
uses: twisted/python-info-action@v1
139139

140140
- name: Set up Tox environment
141141
run: |
142-
pip install 'tox<4'
143-
tox -e docs-linkcheck --notest
142+
pip install tox
143+
tox run -e docs-linkcheck --notest
144144
145145
- name: Tox Python Information
146146
uses: twisted/python-info-action@v1
147147
with:
148148
python-path: .tox/docs-linkcheck/*/python
149149

150150
- name: Check for broken links in documentation
151-
run: tox -e docs-linkcheck;
151+
run: tox run -e docs-linkcheck
152152

153153

154154
packaging:
@@ -160,113 +160,128 @@ jobs:
160160
steps:
161161

162162
- name: Checkout source code
163-
uses: actions/checkout@v2
163+
uses: actions/checkout@v4
164164

165165
- name: Install Python
166-
uses: actions/setup-python@v3
166+
uses: actions/setup-python@v4
167167
with:
168-
python-version: "3.10"
168+
python-version: "3.11"
169169

170170
- name: System Python Information
171171
uses: twisted/python-info-action@v1
172172

173173
- name: Set up Tox environment
174174
run: |
175-
pip install 'tox<4'
176-
tox -e packaging --notest
175+
pip install tox
176+
tox run -e packaging --notest
177177
178178
- name: Tox Python Information
179179
uses: twisted/python-info-action@v1
180180
with:
181181
python-path: .tox/packaging/*/python
182182

183183
- name: Check packaging
184-
run: tox -e packaging;
184+
run: tox run -e packaging
185185

186186

187187
unit:
188-
name: "Py:${{ matrix.python-version }} - Tw:${{ matrix.twisted }} - ${{ matrix.os }}"
188+
name: "Py:${{ matrix.python-version }} - Tw:${{ matrix.twisted-version }} - ${{ matrix.os }}"
189189

190190
runs-on: ${{ matrix.os }}
191191
timeout-minutes: 30
192192
continue-on-error: ${{ matrix.optional }}
193193
strategy:
194194
matrix:
195195
os: ["ubuntu-latest"]
196-
python-version: ["3.7", "3.9", "pypy-3.8"]
197-
twisted: ["19.2", "20.3", "current"]
196+
python-version: ["3.7", "3.9", "3.10", "3.11"]
197+
twisted-version: ["21.2", "22.1", "current"]
198+
tox-prefix: ["coverage"]
198199
optional: [false]
199200
include:
200201
- os: "ubuntu-latest"
201-
python-version: "3.10"
202-
twisted: "current"
202+
python-version: "pypy-3.8"
203+
twisted-version: "current"
204+
tox-prefix: "test"
203205
optional: false
204206
- os: "ubuntu-latest"
205-
python-version: "3.11"
206-
twisted: "current"
207+
python-version: "pypy-3.9"
208+
twisted-version: "current"
209+
tox-prefix: "test"
207210
optional: false
211+
# Test Python 3.12 but allow it to fail
212+
- os: "ubuntu-latest"
213+
python-version: "3.12.0-alpha.7"
214+
twisted-version: "current"
215+
tox-prefix: "test"
216+
optional: true
208217

209218
steps:
210219

211220
- name: Checkout source code
212-
uses: actions/checkout@v2
221+
uses: actions/checkout@v4
213222
with:
214223
fetch-depth: 2
215224

216225
- name: Install Python
217-
uses: actions/setup-python@v3
226+
uses: actions/setup-python@v4
218227
with:
219228
python-version: ${{ matrix.python-version }}
220229

221230
- name: System Python Information
222231
uses: twisted/python-info-action@v1
223232

224233
- name: Translate Python version to Tox environment
225-
id: tox_env
226234
shell: python
227235
run: |
228-
py = "${{ matrix.python-version }}".replace(".", "").replace("pypy", "py").replace("-", "")
229-
tw = "${{ matrix.twisted }}".replace(".", "")
230-
with_coverage = 'coverage-'
231-
report_coverage = 'yes'
232-
if 'py' in py:
233-
# Coverage is disabled on PYPY as the run is slow and we
234-
# don't have PYPY specific code.
235-
with_coverage = 'test-'
236-
report_coverage = ''
237-
print(f"::set-output name=value::{with_coverage}py{py}-tw{tw}")
238-
print(f"::set-output name=has_coverage::{report_coverage}")
236+
from os import environ
237+
from pathlib import Path
238+
239+
py = "${{ matrix.python-version }}"
240+
py = "".join(py.split(".")[:2]) # Combine major/minor, toss rest
241+
py = py.replace("pypy-", "py") # For Pypy: have a litte less py
242+
243+
tw = "${{ matrix.twisted-version }}"
244+
tw = tw.replace(".", "")
245+
246+
env = f"${{ matrix.tox-prefix }}-py{py}-tw{tw}"
247+
248+
print(f"TOX_ENV={env}")
249+
250+
p = Path(environ["GITHUB_ENV"])
251+
f = p.open(mode="a")
252+
f.write(f"TOX_ENV={env}\n")
239253
240254
- name: Set up Tox environment
241255
run: |
242-
pip install 'tox<4'
243-
tox -e ${{ steps.tox_env.outputs.value }} --notest;
256+
pip install tox
257+
tox run -e ${TOX_ENV} --notest
244258
245259
- name: Tox Python Information
246260
uses: twisted/python-info-action@v1
247261
with:
248-
python-path: .tox/${{ steps.tox_env.outputs.value }}/*/python
262+
python-path: .tox/${TOX_ENV}/*/python
249263

250264
- name: Run unit tests
251-
run: tox -e ${{ steps.tox_env.outputs.value }};
265+
run: tox run -e ${TOX_ENV}
252266

253267
- name: Upload Trial log artifact
254-
if: failure()
255-
uses: actions/upload-artifact@v1
268+
if: ${{ failure() }}
269+
uses: actions/upload-artifact@v3
256270
with:
257271
name: trial
258-
path: .tox/${{ steps.tox_env.outputs.value }}/log/trial.log
272+
path: .tox/${TOX_ENV}/log/trial.log
259273

260274
# Use the latest supported Python version for combining coverage to
261275
# prevent parsing errors in older versions when looking at modern code.
262-
- uses: "actions/setup-python@v3"
276+
- uses: "actions/setup-python@v4"
263277
with:
264-
python-version: "3.10"
278+
python-version: "3.11"
265279

266280
- name: "Upload coverage to Codecov"
267281
uses: "codecov/codecov-action@v3"
268-
if: steps.tox_env.outputs.has_coverage
282+
if: ${{ matrix.tox-prefix == 'coverage' }}
269283
with:
284+
token: ${{ secrets.CODECOV_TOKEN }}
270285
env_vars: GITHUB_REF,GITHUB_COMMIT,GITHUB_USER,GITHUB_WORKFLOW
271286
fail_ci_if_error: true
272287
env:

0 commit comments

Comments
 (0)