Skip to content

Commit 8c75b2c

Browse files
committed
Add sphinx docs, security scripts, fix CI workflow
1 parent cda0ec2 commit 8c75b2c

File tree

7 files changed

+1202
-198
lines changed

7 files changed

+1202
-198
lines changed

.github/workflows/ci.yml

Lines changed: 52 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ jobs:
3838

3939
steps:
4040
- name: Checkout
41-
uses: actions/checkout@v4
41+
uses: actions/checkout@v5
4242

4343
- name: Install uv
44-
uses: astral-sh/setup-uv@v4
44+
uses: astral-sh/setup-uv@v7
4545
with:
4646
enable-cache: true
4747

@@ -66,52 +66,39 @@ jobs:
6666
shell: bash
6767
run: |
6868
set -euo pipefail
69-
if grep -R --line-number -E "\beval\(|\bexec\(|pickle\.loads|yaml\.load(?!_safe)|subprocess\.(Popen|call)" src/ tests/ || true; then
69+
if grep -rn -E '\beval\(|\bexec\(|pickle\.loads|yaml\.load\(|subprocess\.(Popen|call)\(' src/ tests/ 2>/dev/null | grep -v 'yaml\.load_safe' || true; then
7070
echo "⚠️ Potentially dangerous API usage detected. Please review." >&2
7171
exit 2
7272
fi
7373
7474
- name: Upload coverage.xml
75-
uses: actions/upload-artifact@v4
75+
uses: actions/upload-artifact@v5
7676
with:
7777
name: coverage-${{ matrix.python-version }}
7878
path: coverage.xml
7979

8080
- name: Upload coverage HTML
81-
uses: actions/upload-artifact@v4
81+
uses: actions/upload-artifact@v5
8282
with:
8383
name: coverage-html-${{ matrix.python-version }}
8484
path: htmlcov
8585

86-
# Upload Codecov once to avoid noisy duplicate uploads
87-
- name: Upload to Codecov
88-
if: matrix.python-version == '3.11'
89-
uses: codecov/codecov-action@v4
90-
with:
91-
files: coverage.xml
92-
flags: unittests
93-
fail_ci_if_error: false
94-
env:
95-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
96-
9786
security:
98-
name: Security Scan (Bandit + Safety)
87+
name: Security Scan (Bandit)
9988
runs-on: ubuntu-latest
10089
needs: test
101-
# Grant code scanning upload only here
10290
permissions:
10391
contents: read
104-
security-events: write
10592

10693
env:
10794
SECURITY_FAIL_LEVEL: MEDIUM
10895

10996
steps:
11097
- name: Checkout
111-
uses: actions/checkout@v4
98+
uses: actions/checkout@v5
11299

113100
- name: Install uv
114-
uses: astral-sh/setup-uv@v4
101+
uses: astral-sh/setup-uv@v7
115102
with:
116103
enable-cache: true
117104

@@ -121,33 +108,57 @@ jobs:
121108
- name: Sync dependencies
122109
run: uv sync --all-extras --dev
123110

124-
- name: Run Bandit (JSON + SARIF)
111+
- name: Run Bandit (JSON)
125112
run: |
126-
uv run bandit -r src/ -f json -o bandit-report.json || true
127-
uv run bandit -r src/ -f sarif -o bandit-report.sarif || true
128-
129-
- name: Upload Bandit SARIF to GitHub Code Scanning
130-
uses: github/codeql-action/upload-sarif@v3
131-
with:
132-
sarif_file: bandit-report.sarif
133-
continue-on-error: true
134-
135-
- name: Run Safety (JSON)
136-
run: uv run safety check --json > safety-report.json || true
113+
uv run bandit -r src/ -f json -o bandit-report.json || true
114+
uv run bandit -r src/ -f txt
137115
138116
- name: Apply Bandit threshold
139117
run: uv run python scripts/security_bandit_check.py
140118
continue-on-error: true
141119

