Skip to content

Commit 000e0a0

Browse files
authored
Improve the CI (#187)
1 parent 01e69ab commit 000e0a0

File tree

7 files changed

+118
-127
lines changed

7 files changed

+118
-127
lines changed

.github/workflows/check.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
- type
27+
- dev
28+
- pkg_meta
29+
steps:
30+
- uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 0
33+
- name: Install the latest version of uv
34+
uses: astral-sh/setup-uv@v3
35+
with:
36+
enable-cache: true
37+
cache-dependency-glob: "pyproject.toml"
38+
github-token: ${{ secrets.GITHUB_TOKEN }}
39+
- name: Install tox
40+
run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv
41+
- name: Install Python
42+
if: startsWith(matrix.env, '3.') && matrix.env != '3.13'
43+
run: uv python install --python-preference only-managed ${{ matrix.env }}
44+
- name: Setup test suite
45+
run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.env }}
46+
- name: Run test suite
47+
run: tox run --skip-pkg-install -e ${{ matrix.env }}
48+
env:
49+
PYTEST_ADDOPTS: "-vv --durations=20"

.github/workflows/check.yml

Lines changed: 0 additions & 70 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/sphinx-argparse-cli/${{ 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
@@ -5,7 +5,7 @@
55
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/sphinx-argparse-cli?style=flat-square)](https://pypi.org/project/sphinx-argparse-cli)
66
[![Downloads](https://static.pepy.tech/badge/sphinx-argparse-cli/month)](https://pepy.tech/project/sphinx-argparse-cli)
77
[![PyPI - License](https://img.shields.io/pypi/l/sphinx-argparse-cli?style=flat-square)](https://opensource.org/licenses/MIT)
8-
![check](https://github.com/tox-dev/sphinx-argparse-cli/workflows/check/badge.svg?branch=main)
8+
[![check](https://github.com/tox-dev/sphinx-argparse-cli/actions/workflows/check.yaml/badge.svg)](https://github.com/tox-dev/sphinx-argparse-cli/actions/workflows/check.yaml)
99

1010
Render CLI arguments (sub-commands friendly) defined by the argparse module. For live demo checkout the documentation of
1111
[tox](https://tox.wiki/en/latest/cli_interface.html),

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ dynamic = [
4141
dependencies = [
4242
"sphinx>=8.0.2",
4343
]
44-
optional-dependencies.test = [
44+
optional-dependencies.testing = [
4545
"covdefaults>=2.3",
4646
"defusedxml>=0.7.1", # needed for sphinx.testing
4747
"pytest>=8.3.2",

tox.ini

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,66 @@
11
[tox]
22
requires =
33
tox>=4.2
4+
tox-uv>=1.11.3
45
env_list =
56
fix
67
3.13
78
3.12
89
3.11
910
3.10
1011
type
11-
readme
12+
pkg_meta
1213
skip_missing_interpreters = true
1314

1415
[testenv]
15-
description = run the unit tests with pytest under {basepython}
16+
description = run the unit tests with pytest under {base_python}
1617
package = wheel
1718
wheel_build_env = .pkg
1819
extras =
19-
test
20+
testing
21+
pass_env =
22+
PYTEST_*
2023
set_env =
21-
COVERAGE_FILE = {toxworkdir}/.coverage.{envname}
22-
COVERAGE_PROCESS_START = {toxinidir}/setup.cfg
23-
_COVERAGE_SRC = {envsitepackagesdir}/sphinx_argparse_cli
24+
COVERAGE_FILE = {work_dir}/.coverage.{env_name}
2425
commands =
25-
pytest {tty:--color=yes} {posargs: \
26-
--junitxml {toxworkdir}{/}junit.{envname}.xml --cov {envsitepackagesdir}{/}sphinx_argparse_cli \
27-
--cov {toxinidir}{/}tests --cov-fail-under=100 \
26+
python -m pytest {tty:--color=yes} {posargs: \
27+
--cov {env_site_packages_dir}{/}sphinx_argparse_cli --cov {tox_root}{/}tests \
2828
--cov-config=pyproject.toml --no-cov-on-fail --cov-report term-missing:skip-covered --cov-context=test \
29-
--cov-report html:{envtmpdir}{/}htmlcov --cov-report xml:{toxworkdir}{/}coverage.{envname}.xml \
29+
--cov-report html:{env_tmp_dir}{/}htmlcov --cov-report xml:{work_dir}{/}coverage.{env_name}.xml \
30+
--junitxml {work_dir}{/}junit.{env_name}.xml \
3031
tests}
3132

3233
[testenv:fix]
33-
description = run static analysis and style check using flake8
34+
description = format the code base to adhere to our styles, and complain about what we cannot do automatically
3435
skip_install = true
3536
deps =
36-
pre-commit>=3.8
37-
pass_env =
38-
HOMEPATH
39-
PROGRAMDATA
37+
pre-commit-uv>=4.1.1
4038
commands =
4139
pre-commit run --all-files --show-diff-on-failure
42-
python -c 'print("hint: run {envdir}/bin/pre-commit install to add checks as pre-commit hook")'
4340

4441
[testenv:type]
4542
description = run type check on code base
4643
deps =
4744
mypy==1.11.2
4845
types-docutils>=0.21.0.20240907
4946
commands =
50-
mypy src
51-
mypy tests
47+
mypy src tests {posargs}
5248

53-
[testenv:readme]
49+
[testenv:pkg_meta]
5450
description = check that the long description is valid
5551
skip_install = true
5652
deps =
57-
build[uv]>=1.2.2
5853
check-wheel-contents>=0.6
5954
twine>=5.1.1
55+
uv>=0.4.10
6056
commands =
61-
pyproject-build --installer uv --outdir {envtmpdir} --sdist --wheel .
62-
twine check {envtmpdir}{/}*
63-
check-wheel-contents --no-config {envtmpdir}
57+
uv build --sdist --wheel --out-dir {env_tmp_dir} .
58+
twine check {env_tmp_dir}{/}*
59+
check-wheel-contents --no-config {env_tmp_dir}
6460

6561
[testenv:dev]
6662
description = generate a DEV environment
6763
package = editable
68-
extras =
69-
docs
70-
test
7164
commands =
7265
uv pip tree
7366
python -c 'import sys; print(sys.executable)'

0 commit comments

Comments
 (0)