Skip to content

Commit 8fee61e

Browse files
committed
Introduce Justfile, use uv in CI
1 parent 5b18ffd commit 8fee61e

2 files changed

Lines changed: 24 additions & 47 deletions

File tree

.github/workflows/main.yml

Lines changed: 18 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,20 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.10"]
19+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy3.10"]
2020
fail-fast: false
2121

2222
steps:
2323
- uses: "actions/checkout@v4"
2424
with:
2525
persist-credentials: false
2626

27-
- uses: "pdm-project/setup-pdm@v4"
28-
with:
29-
python-version: "${{ matrix.python-version }}"
30-
allow-python-prereleases: true
31-
cache: true
32-
version: "2.21.0"
27+
- uses: extractions/setup-just@v3
28+
- uses: hynek/setup-cached-uv@v2
3329

34-
- name: "Run Tox"
30+
- name: "Run Tests"
3531
run: |
36-
python -Im pip install --upgrade tox tox-gh-actions
37-
38-
python -Im tox
32+
just cov ${{ startsWith(matrix.python-version, 'pypy') && matrix.python-version || format('python{0}', matrix.python-version) }}
3933
4034
- name: Upload coverage data
4135
uses: actions/upload-artifact@v4
@@ -55,33 +49,28 @@ jobs:
5549
with:
5650
persist-credentials: false
5751

58-
- uses: "actions/setup-python@v5"
59-
with:
60-
cache: "pip"
61-
python-version: "3.12"
62-
63-
- run: "python -Im pip install --upgrade coverage[toml]"
64-
6552
- name: Download coverage data
6653
uses: actions/download-artifact@v4
6754
with:
6855
pattern: coverage-data-*
6956
merge-multiple: true
7057

58+
- uses: hynek/setup-cached-uv@v2
59+
7160
- name: "Combine coverage"
7261
run: |
73-
python -Im coverage combine
74-
python -Im coverage html
75-
python -Im coverage json
62+
uv run --group test coverage combine
63+
uv run --group test coverage html
64+
uv run --group test coverage json
7665
7766
# Report and write to summary.
78-
python -Im coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
67+
uv run --group test coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
7968
80-
export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])")
69+
export TOTAL=$(uv run python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])")
8170
echo "total=$TOTAL" >> $GITHUB_ENV
8271
8372
# Report again and fail if under the threshold.
84-
python -Im coverage report --fail-under=100
73+
uv run --group test coverage report --fail-under=100
8574
8675
- name: "Upload HTML report."
8776
uses: "actions/upload-artifact@v4"
@@ -90,20 +79,6 @@ jobs:
9079
path: "htmlcov"
9180
if: always()
9281

93-
- name: "Make badge"
94-
if: github.ref == 'refs/heads/main'
95-
uses: "schneegans/dynamic-badges-action@v1.4.0"
96-
with:
97-
# GIST_TOKEN is a GitHub personal access token with scope "gist".
98-
auth: ${{ secrets.GIST_TOKEN }}
99-
gistID: 22405310d6a663164d894a2beab4d44d
100-
filename: covbadge.json
101-
label: Coverage
102-
message: ${{ env.total }}%
103-
minColorRange: 50
104-
maxColorRange: 90
105-
valColorRange: ${{ env.total }}
106-
10782
package:
10883
name: "Build & verify package"
10984
runs-on: "ubuntu-latest"
@@ -112,18 +87,14 @@ jobs:
11287
- uses: "actions/checkout@v4"
11388
with:
11489
persist-credentials: false
115-
- uses: "pdm-project/setup-pdm@v4"
116-
with:
117-
python-version: "3.12"
118-
version: "2.21.0"
11990

120-
- name: "Install check-wheel-content and twine"
121-
run: "python -m pip install twine check-wheel-contents"
91+
- uses: hynek/setup-cached-uv@v2
92+
12293
- name: "Build package"
123-
run: "pdm build"
94+
run: "uvx pdm build"
12495
- name: "List result"
12596
run: "ls -l dist"
12697
- name: "Check wheel contents"
127-
run: "check-wheel-contents --toplevel cattr,cattrs dist/*.whl"
98+
run: "uvx check-wheel-contents --toplevel cattr,cattrs dist/*.whl"
12899
- name: "Check long_description"
129-
run: "python -m twine check dist/*"
100+
run: "uvx twine check dist/*"

Justfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
test python='':
2+
uv run {{ if python != '' { '-p ' + python } else { '' } }} --all-extras --group test pytest -x --ff -n auto tests/
3+
4+
cov python='':
5+
uv run {{ if python != '' { '-p ' + python } else { '' } }} python -c 'import pathlib, site; pathlib.Path(f"{site.getsitepackages()[0]}/cov.pth").write_text("import coverage; coverage.process_startup()")'
6+
uv run {{ if python != '' { '-p ' + python } else { '' } }} --all-extras --group test coverage run -m pytest -x --ff -n auto tests/

0 commit comments

Comments
 (0)