Skip to content

Commit 86da884

Browse files
Add CI runner for bleeding edge versions, refactor matrix configuration (#965)
* Add CI runner for bleed edge versions, refactor matrix configuration to reduce the number of runners * Fix GitHub actions syntax * Add explicit default in matrix config * Don't run pre-commit for the min dependencies runner * Use underscores in matrix names * Fix boolean handling * Fix boolean handling * Fix wrong variable name * Add name for runners * Fix boolean handling * Tweak name logic * Fix boolean handling * Disable pre-commit for bleeding edge runner * Make OS name explicit and other clarity tweaks * Explicitly forbid ruamel-yaml versions with regressions * Bump tomlkit as a dep and account for breaking changes * Fix syntax issue * Restore default os explicitly * Tweak name logic
1 parent 157caf6 commit 86da884

5 files changed

Lines changed: 66 additions & 59 deletions

File tree

.github/workflows/ci.yml

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ concurrency:
2020
cancel-in-progress: true
2121
jobs:
2222
tests:
23-
runs-on: ${{ matrix.os }}
23+
name: ${{ (matrix.codecov == 'true' && 'Codecov') || (matrix.codspeed == 'true' && 'CodSpeed') || format('Test Python {0} {1}', matrix.python_version, ((matrix.dependencies == 'min' || matrix.dependencies == 'max') && format('{0} dependencies', matrix.dependencies)) || (matrix.os || 'ubuntu-latest')) }}
24+
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
2425
env:
2526
PYTHONIOENCODING: utf-8
2627
steps:
@@ -35,86 +36,87 @@ jobs:
3536
- name: Set up uv
3637
uses: astral-sh/setup-uv@f94ec6bedd8674c4426838e6b50417d36b6ab231 # v5.3.1
3738
with:
38-
version: ${{ matrix.uv-version }}
39+
version: ${{ matrix.uv_version || 'latest' }}
3940
enable-cache: true
4041

4142
- name: Set up Python
4243
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
4344
with:
44-
python-version: ${{ matrix.python-version }}
45+
python-version: ${{ matrix.python_version }}
46+
47+
- name: Bump dependencies
48+
if: ${{ matrix.dependencies == 'max' }}
49+
run: |
50+
uv sync --upgrade
4551
4652
- name: Setup dependencies
4753
run: |
48-
uv python pin ${{ matrix.python-version }}
49-
uv sync --resolution ${{ matrix.resolution }}
54+
uv python pin ${{ matrix.python_version }}
55+
uv sync --resolution ${{ matrix.dependencies == 'min' && 'lowest-direct' || 'highest' }}
5056
5157
- name: Run pre-commit
52-
if: matrix.pre-commit
58+
if: ${{ matrix.pre_commit == null || matrix.pre_commit == 'true' }}
5359
run: |
5460
uv run --frozen pre-commit run --all-files
5561
5662
- name: Run pytest
5763
uses: pavelzw/pytest-action@510c5e90c360a185039bea56ce8b3e7e51a16507 # v2.2.0
58-
if: matrix.pytest
64+
if: ${{ matrix.pytest == null || matrix.pytest == 'true' }}
5965
with:
6066
custom-pytest: uv run --frozen pytest
6167
custom-arguments: --cov --cov-report=xml --junitxml=junit.xml -o junit_family=legacy
6268

6369
- name: Run benchmarks
6470
uses: CodSpeedHQ/action@6b43a0cd438f6ca5ad26f9ed03ed159ed2df7da9 # v4.1.1
65-
if: matrix.codspeed
71+
if: ${{ matrix.codspeed != null && matrix.codspeed == 'true' }}
6672
with:
6773
mode: instrumentation
6874
token: ${{ secrets.CODSPEED_TOKEN }}
6975
run: uv run --frozen pytest --codspeed
7076

7177
- name: Upload coverage reports to Codecov
7278
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
73-
if: matrix.codecov
79+
if: ${{ matrix.codecov != null && matrix.codecov == 'true' }}
7480
with:
7581
token: ${{ secrets.CODECOV_TOKEN }}
7682
fail_ci_if_error: true
7783

7884
- name: Upload test results to Codecov
7985

8086
uses: codecov/test-results-action@47f89e9acb64b76debcd5ea40642d25a4adced9f # v1.1.1
81-
if: matrix.codecov && !cancelled()
87+
if: ${{ matrix.codecov != null && matrix.codecov == 'true' && !cancelled() }}
8288
with:
8389
token: ${{ secrets.CODECOV_TOKEN }}
8490
fail_ci_if_error: true
8591

8692
strategy:
8793
matrix:
94+
python_version: ["3.10", "3.14"]
8895
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
89-
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
90-
uv-version: ["latest"]
91-
resolution: ["highest"]
92-
codspeed: [false]
93-
codecov: [false]
94-
pre-commit: [true]
95-
pytest: [true]
96+
dependencies: ["lockfile"]
97+
codecov: ["false"]
98+
codspeed: ["false"]
99+
96100
include:
97-
- os: "ubuntu-latest" # Minimum dependency versions
98-
python-version: "3.10"
99-
uv-version: "0.6.8" # Sync with pyproject.toml
100-
resolution: "lowest-direct"
101-
codspeed: false
102-
codecov: false
103-
pre-commit: false
104-
pytest: true
105-
- os: "ubuntu-latest" # Codecov run
106-
python-version: "3.14"
107-
uv-version: "latest"
108-
resolution: "highest"
109-
codspeed: false
110-
codecov: true
111-
pre-commit: false
112-
pytest: true
113-
- os: "ubuntu-latest" # Codspeed run
114-
python-version: "3.13" # 3.14 support not available yet
115-
uv-version: "latest"
116-
resolution: "highest"
117-
codspeed: true
118-
codecov: false
119-
pre-commit: false
120-
pytest: false
101+
- python_version: "3.11"
102+
os: "ubuntu-latest"
103+
- python_version: "3.12"
104+
os: "ubuntu-latest"
105+
- python_version: "3.13"
106+
os: "ubuntu-latest"
107+
- dependencies: "min"
108+
python_version: "3.10"
109+
uv_version: "0.6.8"
110+
pre_commit: "false"
111+
- dependencies: "max"
112+
python_version: "3.14"
113+
pre_commit: "false"
114+
- codecov: "true"
115+
python_version: "3.14"
116+
117+
pre_commit: "false"
118+
- codspeed: "true"
119+
python_version: "3.13"
120+
121+
pre_commit: "false"
122+
pytest: "false"

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ dependencies = [
4646
"pydantic>=2.5.0",
4747
"requests>=2.26.0",
4848
"rich>=9.6.1",
49-
"ruamel-yaml>=0.16.13",
50-
"tomlkit>=0.12.0",
49+
"ruamel-yaml>=0.16.13,!=0.18.13,!=0.18.14,!=0.18.15",
50+
"tomlkit>=0.13.3",
5151
"typer>=0.12.4",
5252
"typing-extensions>=3.10.0.0",
5353
]

requirements.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -797,11 +797,11 @@ rich==13.9.4 \
797797
# pytest-codspeed
798798
# typer
799799
# usethis
800-
ruamel-yaml==0.18.10 \
801-
--hash=sha256:20c86ab29ac2153f80a428e1254a8adf686d3383df04490514ca3b79a362db58 \
802-
--hash=sha256:30f22513ab2301b3d2b577adc121c6471f28734d3d9728581245f1e76468b4f1
800+
ruamel-yaml==0.18.12 \
801+
--hash=sha256:5a38fd5ce39d223bebb9e3a6779e86b9427a03fb0bf9f270060f8b149cffe5e2 \
802+
--hash=sha256:790ba4c48b6a6e6b12b532a7308779eb12d2aaab3a80fdb8389216f28ea2b287
803803
# via usethis
804-
ruamel-yaml-clib==0.2.12 ; python_full_version < '3.13' and platform_python_implementation == 'CPython' \
804+
ruamel-yaml-clib==0.2.12 ; python_full_version < '3.14' and platform_python_implementation == 'CPython' \
805805
--hash=sha256:0467c5965282c62203273b838ae77c0d29d7638c8a4e3a1c8bdd3602c10904e4 \
806806
--hash=sha256:0b7e75b4965e1d4690e93021adfcecccbca7d61c7bddd8e22406ef2ff20d74ef \
807807
--hash=sha256:11f891336688faf5156a36293a9c362bdc7c88f03a8a027c2c1d8e0bcde998e5 \
@@ -915,9 +915,9 @@ tomli==2.2.1 ; python_full_version < '3.12' \
915915
# deptry
916916
# import-linter
917917
# pytest
918-
tomlkit==0.13.2 \
919-
--hash=sha256:7a974427f6e119197f670fbbbeae7bef749a6c14e793db934baefc1b5f03efde \
920-
--hash=sha256:fff5fe59a87295b278abd31bec92c15d9bc4a06885ab12bcea52c71119392e79
918+
tomlkit==0.13.3 \
919+
--hash=sha256:430cf247ee57df2b94ee3fbe588e71d362a941ebb545dec29b53961d61add2a1 \
920+
--hash=sha256:c89c649d79ee40629a9fda55f8ace8c6a1b42deb912b2a8fd8d942ddadb606b0
921921
# via usethis
922922
typer==0.15.2 \
923923
--hash=sha256:46a499c6107d645a9c13f7ee46c5d5096cae6f5fc57dd11eccbbb9ae3e44ddfc \

tests/usethis/_core/test_docstyle.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def test_numpy(self, tmp_path: Path):
2828
== """\
2929
[lint]
3030
select = ["D2", "D3", "D4"]
31+
3132
[lint.pydocstyle]
3233
convention = "numpy"
3334
"""
@@ -50,6 +51,7 @@ def test_google(self, tmp_path: Path, capfd: pytest.CaptureFixture[str]):
5051
== """\
5152
[lint]
5253
select = ["D2", "D3", "D4"]
54+
5355
[lint.pydocstyle]
5456
convention = "google"
5557
"""
@@ -78,6 +80,7 @@ def test_pep257(self, tmp_path: Path):
7880
== """\
7981
[lint]
8082
select = ["D2", "D3", "D4"]
83+
8184
[lint.pydocstyle]
8285
convention = "pep257"
8386
"""
@@ -187,9 +190,11 @@ def test_adding_ruff_afterwards_allows_default_rules(self, tmp_path: Path):
187190
contents
188191
== """\
189192
line-length = 88
193+
190194
[lint]
191195
select = ["D2", "D3", "D4", "A", "C4", "E4", "E7", "E9", "F", "FLY", "FURB", "I", "PLE", "PLR", "RUF", "SIM", "UP"]
192196
ignore = ["PLR2004", "SIM108"]
197+
193198
[lint.pydocstyle]
194199
convention = "numpy"
195200

uv.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)