From 7d6913e7793ca9700c128a279556350612313c0c Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Thu, 7 May 2026 07:47:23 +0200 Subject: [PATCH 1/5] ci: do things in a Python 3.14 environment instead of 3.13 --- .github/workflows/publish.yaml | 2 +- .github/workflows/tests.yaml | 10 +++++----- .readthedocs.yaml | 2 +- pyproject.toml | 3 ++- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index dd7ec0a..0daa79e 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -17,7 +17,7 @@ jobs: - uses: actions/setup-python@v6 with: - python-version: 3.13 + python-version: "3.14" - name: Build package run: | diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 8cfc020..7574a1e 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -17,7 +17,7 @@ jobs: - uses: actions/checkout@v6 - uses: actions/setup-python@v6 with: - python-version: 3.13 + python-version: "3.14" # ref: https://github.com/pre-commit/action - uses: pre-commit/action@v3.0.1 @@ -54,10 +54,10 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -e .[testing] + pip install -e ".[testing]" - name: Run tests - run: pytest --verbose --color=yes --durations=10 + run: pytest docs: runs-on: ubuntu-24.04 @@ -66,11 +66,11 @@ jobs: - uses: actions/checkout@v6 - uses: actions/setup-python@v6 with: - python-version: 3.13 + python-version: "3.14" - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -e .[sphinx] + pip install -e ".[sphinx]" - name: Build docs run: | diff --git a/.readthedocs.yaml b/.readthedocs.yaml index fc828b2..649279a 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -11,7 +11,7 @@ sphinx: build: os: ubuntu-24.04 tools: - python: "3.13" + python: "3.14" python: install: diff --git a/pyproject.toml b/pyproject.toml index ff787a6..c0d1a96 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,6 +2,7 @@ requires = ["setuptools>=77", "setuptools-scm"] build-backend = "setuptools.build_meta" + [project] name = "github_activity" description = "Grab recent issue/PR activity from a GitHub repository and render it as markdown." @@ -34,6 +35,7 @@ sphinx = [ [project.scripts] github-activity = "github_activity.cli:main" + [tool.setuptools] zip-safe = false include-package-data = true @@ -53,7 +55,6 @@ dependencies = { file = "requirements.txt" } fallback_version = "0.0.0" [tool.tbump] -# Uncomment this if your project is hosted on GitHub: github_url = "https://github.com/executablebooks/github-activity" [tool.tbump.version] From e5ede8c8c54cabc4124e1bee1156854f1705a2ff Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Thu, 7 May 2026 07:48:22 +0200 Subject: [PATCH 2/5] tests: use pytest-cov for test coverage summaries --- noxfile.py | 2 +- pyproject.toml | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/noxfile.py b/noxfile.py index a9fff29..f95e5f5 100644 --- a/noxfile.py +++ b/noxfile.py @@ -42,5 +42,5 @@ def test(session): session.install("-e", ".[testing]") # Run github activity and re-use the posargs - cmd = ["pytest", "--verbose", "--durations=10"] + session.posargs + cmd = ["pytest"] + session.posargs session.run(*cmd) diff --git a/pyproject.toml b/pyproject.toml index c0d1a96..3a7bef2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,6 +24,7 @@ Source = "https://github.com/executablebooks/github-activity" [project.optional-dependencies] testing = [ "pytest", + "pytest-cov", "pytest-regressions", ] sphinx = [ @@ -54,6 +55,24 @@ dependencies = { file = "requirements.txt" } # only the file-finder fallback_version = "0.0.0" + +[tool.ruff.lint.per-file-ignores] +"docs/conf.py" = ["E402"] + + +# pytest is used for running Python based tests +# +# ref: https://docs.pytest.org/en/stable/ +# +[tool.pytest.ini_options] +addopts = "--verbose --color=yes --durations=10 --cov=github_activity" +testpaths = ["tests"] + + +[tool.coverage.run] +patch = ["subprocess"] + + [tool.tbump] github_url = "https://github.com/executablebooks/github-activity" @@ -82,6 +101,3 @@ search = 'version = "{current_version}"' [[tool.tbump.file]] src = "github_activity/__init__.py" search = '__version__ = "{current_version}"' - -[tool.ruff.lint.per-file-ignores] -"docs/conf.py" = ["E402"] From 45fd099e0f6d16296d05018daa721ff5a8705228 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Thu, 7 May 2026 07:53:57 +0200 Subject: [PATCH 3/5] cleanup: coalesce install strategies of docs requirements --- docs/requirements.txt | 4 ---- noxfile.py | 3 --- pyproject.toml | 5 +++-- 3 files changed, 3 insertions(+), 9 deletions(-) delete mode 100644 docs/requirements.txt diff --git a/docs/requirements.txt b/docs/requirements.txt deleted file mode 100644 index 5173f70..0000000 --- a/docs/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -myst-parser -sphinx>=5 -sphinx-book-theme>=1 -sphinx-design diff --git a/noxfile.py b/noxfile.py index f95e5f5..170b8d7 100644 --- a/noxfile.py +++ b/noxfile.py @@ -6,7 +6,6 @@ @nox.session def changelog(session): """Run github activity on this repository with the current repo.""" - session.install("-r", "requirements.txt") session.install("-e", ".") # Run github activity and re-use the posargs @@ -18,7 +17,6 @@ def changelog(session): def docs(session): """Run github activity on this repository with the current repo.""" session.install("-e", ".[sphinx]") - session.install("-r", "docs/requirements.txt") if "live" in session.posargs: session.install("sphinx-autobuild") @@ -38,7 +36,6 @@ def docs(session): @nox.session def test(session): """Run github activity on this repository with the current repo.""" - session.install("-r", "requirements.txt") session.install("-e", ".[testing]") # Run github activity and re-use the posargs diff --git a/pyproject.toml b/pyproject.toml index 3a7bef2..a2e71a7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,9 +28,10 @@ testing = [ "pytest-regressions", ] sphinx = [ - "sphinx", "myst_parser", - "sphinx_book_theme", + "sphinx>=5", + "sphinx-design", + "sphinx_book_theme>=1", ] [project.scripts] From b72d59a7f9c97a0e01b4175a406bf2f82064fcc6 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Thu, 7 May 2026 08:11:07 +0200 Subject: [PATCH 4/5] ci: rename secrets.GITHUB_TOKEN to github.token for clarity It becomes clear that this isn't a repo configured secret, but the token made available by github's system. --- .github/workflows/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 7574a1e..b9311d0 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -37,7 +37,7 @@ jobs: env: # Use TOKEN_READONLY if available (pushed branches), otherwise use GITHUB_TOKEN (PRs) # TOKEN_READONLY is a PAT for @choldgraf that only has read-access to this repo but isn't available in PRs. - GITHUB_ACCESS_TOKEN: "${{ secrets.TOKEN_READONLY || secrets.GITHUB_TOKEN }}" + GITHUB_ACCESS_TOKEN: "${{ secrets.TOKEN_READONLY || github.token }}" strategy: matrix: include: From 25e03fbb0ac25e92187d5a41b8d2b5dffe04301e Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Thu, 7 May 2026 08:22:15 +0200 Subject: [PATCH 5/5] ci: reduce API burden and stop using a PAT in trusted workflows --- .github/workflows/tests.yaml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index b9311d0..126c782 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -8,6 +8,16 @@ on: - "v*" workflow_dispatch: +permissions: + contents: read + +concurrency: + # To reduce rate limitation issues, avoid running multiple workflows in + # paralell for the same git ref (PR / branch / tag) at the same time by + # discarding older in-progress runs in favor of the newest. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: pre-commit: runs-on: ubuntu-24.04 @@ -35,16 +45,16 @@ jobs: tests: runs-on: ubuntu-24.04 env: - # Use TOKEN_READONLY if available (pushed branches), otherwise use GITHUB_TOKEN (PRs) - # TOKEN_READONLY is a PAT for @choldgraf that only has read-access to this repo but isn't available in PRs. - GITHUB_ACCESS_TOKEN: "${{ secrets.TOKEN_READONLY || github.token }}" + GITHUB_ACCESS_TOKEN: "${{ github.token }}" strategy: + # max-parallel declared to reduce rate limitation issues + max-parallel: 1 matrix: include: # Only test oldest supported and latest python version to reduce # GitHub API calls, as they can get rate limited - - python-version: "3.10" - python-version: 3.x + - python-version: "3.10" steps: - uses: actions/checkout@v6