142-
- name: Fail on Safety vulnerabilities
143-
run: uv run python scripts/security_safety_check.py
144-
145120
- name: Upload security reports
146121
if: always()
147-
uses: actions/upload-artifact@v4
122+
uses: actions/upload-artifact@v5
148123
with:
149124
name: security-reports
150-
path: |
151-
bandit-report.json
152-
bandit-report.sarif
153-
safety-report.json
125+
path: bandit-report.json
126+
127+
docs:
128+
name: Build Documentation
129+
runs-on: ubuntu-latest
130+
needs: test
131+
permissions:
132+
contents: write # Needed for GitHub Pages deployment
133+
134+
steps:
135+
- name: Checkout
136+
uses: actions/checkout@v5
137+
138+
- name: Install uv
139+
uses: astral-sh/setup-uv@v7
140+
with:
141+
enable-cache: true
142+
143+
- name: Set up Python
144+
run: uv python install 3.11
145+
146+
- name: Sync dependencies (includes sphinx)
147+
run: uv sync --all-extras --dev
148+
149+
- name: Build documentation
150+
run: uv run sphinx-build -b html docs docs/_build/html
151+
152+
- name: Upload documentation artifacts
153+
uses: actions/upload-artifact@v5
154+
with:
155+
name: documentation
156+
path: docs/_build/html
157+
158+
- name: Deploy to GitHub Pages
159+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
160+
uses: peaceiris/actions-gh-pages@v3
161+
with:
162+
github_token: ${{ secrets.GITHUB_TOKEN }}
163+
publish_dir: ./docs/_build/html
164+
keep_files: false

.github/workflows/docs-pages.yml

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

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,6 @@ tmp/
6666
# Security scan results
6767
scan_results/
6868
*.scan.json
69+
70+
# Sphinx documentation build output (generated files only)
71+
docs/_build/

PRE_COMMIT_SETUP.md

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

coverage.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" ?>
2-
<coverage version="7.11.0" timestamp="1762119452943" lines-valid="563" lines-covered="287" line-rate="0.5098" branches-valid="134" branches-covered="35" branch-rate="0.2612" complexity="0">
2+
<coverage version="7.11.0" timestamp="1762121954607" lines-valid="563" lines-covered="287" line-rate="0.5098" branches-valid="134" branches-covered="35" branch-rate="0.2612" complexity="0">
33
<!-- Generated by coverage.py: https://coverage.readthedocs.io/en/7.11.0 -->
44
<!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd -->
55
<sources>

pyproject.toml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,27 @@ classifiers = [
2525
dependencies = [
2626
"aiohttp>=3.9.0",
2727
"beautifulsoup4>=4.12.0",
28-
"click>=8.1.0",
29-
"pydantic>=2.5.0",
28+
"click>=8.3.0",
29+
"pydantic>=2.12.3",
3030
]
3131

3232
[project.optional-dependencies]
3333
dev = [
34-
"pytest>=8.0.0",
34+
"pytest>=8.4.2",
3535
"pytest-asyncio>=0.23.0",
36-
"pytest-cov>=4.1.0",
36+
"pytest-cov>=7.0.0",
3737
"pytest-mock>=3.12.0",
3838
"hypothesis>=6.92.0",
39-
"mypy>=1.11.0",
40-
"ruff>=0.6.0",
41-
"black>=24.0.0",
42-
"pre-commit>=3.8.0",
43-
"bandit>=1.7.0",
44-
"safety>=3.0.0",
39+
"mypy>=1.18.2",
40+
"ruff>=0.14.3",
41+
"black>=25.9.0",
42+
"isort>=7.0.0",
43+
"pre-commit>=4.3.0",
44+
"bandit>=1.8.6",
45+
"safety>=3.6.2",
46+
"sphinx>=8.2.3",
47+
"sphinx-rtd-theme>=3.0.2",
48+
"sphinx-autodoc-typehints>=3.5.2",
4549
]
4650

4751
[project.scripts]
@@ -250,5 +254,6 @@ sitescanner5000 = { workspace = true }
250254

251255
[dependency-groups]
252256
dev = [
253-
"sitescanner5000[dev]",
257+
"sphinx>=8.2.3",
258+
"sphinx-rtd-theme>=3.0.2",
254259
]

0 commit comments

Comments
 (0)