-
Notifications
You must be signed in to change notification settings - Fork 0
161 lines (134 loc) · 5.1 KB
/
docs-test.yml
File metadata and controls
161 lines (134 loc) · 5.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# .github/workflows/docs-test.yml
# GitHub Actions workflow for testing documentation changes
# This workflow runs on PRs to validate documentation before deployment
name: Documentation Tests
on:
pull_request:
branches: [ "main", "develop" ]
paths:
- "docs/**"
- "mkdocs.yml"
- "src/**"
- ".github/workflows/docs-*.yml"
- "pyproject.toml"
workflow_dispatch:
env:
PYTHON_VERSION: "3.11"
POETRY_VERSION: "1.7.1"
jobs:
docs-test:
name: Test Documentation Build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: ${{ env.POETRY_VERSION }}
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load cached Poetry virtual environment
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-docs-test-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
venv-docs-test-${{ runner.os }}-${{ env.PYTHON_VERSION }}-
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --with docs
- name: Ensure dependencies are installed
run: poetry install --no-interaction --with docs
- name: Validate MkDocs configuration
run: |
echo "🔍 Validating MkDocs configuration..."
poetry run mkdocs build --clean --strict --quiet
- name: Test documentation build
run: |
echo "🏗️ Testing documentation build..."
poetry run mkdocs build --clean --strict --verbose
- name: Check for broken links
run: |
echo "Checking for broken internal links..."
# Use a simple grep to find potential broken links
find docs -name "*.md" -exec grep -l "]\(" {} \; | while read file; do
echo "Checking links in: $file"
# You could add more sophisticated link checking here
done
- name: Validate API documentation
run: |
echo "🔍 Validating API documentation generation..."
# Check that all expected API reference pages are generated
if [ ! -f "site/reference/main/index.html" ]; then
echo "❌ Main API reference page missing"
exit 1
fi
if [ ! -f "site/reference/config_manager/index.html" ]; then
echo "❌ Config manager API reference page missing"
exit 1
fi
echo "✅ API documentation validation passed"
- name: Check site structure
run: |
echo "Checking site structure..."
# Verify critical pages exist
critical_pages=(
"site/index.html"
"site/getting-started/installation/index.html"
"site/user-guide/cli-commands/index.html"
"site/reference/main/index.html"
)
for page in "${critical_pages[@]}"; do
if [ ! -f "$page" ]; then
echo "❌ Critical page missing: $page"
exit 1
fi
done
echo "✅ Site structure validation passed"
- name: Test LED effects assets
run: |
echo "Testing LED effects assets..."
# Check that CSS and JS files are properly included
if ! grep -q "led-text" site/stylesheets/extra.css; then
echo "❌ LED effects CSS missing"
exit 1
fi
if ! grep -q "initLEDEffects" site/javascripts/extra.js; then
echo "❌ LED effects JavaScript missing"
exit 1
fi
echo "✅ LED effects assets validation passed"
- name: Generate test report
if: always()
run: |
echo "Documentation Test Report" > docs_test_report.md
echo "=========================" >> docs_test_report.md
echo "" >> docs_test_report.md
echo "**Build Status:** ${{ job.status }}" >> docs_test_report.md
echo "**Python Version:** ${{ env.PYTHON_VERSION }}" >> docs_test_report.md
echo "**Timestamp:** $(date -u)" >> docs_test_report.md
echo "" >> docs_test_report.md
if [ -d "site" ]; then
echo "**Site Statistics:**" >> docs_test_report.md
echo "- Total files: $(find site -type f | wc -l)" >> docs_test_report.md
echo "- HTML pages: $(find site -name "*.html" | wc -l)" >> docs_test_report.md
echo "- Site size: $(du -sh site | cut -f1)" >> docs_test_report.md
fi
- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: docs-test-results
path: |
site/
docs_test_report.md
retention-days: 7