Skip to content

Commit 5e6fa6c

Browse files
Improve the CI (#257)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent e498652 commit 5e6fa6c

File tree

6 files changed

+122
-122
lines changed

6 files changed

+122
-122
lines changed

.github/workflows/check.yaml

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

.github/workflows/check.yml

Lines changed: 0 additions & 72 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/pyproject-fmt/${{ 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/pyproject-fmt?style=flat-square)](https://pypi.org/project/pyproject-fmt)
66
[![Downloads](https://static.pepy.tech/badge/pyproject-fmt/month)](https://pepy.tech/project/pyproject-fmt)
77
[![PyPI - License](https://img.shields.io/pypi/l/pyproject-fmt?style=flat-square)](https://opensource.org/licenses/MIT)
8-
[![check](https://github.com/tox-dev/pyproject-fmt/actions/workflows/check.yml/badge.svg)](https://github.com/tox-dev/pyproject-fmt/actions/workflows/check.yml)
8+
[![check](https://github.com/tox-dev/pyproject-fmt/actions/workflows/check.yaml/badge.svg)](https://github.com/tox-dev/pyproject-fmt/actions/workflows/check.yaml)
99

1010
Apply a consistent format to the `pyproject.toml` files.
1111

tox.ini

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[tox]
22
requires =
33
tox>=4.2
4+
tox-uv>=1.11.3
45
env_list =
56
fix
67
3.13
@@ -10,8 +11,8 @@ env_list =
1011
3.9
1112
3.8
1213
type
13-
readme
1414
docs
15+
pkg_meta
1516
skip_missing_interpreters = true
1617

1718
[testenv]
@@ -21,22 +22,20 @@ wheel_build_env = .pkg
2122
extras =
2223
test
2324
set_env =
24-
COVERAGE_FILE = {toxworkdir}/.coverage.{envname}
25-
COVERAGE_PROCESS_START = {toxinidir}/setup.cfg
26-
_COVERAGE_SRC = {envsitepackagesdir}/sphinx_argparse_cli
25+
COVERAGE_FILE = {work_dir}/.coverage.{env_name}
2726
commands =
2827
python -m pytest {tty:--color=yes} {posargs: \
29-
--junitxml {toxworkdir}{/}junit.{envname}.xml --cov {envsitepackagesdir}{/}pyproject_fmt \
30-
--cov {toxinidir}{/}tests --cov-fail-under=100 \
28+
--junitxml {work_dir}{/}junit.{env_name}.xml --cov {env_site_packages_dir}{/}pyproject_fmt \
29+
--cov {tox_root}{/}tests --cov-fail-under=100 \
3130
--cov-config=pyproject.toml --no-cov-on-fail --cov-report term-missing:skip-covered --cov-context=test \
32-
--cov-report html:{envtmpdir}{/}htmlcov --cov-report xml:{toxworkdir}{/}coverage.{envname}.xml \
31+
--cov-report html:{env_tmp_dir}{/}htmlcov --cov-report xml:{work_dir}{/}coverage.{env_name}.xml \
3332
tests}
3433

3534
[testenv:fix]
3635
description = run static analysis and style check using flake8
3736
skip_install = true
3837
deps =
39-
pre-commit>=3.8
38+
pre-commit-uv>=4.1.1
4039
commands =
4140
pre-commit run --all-files --show-diff-on-failure
4241
python -c 'print("hint: run {envdir}/bin/pre-commit install to add checks as pre-commit hook")'
@@ -49,26 +48,28 @@ commands =
4948
mypy src
5049
mypy tests
5150

52-
[testenv:readme]
53-
description = check that the long description is valid
54-
skip_install = true
55-
deps =
56-
build[uv]>=1.2.2
57-
twine>=5.1.1
58-
commands =
59-
pyproject-build --installer uv --sdist --wheel -o {envtmpdir} .
60-
twine check {envtmpdir}/*
61-
6251
[testenv:docs]
6352
description = build documentation
6453
extras =
6554
docs
6655
set_env =
67-
DOCS_OUT = {posargs:{toxworkdir}{/}docs_out}
56+
DOCS_OUT = {posargs:{work_dir}{/}docs_out}
6857
commands =
69-
sphinx-build -d "{envtmpdir}{/}doctree" docs "{env:DOCS_OUT}" --color -b html
58+
sphinx-build -d "{env_tmp_dir}{/}doc_tree" docs "{env:DOCS_OUT}" --color -b html
7059
python -c 'print(r"documentation available under file://{env:DOCS_OUT}{/}index.html")'
7160

61+
[testenv:pkg_meta]
62+
description = check that the long description is valid
63+
skip_install = true
64+
deps =
65+
check-wheel-contents>=0.6
66+
twine>=5.1.1
67+
uv>=0.4.10
68+
commands =
69+
uv build --sdist --wheel --out-dir {env_tmp_dir} .
70+
twine check {env_tmp_dir}{/}*
71+
check-wheel-contents --no-config {env_tmp_dir}
72+
7273
[testenv:dev]
7374
description = generate a DEV environment
7475
package = editable

0 commit comments

Comments
 (0)