Skip to content

Commit 6c800cc

Browse files
authored
Modernize CI (#743)
Benefits: - Replace unofficial `tox-gh-actions` plugin with its maintained successor `tox-gh` - Switch to uv for slightly faster dependency installation and built-in caching This is heavily inspired from what is done by tox-gh: https://github.com/tox-dev/tox-gh/blob/6efb80fc24df3c6e08a3f99b55949d4fba3f248d/.github/workflows/check.yaml Around 20% less CI usage when cached.
1 parent bad5771 commit 6c800cc

5 files changed

Lines changed: 41 additions & 22 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ jobs:
1919
contents: write
2020

2121
steps:
22-
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
22+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2323

2424
- name: Set up Python
25-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
25+
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
2626
with:
2727
python-version: "3.x"
2828

‎.github/workflows/test.yml‎

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,30 @@ jobs:
3434
- os: windows-latest
3535
python-version: "3.14"
3636

37+
env:
38+
# Select the tox envs for this matrix entry (see `[gh]` in `tox.ini`).
39+
TOX_GH_MAJOR_MINOR: ${{ matrix.python-version }}
40+
# Use uv-managed interpreters everywhere.
41+
UV_PYTHON_PREFERENCE: only-managed
42+
3743
steps:
38-
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
44+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
3945

40-
- name: Set up Python ${{ matrix.python-version }}
41-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
46+
- name: Install uv
47+
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
4248
with:
43-
python-version: ${{ matrix.python-version }}
44-
allow-prereleases: true
49+
version-file: requirements-ci.txt
50+
enable-cache: true
51+
cache-dependency-glob: |
52+
pyproject.toml
53+
tox.ini
54+
requirements-ci.txt
4555
46-
- name: Upgrade pip
47-
run: python -m pip install --upgrade pip
56+
- name: Install tox
57+
run: uv tool install --python 3.14 --with-requirements requirements-ci.txt tox
4858

49-
- name: Install dependencies
50-
run: pip install tox tox-gh-actions
59+
- name: Setup test suite
60+
run: tox run -v --notest --skip-missing-interpreters false
5161

52-
- name: Test with tox
53-
run: tox
62+
- name: Run test suite
63+
run: tox run --skip-pkg-install

‎MANIFEST.in‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ include .coveragerc
99
include .editorconfig
1010
include Makefile
1111
include requirements.txt
12+
include requirements-ci.txt
1213
include requirements-docs.txt
1314
include src/dotenv/py.typed

‎requirements-ci.txt‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Tooling installed by `.github/workflows/test.yml`.
2+
tox==4.67.4
3+
tox-gh==1.9.1
4+
tox-uv==1.37.2
5+
uv==0.13.6

‎tox.ini‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
11
[tox]
22
envlist = lint,py{310,311,312,313,314,314t},pypy3,manifest,coverage-report
33

4-
[gh-actions]
4+
[gh]
55
python =
6-
3.10: py310
7-
3.11: py311
8-
3.12: py312
9-
3.13: py313, lint, manifest
10-
3.14: py314
11-
3.14t: py314t
12-
pypy-3.11: pypy3
6+
3.10 = py310
7+
3.11 = py311
8+
3.12 = py312
9+
3.13 = py313, lint, manifest
10+
3.14 = py314
11+
3.14t = py314t
12+
pypy3.11 = pypy3
1313

1414
[testenv]
1515
deps =
1616
pytest
1717
pytest-cov
1818
click
19-
py{310,311,312,313,314,314t,pypy3}: ipython
19+
py{310,311,312,313,314,314t},pypy3: ipython
2020
commands = pytest --cov --cov-report=term-missing {posargs}
2121
depends =
2222
py{310,311,312,313,314,314t},pypy3: coverage-clean
2323
coverage-report: py{310,311,312,313,314,314t},pypy3
2424

25+
[testenv:pypy3]
26+
base_python = pypy3.11
27+
2528
[testenv:lint]
2629
skip_install = true
2730
deps =

0 commit comments

Comments
 (0)