Skip to content

Commit a1319e0

Browse files
authored
Improve the CI (#90)
1 parent 3545c59 commit a1319e0

File tree

7 files changed

+130
-164
lines changed

7 files changed

+130
-164
lines changed

.github/workflows/check.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: check
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches: ["main"]
6+
tags-ignore: ["**"]
7+
pull_request:
8+
schedule:
9+
- cron: "0 8 * * *"
10+
11+
concurrency:
12+
group: check-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
test:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
env:
22+
- "3.13"
23+
- "3.12"
24+
- "3.11"
25+
- "3.10"
26+
- "3.9"
27+
- "3.8"
28+
- type
29+
- dev
30+
- pkg_meta
31+
steps:
32+
- name: Install OS dependencies
33+
run: sudo apt-get install graphviz -y
34+
- uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 0
37+
- name: Install the latest version of uv
38+
uses: astral-sh/setup-uv@v3
39+
with:
40+
enable-cache: true
41+
cache-dependency-glob: "pyproject.toml"
42+
github-token: ${{ secrets.GITHUB_TOKEN }}
43+
- name: Install tox
44+
run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv
45+
- name: Install Python
46+
if: startsWith(matrix.env, '3.') && matrix.env != '3.13'
47+
run: uv python install --python-preference only-managed ${{ matrix.env }}
48+
- name: Setup test suite
49+
run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.env }}
50+
- name: Run test suite
51+
run: tox run --skip-pkg-install -e ${{ matrix.env }}
52+
env:
53+
PYTEST_ADDOPTS: "-vv --durations=20"
54+
DIFF_AGAINST: HEAD

.github/workflows/check.yml

Lines changed: 0 additions & 104 deletions
This file was deleted.

