Skip to content

Commit 12537d4

Browse files
authored
uv in CI (#72)
1 parent 2c506f4 commit 12537d4

2 files changed

Lines changed: 26 additions & 27 deletions

File tree

.github/workflows/ci.yml

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@ jobs:
2222
- uses: actions/checkout@v4
2323
- uses: actions/setup-python@v5
2424
with:
25-
python-version: "3.11" # XXX: change once interrogate works on 3.12
26-
cache: pip
25+
python-version-file: .python-version-default
26+
- uses: hynek/setup-cached-uv@v2
2727

28-
- name: Install & run tox
29-
run: |
30-
python -Im pip install tox
31-
python -Im tox run -e lint -- --show-diff-on-failure
28+
- run: >
29+
uvx --with tox-uv
30+
tox run -e lint -- --show-diff-on-failure
3231
3332
tests:
3433
name: Tests on ${{ matrix.python-version }}
@@ -50,7 +49,7 @@ jobs:
5049
with:
5150
python-version: ${{ matrix.python-version }}
5251
allow-prereleases: true
53-
cache: pip
52+
- uses: hynek/setup-cached-uv@v2
5453

5554
- name: Prepare tox & run tests
5655
run: |
@@ -62,11 +61,13 @@ jobs:
6261
V=py$(echo $V | tr -d .)
6362
fi
6463
65-
python -Im pip install tox
66-
python -Im tox run -f "$V"
64+
uvx --with tox-uv \
65+
tox run -f "$V"
6766
6867
- name: Run Mypy on API
69-
run: python -Im tox run -e mypy-api
68+
run: >
69+
uvx --with tox-uv
70+
tox run -e mypy-api
7071
7172
- name: Upload coverage data
7273
uses: actions/upload-artifact@v4
@@ -86,7 +87,7 @@ jobs:
8687
- uses: actions/setup-python@v5
8788
with:
8889
python-version-file: .python-version-default
89-
cache: pip
90+
- uses: hynek/setup-cached-uv@v2
9091

9192
- uses: actions/download-artifact@v4
9293
with:
@@ -95,16 +96,16 @@ jobs:
9596

9697
- name: Combine coverage & fail if it's <100%
9798
run: |
98-
python -Im pip install coverage[toml]
99+
uv tool install coverage[toml]
99100
100-
python -Im coverage combine
101-
python -Im coverage html --skip-covered --skip-empty
101+
coverage combine
102+
coverage html --skip-covered --skip-empty
102103
103104
# Report and write to summary.
104-
python -Im coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
105+
coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
105106
106107
# Report again and fail if under 100%.
107-
python -Im coverage report --fail-under=100
108+
coverage report --fail-under=100
108109
109110
- name: Upload HTML report if check failed.
110111
uses: actions/upload-artifact@v4
@@ -122,12 +123,11 @@ jobs:
122123
- uses: actions/setup-python@v5
123124
with:
124125
python-version-file: .python-version-default
125-
cache: pip
126+
- uses: hynek/setup-cached-uv@v2
126127

127-
- name: Install & run tox
128-
run: |
129-
python -Im pip install tox
130-
python -Im tox run -e mypy-pkg
128+
- run: >
129+
uvx --with tox-uv
130+
tox run -e mypy-pkg
131131
132132
install-dev:
133133
strategy:
@@ -158,12 +158,11 @@ jobs:
158158
with:
159159
# Keep in sync with tox.ini/docs & .readthedocs.yaml
160160
python-version: "3.12"
161-
cache: pip
161+
- uses: hynek/setup-cached-uv@v2
162162

163-
- name: Install & run tox
164-
run: |
165-
python -Im pip install tox
166-
python -Im tox run -e docs
163+
- run: >
164+
uvx --with tox-uv
165+
tox run -e docs
167166
168167
required-checks-pass:
169168
name: Ensure everything required is passing for branch protection

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ commands =
4040

4141
[testenv:lint]
4242
skip_install = true
43-
deps = pre-commit
43+
deps = pre-commit-uv
4444
commands = pre-commit run --all-files {posargs}
4545

4646

0 commit comments

Comments
 (0)