Skip to content

Commit 407e61a

Browse files
bmosshaunagm
andauthored
Documentation Tooling Updates (#1718)
* remove circleci documentation workflow * move makefile logic to make.py and update sphinx config * create new documentation workflow * add sphinx-lint dependency, job, and pre-commit hook * add final newline, trailing whitespace, and yaml+toml syntax checks to pre-commit workflow * resolve unsupported theme option 'display_version' given * update source_suffix from list to dictionary * add sphinx workflow cache * exclude sphinx outputs from git * fix copying of index redirect * indentation for index.html * use furo theme * add furo to requirements-dev * keep old build files < 5.0.0 between runs * Update dependency-review.yml to whitelist url and remove GHSA allowance Removed specific GHSA allowance from dependency review action. * add pydocstyle ruff rules * reduce_rows raw docstring * run pre-commit * Delete .circleci directory * add make.py and conf.py to sphinx cache key --------- Co-authored-by: Shauna Gordon-McKeon <shaunagm@gmail.com>
1 parent 9574b40 commit 407e61a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+407
-477
lines changed

.circleci/config.yml

Lines changed: 0 additions & 137 deletions
This file was deleted.
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Documentation CI/CD
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
- major-release
10+
11+
permissions: read-all
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9
19+
with:
20+
disable-sudo: true
21+
egress-policy: block
22+
allowed-endpoints: >
23+
files.pythonhosted.org:443
24+
github.com:443
25+
pypi.org:443
26+
27+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
28+
with:
29+
# If it's a push (main or major-release) or workflow_dispatch, get full history.
30+
fetch-depth: ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && 0 || 1 }}
31+
32+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
33+
with:
34+
python-version: '3.13'
35+
cache: pip
36+
37+
- uses: install-pinned/uv@259f91feb61b6e94766d7a1dbcd5f17335370e64
38+
39+
- run: |
40+
uv pip install --system -e .[all]
41+
uv pip install --system -r requirements-dev.txt
42+
43+
- name: configure git
44+
run: |
45+
git config user.name "github-actions"
46+
git config user.email "github-actions@github.com"
47+
48+
- uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306
49+
with:
50+
path: docs/html
51+
key: >-
52+
sphinx
53+
-${{ hashFiles('pyproject.toml') }}
54+
-${{ hashFiles('setup.py') }}
55+
-${{ hashFiles('requirements-dev.txt') }}
56+
-${{ hashFiles('docs/make.py') }}
57+
-${{ hashFiles('docs/conf.py') }}
58+
59+
- run: make build_docs
60+
working-directory: docs
61+
62+
- uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b
63+
with:
64+
path: docs/html/
65+
66+
deploy:
67+
needs: build
68+
# Only run this job if triggered by updating the main branch
69+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
70+
71+
runs-on: ubuntu-latest
72+
73+
permissions:
74+
pages: write
75+
id-token: write
76+
77+
environment:
78+
name: github-pages
79+
url: ${{ steps.deployment.outputs.page_url }}
80+
81+
steps:
82+
- uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9
83+
with:
84+
disable-sudo: true
85+
egress-policy: audit
86+
87+
- uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e

.github/workflows/python-checks.yml

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ env:
2121
ENDPOINT_WHITELIST: >-
2222
pypi.org:443
2323
github.com:443
24+
releases.astral.sh
2425
files.pythonhosted.org:443
2526
*.github.com:443
2627
*.githubusercontent.com:443
@@ -54,13 +55,7 @@ jobs:
5455
with:
5556
disable-sudo: true
5657
egress-policy: block
57-
allowed-endpoints: >
58-
api.github.com:443
59-
auth.docker.io:443
60-
files.pythonhosted.org:443
61-
github.com:443
62-
pypi.org:443
63-
raw.githubusercontent.com:443
58+
allowed-endpoints: auth.docker.io:443 ${{ env.ENDPOINT_WHITELIST}}
6459

6560
- run: |
6661
echo "\
@@ -332,13 +327,44 @@ jobs:
332327
name: python-coverage-comment-action
333328
path: python-coverage-comment-action.txt
334329

330+
sphinx-lint:
331+
runs-on: ubuntu-latest
332+
333+
steps:
334+
- uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9
335+
with:
336+
disable-sudo: true
337+
egress-policy: block
338+
allowed-endpoints: >
339+
files.pythonhosted.org:443
340+
github.com:443
341+
pypi.org:443
342+
343+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
344+
345+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
346+
with:
347+
python-version: '3.13'
348+
cache: pip
349+
350+
- uses: install-pinned/uv@259f91feb61b6e94766d7a1dbcd5f17335370e64
351+
352+
- run: |
353+
uv pip install --system -e .[all]
354+
uv pip install --system -r requirements-dev.txt
355+
356+
- run: sphinx-lint docs
357+
358+
- run: sphinx-lint parsons
359+
335360
pre-commit:
336361
runs-on: ubuntu-latest
337362

338363
needs:
364+
- bandit
339365
- ruff-format
340366
- ruff-check
341-
- bandit
367+
- sphinx-lint
342368

343369
permissions:
344370
contents: write

.pre-commit-config.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
11
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v6.0.0
4+
hooks:
5+
- id: check-toml
6+
- id: check-yaml
7+
- id: end-of-file-fixer
8+
- id: trailing-whitespace
9+
210
- repo: https://github.com/astral-sh/ruff-pre-commit
311
rev: v0.13.0
412
hooks:
513
- id: ruff-check
6-
args: ['--fix']
14+
args: ['--fix']
715
- id: ruff-format
16+
817
- repo: https://github.com/PyCQA/bandit
918
rev: 1.8.6
1019
hooks:
1120
- id: bandit
1221
args: ['--confidence-level', 'medium', '--severity-level', 'medium', '--exclude', '**/vendor/*']
1322
files: '^parsons'
23+
24+
- repo: https://github.com/sphinx-contrib/sphinx-lint
25+
rev: v1.0.2
26+
hooks:
27+
- id: sphinx-lint

docs/Makefile

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,16 @@
1-
# Minimal makefile for Sphinx documentation
2-
#
1+
PYTHON := python3
2+
SCRIPT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
3+
SCRIPT := $(SCRIPT_DIR)make.py
34

4-
# You can set these variables from the command line.
5-
SPHINXOPTS = -a
6-
SPHINXBUILD = sphinx-build
7-
SPHINXPROJ = Parsons
8-
SOURCEDIR = .
9-
BUILDDIR = .
5+
.PHONY: % check_python
106

11-
# Put it first so that "make" without argument is like "make help".
12-
help:
13-
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
7+
Makefile: ;
148

15-
deploy_docs:
16-
git branch latest
17-
git branch stable $$(git tag -l --sort=creatordate | tail -1)
18-
sphinx-multiversion . html
19-
cp ./index-redirect.html html/index.html
9+
%: check_python
10+
@$(PYTHON) "$(SCRIPT)" $@ $(filter-out $@,$(MAKECMDGOALS))
2011

21-
.PHONY: help Makefile
12+
check_python:
13+
@$(PYTHON) --version > /dev/null 2>&1 || (echo "Error: Python not found."; exit 1)
2214

23-
# Catch-all target: route all unknown targets to Sphinx using the new
24-
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
25-
%: Makefile
26-
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
15+
$(filter-out $(firstword $(MAKECMDGOALS)),$(MAKECMDGOALS)):
16+
@:

docs/_template.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,3 @@ API
3636
.. autoclass:: parsons.yourconnector.yourconnector.YourConnector
3737
:inherited-members:
3838
:members:
39-

0 commit comments

Comments
 (0)