Skip to content

Commit 438fc5a

Browse files
authored
Improve the CI (#101)
1 parent 36ba135 commit 438fc5a

File tree

6 files changed

+115
-125
lines changed

6 files changed

+115
-125
lines changed

.github/workflows/check.yaml

+52
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

-87
This file was deleted.

.github/workflows/release.yaml

+48
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/pytest-env/${{ 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

-27
This file was deleted.

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ dynamic = [
3838
"version",
3939
]
4040
dependencies = [
41-
"pytest>=8.3.2",
41+
"pytest>=8.3.3",
4242
"tomli>=2.0.1; python_version<'3.11'",
4343
]
44-
optional-dependencies.test = [
44+
optional-dependencies.testing = [
4545
"covdefaults>=2.3",
4646
"coverage>=7.6.1",
4747
"pytest-mock>=3.14",

tox.ini

+13-9
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,18 @@ env_list =
1010
3.10
1111
3.9
1212
type
13-
readme
13+
pkg_meta
1414
skip_missing_interpreters = true
1515

1616
[testenv]
1717
description = run the tests with pytest
1818
package = wheel
1919
wheel_build_env = .pkg
2020
extras =
21-
test
21+
testing
22+
pass_env =
23+
DIFF_AGAINST
24+
PYTES_*
2225
set_env =
2326
COVERAGE_FILE = {env:COVERAGE_FILE:{toxworkdir}{/}.coverage.{envname}}
2427
commands =
@@ -34,7 +37,7 @@ commands =
3437
description = run static analysis and style check using flake8
3538
skip_install = true
3639
deps =
37-
pre-commit-uv>=4.1
40+
pre-commit-uv>=4.1.1
3841
pass_env =
3942
HOMEPATH
4043
PROGRAMDATA
@@ -49,22 +52,23 @@ commands =
4952
mypy --strict src
5053
mypy --strict tests
5154

52-
[testenv:readme]
55+
[testenv:pkg_meta]
5356
description = check that the long description is valid
5457
skip_install = true
5558
deps =
56-
build[uv]>=1.2.2
59+
check-wheel-contents>=0.6
5760
twine>=5.1.1
58-
change_dir = {toxinidir}
61+
uv>=0.4.10
5962
commands =
60-
pyproject-build --installer uv -o {envtmpdir} .
61-
twine check {envtmpdir}/*
63+
uv build --sdist --wheel --out-dir {env_tmp_dir} .
64+
twine check {env_tmp_dir}{/}*
65+
check-wheel-contents --no-config {env_tmp_dir}
6266

6367
[testenv:dev]
6468
description = generate a DEV environment
6569
package = editable
6670
extras =
67-
test
71+
testing
6872
commands =
6973
uv pip tree
7074
python -c 'import sys; print(sys.executable)'

0 commit comments

Comments
 (0)