Skip to content

Commit db607da

Browse files
authored
Merge pull request #169 from consideRatio/pr/misc
maint: use pytest-cov, cleanup docs/requirements.txt, and reduce rate limiting issues in CI
2 parents 7e2d920 + 25e03fb commit db607da

6 files changed

Lines changed: 46 additions & 25 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- uses: actions/setup-python@v6
1818

1919
with:
20-
python-version: 3.13
20+
python-version: "3.14"
2121

2222
- name: Build package
2323
run: |

.github/workflows/tests.yaml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ on:
88
- "v*"
99
workflow_dispatch:
1010

11+
permissions:
12+
contents: read
13+
14+
concurrency:
15+
# To reduce rate limitation issues, avoid running multiple workflows in
16+
# paralell for the same git ref (PR / branch / tag) at the same time by
17+
# discarding older in-progress runs in favor of the newest.
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
1121
jobs:
1222
pre-commit:
1323
runs-on: ubuntu-24.04
@@ -17,7 +27,7 @@ jobs:
1727
- uses: actions/checkout@v6
1828
- uses: actions/setup-python@v6
1929
with:
20-
python-version: 3.13
30+
python-version: "3.14"
2131

2232
# ref: https://github.com/pre-commit/action
2333
- uses: pre-commit/action@v3.0.1
@@ -35,16 +45,16 @@ jobs:
3545
tests:
3646
runs-on: ubuntu-24.04
3747
env:
38-
# Use TOKEN_READONLY if available (pushed branches), otherwise use GITHUB_TOKEN (PRs)
39-
# TOKEN_READONLY is a PAT for @choldgraf that only has read-access to this repo but isn't available in PRs.
40-
GITHUB_ACCESS_TOKEN: "${{ secrets.TOKEN_READONLY || secrets.GITHUB_TOKEN }}"
48+
GITHUB_ACCESS_TOKEN: "${{ github.token }}"
4149
strategy:
50+
# max-parallel declared to reduce rate limitation issues
51+
max-parallel: 1
4252
matrix:
4353
include:
4454
# Only test oldest supported and latest python version to reduce
4555
# GitHub API calls, as they can get rate limited
46-
- python-version: "3.10"
4756
- python-version: 3.x
57+
- python-version: "3.10"
4858

4959
steps:
5060
- uses: actions/checkout@v6
@@ -54,10 +64,10 @@ jobs:
5464
- name: Install dependencies
5565
run: |
5666
python -m pip install --upgrade pip
57-
pip install -e .[testing]
67+
pip install -e ".[testing]"
5868
5969
- name: Run tests
60-
run: pytest --verbose --color=yes --durations=10
70+
run: pytest
6171

6272
docs:
6373
runs-on: ubuntu-24.04
@@ -66,11 +76,11 @@ jobs:
6676
- uses: actions/checkout@v6
6777
- uses: actions/setup-python@v6
6878
with:
69-
python-version: 3.13
79+
python-version: "3.14"
7080
- name: Install dependencies
7181
run: |
7282
python -m pip install --upgrade pip
73-
pip install -e .[sphinx]
83+
pip install -e ".[sphinx]"
7484
7585
- name: Build docs
7686
run: |

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ sphinx:
1111
build:
1212
os: ubuntu-24.04
1313
tools:
14-
python: "3.13"
14+
python: "3.14"
1515

1616
python:
1717
install:

docs/requirements.txt

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

noxfile.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
@nox.session
77
def changelog(session):
88
"""Run github activity on this repository with the current repo."""
9-
session.install("-r", "requirements.txt")
109
session.install("-e", ".")
1110

1211
# Run github activity and re-use the posargs
@@ -18,7 +17,6 @@ def changelog(session):
1817
def docs(session):
1918
"""Run github activity on this repository with the current repo."""
2019
session.install("-e", ".[sphinx]")
21-
session.install("-r", "docs/requirements.txt")
2220

2321
if "live" in session.posargs:
2422
session.install("sphinx-autobuild")
@@ -38,9 +36,8 @@ def docs(session):
3836
@nox.session
3937
def test(session):
4038
"""Run github activity on this repository with the current repo."""
41-
session.install("-r", "requirements.txt")
4239
session.install("-e", ".[testing]")
4340

4441
# Run github activity and re-use the posargs
45-
cmd = ["pytest", "--verbose", "--durations=10"] + session.posargs
42+
cmd = ["pytest"] + session.posargs
4643
session.run(*cmd)

pyproject.toml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
requires = ["setuptools>=77", "setuptools-scm"]
33
build-backend = "setuptools.build_meta"
44

5+
56
[project]
67
name = "github_activity"
78
description = "Grab recent issue/PR activity from a GitHub repository and render it as markdown."
@@ -23,17 +24,20 @@ Source = "https://github.com/executablebooks/github-activity"
2324
[project.optional-dependencies]
2425
testing = [
2526
"pytest",
27+
"pytest-cov",
2628
"pytest-regressions",
2729
]
2830
sphinx = [
29-
"sphinx",
3031
"myst_parser",
31-
"sphinx_book_theme",
32+
"sphinx>=5",
33+
"sphinx-design",
34+
"sphinx_book_theme>=1",
3235
]
3336

3437
[project.scripts]
3538
github-activity = "github_activity.cli:main"
3639

40+
3741
[tool.setuptools]
3842
zip-safe = false
3943
include-package-data = true
@@ -52,8 +56,25 @@ dependencies = { file = "requirements.txt" }
5256
# only the file-finder
5357
fallback_version = "0.0.0"
5458

59+
60+
[tool.ruff.lint.per-file-ignores]
61+
"docs/conf.py" = ["E402"]
62+
63+
64+
# pytest is used for running Python based tests
65+
#
66+
# ref: https://docs.pytest.org/en/stable/
67+
#
68+
[tool.pytest.ini_options]
69+
addopts = "--verbose --color=yes --durations=10 --cov=github_activity"
70+
testpaths = ["tests"]
71+
72+
73+
[tool.coverage.run]
74+
patch = ["subprocess"]
75+
76+
5577
[tool.tbump]
56-
# Uncomment this if your project is hosted on GitHub:
5778
github_url = "https://github.com/executablebooks/github-activity"
5879

5980
[tool.tbump.version]
@@ -81,6 +102,3 @@ search = 'version = "{current_version}"'
81102
[[tool.tbump.file]]
82103
src = "github_activity/__init__.py"
83104
search = '__version__ = "{current_version}"'
84-
85-
[tool.ruff.lint.per-file-ignores]
86-
"docs/conf.py" = ["E402"]

0 commit comments

Comments
 (0)