Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a20f198

Browse files
committed
more tooling
1 parent 5813302 commit a20f198

7 files changed

Lines changed: 134 additions & 7 deletions

File tree

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ trim_trailing_whitespace = true
1515
[*.py]
1616
max_line_length = 100
1717

18-
[*.yml]
18+
[*.{yml,yaml}]
1919
indent_size = 2
2020

2121
[*.rst]

.github/workflows/tests.yml

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ concurrency:
1919
cancel-in-progress: true
2020

2121
env:
22+
FORCE_COLOR: 1
2223
PIP_DISABLE_PIP_VERSION_CHECK: 1
24+
RUFF_OUTPUT_FORMAT: github
2325

2426
jobs:
2527
tests:
@@ -56,8 +58,49 @@ jobs:
5658
5759
- name: "Run tests"
5860
run: |
59-
python -m coverage run --branch -m pytest
60-
python -m coverage report --show-missing --skip-covered
61+
python -m tox -e py
62+
63+
- name: "Upload coverage data"
64+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
65+
with:
66+
name: covdata-${{ matrix.os }}-${{ matrix.python-version }}
67+
path: .coverage.*
68+
include-hidden-files: true
69+
70+
coverage:
71+
name: Coverage
72+
needs: tests
73+
runs-on: ubuntu-latest
74+
environment:
75+
name: coverage
76+
77+
steps:
78+
- name: "Check out the repo"
79+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
80+
with:
81+
persist-credentials: false
82+
83+
- name: "Set up Python"
84+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
85+
with:
86+
python-version: "3.12"
87+
cache: pip
88+
cache-dependency-path: 'requirements/*.txt'
89+
90+
- name: "Install dependencies"
91+
run: |
92+
python -m pip install .[dev]
93+
94+
- name: "Download coverage data"
95+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
96+
with:
97+
pattern: covdata-*
98+
merge-multiple: true
99+
100+
- name: "Combine and report"
101+
run: |
102+
python -m coverage combine -q
103+
python -m coverage report --format="markdown" -m >> "$GITHUB_STEP_SUMMARY"
61104
62105
quality:
63106
name: "Quality checks"
@@ -83,3 +126,6 @@ jobs:
83126
ty check
84127
ruff check
85128
ruff format --check
129+
130+
- name: "Run prek checks"
131+
uses: j178/prek-action@v1

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
.venv
22
.coverage
3+
.coverage.*
34
htmlcov/
45
tmp/
56
*.egg-info/
67
build/
78
dist/
9+
10+
*.pyc
11+
__pycache__

.pre-commit-config.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.15.2
4+
hooks:
5+
- id: ruff-check
6+
- id: ruff-check
7+
args: [--exit-non-zero-on-fix]
8+
9+
- repo: https://github.com/pre-commit/pre-commit-hooks
10+
rev: v6.0.0
11+
hooks:
12+
- id: check-added-large-files
13+
- id: check-case-conflict
14+
- id: check-merge-conflict
15+
- id: check-toml
16+
- id: check-yaml
17+
- id: debug-statements
18+
- id: end-of-file-fixer
19+
- id: forbid-submodules
20+
- id: trailing-whitespace
21+
22+
- repo: https://github.com/python-jsonschema/check-jsonschema
23+
rev: 0.36.2
24+
hooks:
25+
- id: check-github-workflows
26+
27+
- repo: https://github.com/rhysd/actionlint
28+
rev: v1.7.11
29+
hooks:
30+
- id: actionlint
31+
32+
- repo: https://github.com/abravalheri/validate-pyproject
33+
rev: v0.25
34+
hooks:
35+
- id: validate-pyproject
36+
37+
- repo: meta
38+
hooks:
39+
- id: check-hooks-apply
40+
- id: check-useless-excludes

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ install: .venv
88
uv pip install -e .[dev]
99

1010
test:
11-
coverage run --branch -m pytest
12-
coverage report --show-missing --skip-covered
11+
coverage run -m pytest
12+
coverage combine -q
13+
coverage report
1314
coverage html
1415

1516
quality:
@@ -20,6 +21,7 @@ quality:
2021
clean:
2122
rm -rf .coverage htmlcov tmp
2223
rm -rf build/ dist/ src/*.egg-info
24+
rm -rf __pycache__ */__pycache__
2325

2426
dist: ## Build the distributions.
2527
python -m build --sdist --wheel

pyproject.toml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ classifiers = [
1515
requires-python = ">= 3.12"
1616

1717
dependencies = [
18-
"Sphinx",
18+
"Sphinx>9.0.0",
1919
]
2020

2121
dynamic = ["version"]
@@ -26,6 +26,8 @@ dev = [
2626
"coverage",
2727
"pytest",
2828
"ruff",
29+
"tox",
30+
"tox-uv",
2931
"ty",
3032
]
3133

@@ -42,9 +44,21 @@ build-backend = "setuptools.build_meta"
4244
[tool.ruff]
4345
line-length = 100
4446

47+
[tool.coverage.paths]
48+
source = [
49+
"src/linklint",
50+
"*/site-packages/linklint",
51+
]
52+
tests = [
53+
"tests",
54+
"*/linklint/tests",
55+
]
56+
4557
[tool.coverage.run]
4658
branch = true
47-
source = ["src", "tests"]
59+
parallel = true
60+
source = ["tests"]
61+
source_pkgs = ["linklint"]
4862

4963
[tool.coverage.report]
5064
exclude_also = [
@@ -53,3 +67,5 @@ exclude_also = [
5367
"pragma: debugging",
5468
"if SAVE_INTERMEDIATE:",
5569
]
70+
show_missing = true
71+
skip_covered = true

tox.ini

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[tox]
2+
requires =
3+
tox>=4.32
4+
env_list = py3{12-15}, coverage
5+
6+
[testenv]
7+
extras =
8+
dev
9+
pass_env =
10+
FORCE_COLOR
11+
commands =
12+
coverage run -m pytest {posargs}
13+
14+
[testenv:coverage]
15+
depends = py3*
16+
commands =
17+
coverage combine -q
18+
coverage report -m
19+
coverage html

0 commit comments

Comments
 (0)