Skip to content

Commit 74a478f

Browse files
authoredSep 2, 2024··
Modernize CI (#61)
* Modernize CI actions
1 parent e7efec7 commit 74a478f

File tree

4 files changed

+98
-56
lines changed

4 files changed

+98
-56
lines changed
 

‎.github/workflows/main.yml

+21-18
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ jobs:
1919
redis-version: [6]
2020

2121
steps:
22-
- uses: "actions/checkout@v3"
22+
- uses: "actions/checkout@v4"
2323

24-
- uses: "actions/setup-python@v4"
24+
- uses: "pdm-project/setup-pdm@v4"
2525
with:
2626
python-version: "${{ matrix.python-version }}"
27-
allow-prereleases: true
27+
allow-python-prereleases: true
28+
cache: true
29+
version: "2.18.1"
2830

2931
- name: "Start Redis"
3032
uses: "supercharge/redis-github-action@1.2.0"
@@ -33,37 +35,37 @@ jobs:
3335

3436
- name: "Run Tox"
3537
run: |
36-
set -xe
37-
python -VV
38-
python -Im site
39-
python -Im pip install --upgrade pip wheel pdm
4038
python -Im pip install --upgrade tox tox-gh-actions
4139
python -Im tox
42-
- name: "Upload coverage data"
43-
uses: "actions/upload-artifact@v3"
40+
41+
- name: Upload coverage data
42+
uses: actions/upload-artifact@v4
4443
with:
45-
name: "coverage-data"
46-
path: ".coverage.*"
47-
if-no-files-found: "ignore"
44+
name: coverage-data-${{ matrix.python-version }}
45+
path: .coverage.*
46+
if-no-files-found: ignore
47+
include-hidden-files: true
4848

4949
coverage:
5050
name: "Combine & check coverage."
5151
needs: "tests"
5252
runs-on: "ubuntu-latest"
5353

5454
steps:
55-
- uses: "actions/checkout@v3"
55+
- uses: "actions/checkout@v4"
5656

57-
- uses: "actions/setup-python@v4"
57+
- uses: "actions/setup-python@v5"
5858
with:
5959
cache: "pip"
60-
python-version: "3.11"
60+
python-version: "3.12"
6161

6262
- run: "python -Im pip install --upgrade coverage[toml]"
6363

64-
- uses: "actions/download-artifact@v3"
64+
- name: Download coverage data
65+
uses: actions/download-artifact@v4
6566
with:
66-
name: "coverage-data"
67+
pattern: coverage-data-*
68+
merge-multiple: true
6769

6870
- name: "Combine coverage"
6971
run: |
@@ -81,13 +83,14 @@ jobs:
8183
python -Im coverage report --fail-under=97
8284
8385
- name: "Upload HTML report."
84-
uses: "actions/upload-artifact@v3"
86+
uses: "actions/upload-artifact@v4"
8587
with:
8688
name: "html-report"
8789
path: "htmlcov"
8890
if: always()
8991

9092
- name: "Make badge"
93+
if: github.ref == 'refs/heads/main'
9194
uses: "schneegans/dynamic-badges-action@v1.4.0"
9295
with:
9396
# GIST_TOKEN is a GitHub personal access token with scope "gist".

‎pdm.lock

+54-34
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ lint = [
3535
"mypy>=1.4.1",
3636
]
3737
test = [
38-
"coverage",
38+
"coverage>=7.6.1",
3939
"pytest-asyncio",
4040
"httpx",
4141
"hypercorn",

‎tox.ini

+22-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
[gh-actions]
33
python =
44
3.10: py310
5-
3.11: py311
5+
3.11: py311, docs
66
3.12: py312, lint
77
3.13: py313
88

99
[tox]
10-
envlist = py310, py311, py312, py313, lint
10+
envlist = py310, py311, py312, py313, lint, docs
1111
isolated_build = True
12+
skipsdist = true
1213

1314
[testenv:lint]
1415
basepython = python3.12
@@ -27,7 +28,25 @@ commands_pre =
2728
pdm sync -G test
2829
python -c 'import pathlib; pathlib.Path("{env_site_packages_dir}/cov.pth").write_text("import coverage; coverage.process_startup()")'
2930
commands =
30-
pdm run coverage run -m pytest tests --mypy-only-local-stub -n auto {posargs}
31+
pdm run coverage run -m pytest tests --mypy-only-local-stub {posargs:-n auto}
3132
allowlist_externals = pdm
3233
package = wheel
3334
wheel_build_env = .pkg
35+
36+
[testenv:py312]
37+
setenv =
38+
PDM_IGNORE_SAVED_PYTHON="1"
39+
COVERAGE_PROCESS_START={toxinidir}/pyproject.toml
40+
COVERAGE_CORE=sysmon
41+
42+
[testenv:docs]
43+
basepython = python3.11
44+
setenv =
45+
PYTHONHASHSEED = 0
46+
commands_pre =
47+
pdm sync -G :all,docs
48+
commands =
49+
make docs
50+
allowlist_externals =
51+
make
52+
pdm

0 commit comments

Comments
 (0)
Please sign in to comment.