.github/workflows/release.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release to PyPI
2+
on:
3+
push:
4+
tags: ["*"]
5+
6+
env:
7+
dists-artifact-name: python-package-distributions
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
- name: Install the latest version of uv
17+
uses: astral-sh/setup-uv@v3
18+
with:
19+
enable-cache: true
20+
cache-dependency-glob: "pyproject.toml"
21+
github-token: ${{ secrets.GITHUB_TOKEN }}
22+
- name: Build package
23+
run: uv build --python 3.13 --python-preference only-managed --sdist --wheel . --out-dir dist
24+
- name: Store the distribution packages
25+
uses: actions/upload-artifact@v4
26+
with:
27+
name: ${{ env.dists-artifact-name }}
28+
path: dist/*
29+
30+
release:
31+
needs:
32+
- build
33+
runs-on: ubuntu-latest
34+
environment:
35+
name: release
36+
url: https://pypi.org/project/tox-uv/${{ github.ref_name }}
37+
permissions:
38+
id-token: write
39+
steps:
40+
- name: Download all the dists
41+
uses: actions/download-artifact@v4
42+
with:
43+
name: ${{ env.dists-artifact-name }}
44+
path: dist/
45+
- name: Publish to PyPI
46+
uses: pypa/[email protected]
47+
with:
48+
attestations: true

.github/workflows/release.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![PyPI version](https://badge.fury.io/py/tox-uv.svg)](https://badge.fury.io/py/tox-uv)
44
[![PyPI Supported Python Versions](https://img.shields.io/pypi/pyversions/tox-uv.svg)](https://pypi.python.org/pypi/tox-uv/)
5-
[![check](https://github.com/tox-dev/tox-uv/actions/workflows/check.yml/badge.svg)](https://github.com/tox-dev/tox-uv/actions/workflows/check.yml)
5+
[![check](https://github.com/tox-dev/tox-uv/actions/workflows/check.yaml/badge.svg)](https://github.com/tox-dev/tox-uv/actions/workflows/check.yaml)
66
[![Downloads](https://static.pepy.tech/badge/tox-uv/month)](https://pepy.tech/project/tox-uv)
77

88
**tox-uv** is a tox plugin which replaces virtualenv and pip with uv in your tox environments.

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ dependencies = [
4747
"typing-extensions>=4.12.2; python_version<'3.10'",
4848
"uv<1,>=0.4.7",
4949
]
50-
optional-dependencies.test = [
50+
optional-dependencies.testing = [
5151
"covdefaults>=2.3",
5252
"devpi-process>=1",
53+
"diff-cover>=9.2",
5354
"pytest>=8.3.2",
5455
"pytest-cov>=5",
5556
"pytest-mock>=3.14",

tox.ini

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tox]
22
requires =
33
tox>=4.2
4-
tox-uv>=1.11.2
4+
tox-uv>=1.11.3
55
env_list =
66
fix
77
3.13
@@ -11,64 +11,60 @@ env_list =
1111
3.9
1212
3.8
1313
type
14-
readme
14+
pkg_meta
1515
skip_missing_interpreters = true
1616

1717
[testenv]
18-
description = run the unit tests with pytest under {basepython}
18+
description = run the unit tests with pytest under {base_python}
1919
package = wheel
2020
wheel_build_env = .pkg
2121
extras =
22-
test
22+
testing
23+
pass_env =
24+
DIFF_AGAINST
25+
PYTEST_*
2326
set_env =
24-
COVERAGE_FILE = {toxworkdir}{/}.coverage.{envname}
27+
COVERAGE_FILE = {work_dir}/.coverage.{env_name}
2528
commands =
26-
pytest {tty:--color=yes} {posargs: \
27-
--cov {envsitepackagesdir}{/}tox_uv --cov {toxinidir}{/}tests --cov-context=test \
28-
--no-cov-on-fail --cov-config {toxinidir}{/}pyproject.toml \
29-
--cov-report term-missing:skip-covered --junitxml {toxworkdir}{/}junit.{envname}.xml \
30-
--cov-report html:{envtmpdir}{/}htmlcov --durations=5 \
29+
python -m pytest {tty:--color=yes} {posargs: \
30+
--cov {env_site_packages_dir}{/}tox_uv --cov {tox_root}{/}tests \
31+
--cov-config=pyproject.toml --no-cov-on-fail --cov-report term-missing:skip-covered --cov-context=test \
32+
--cov-report html:{env_tmp_dir}{/}htmlcov --cov-report xml:{work_dir}{/}coverage.{env_name}.xml \
33+
--junitxml {work_dir}{/}junit.{env_name}.xml \
3134
tests}
35+
diff-cover --compare-branch {env:DIFF_AGAINST:origin/main} {work_dir}{/}coverage.{env_name}.xml --fail-under 100
3236

3337
[testenv:fix]
34-
description = run static analysis and style check using flake8
38+
description = format the code base to adhere to our styles, and complain about what we cannot do automatically
3539
skip_install = true
3640
deps =
37-
pre-commit-uv>=4.1
38-
pass_env =
39-
HOMEPATH
40-
PROGRAMDATA
41+
pre-commit-uv>=4.1.1
4142
commands =
4243
pre-commit run --all-files --show-diff-on-failure
4344

4445
[testenv:type]
4546
description = run type check on code base
4647
deps =
4748
mypy==1.11.2
48-
set_env =
49-
{tty:MYPY_FORCE_COLOR = 1}
5049
commands =
51-
mypy src {posargs}
52-
mypy tests {posargs}
50+
mypy src
51+
mypy tests
5352

54-
[testenv:readme]
55-
description = check that the package metadata is correct
53+
[testenv:pkg_meta]
54+
description = check that the long description is valid
5655
skip_install = true
5756
deps =
58-
build[virtualenv]>=1.2.2
57+
check-wheel-contents>=0.6
5958
twine>=5.1.1
60-
set_env =
61-
{tty:FORCE_COLOR = 1}
62-
change_dir = {toxinidir}
59+
uv>=0.4.10
6360
commands =
64-
python -m build --sdist --wheel -o {envtmpdir} .
65-
twine check {envtmpdir}{/}*
61+
uv build --sdist --wheel --out-dir {env_tmp_dir} .
62+
twine check {env_tmp_dir}{/}*
63+
check-wheel-contents --no-config {env_tmp_dir}
6664

6765
[testenv:dev]
6866
description = generate a DEV environment
6967
package = editable
70-
extras =
71-
test
7268
commands =
7369
uv pip tree
7470
python -c 'import sys; print(sys.executable)'

0 commit comments

Comments
 (0)