-
Notifications
You must be signed in to change notification settings - Fork 0
242 lines (203 loc) Β· 6.43 KB
/
documentation.yml
File metadata and controls
242 lines (203 loc) Β· 6.43 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
name: Documentation
on:
push:
branches: [ main ]
paths:
- 'docs/**'
- 'README.md'
- 'CONTRIBUTING.md'
- 'CHANGELOG.md'
- 'src/**'
pull_request:
branches: [ main ]
paths:
- 'docs/**'
- 'README.md'
- 'CONTRIBUTING.md'
- 'CHANGELOG.md'
- 'src/**'
jobs:
validate-docs:
name: Validate Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18.x'
- name: Check documentation structure
run: |
echo "π Checking documentation structure..."
# Required documentation files
required_files=(
"README.md"
"CHANGELOG.md"
"CONTRIBUTING.md"
"docs/ARCHITECTURE.md"
"docs/DEPLOYMENT.md"
"docs/PROJECT_STRUCTURE.md"
)
missing_files=()
for file in "${required_files[@]}"; do
if [ ! -f "$file" ]; then
missing_files+=("$file")
fi
done
if [ ${#missing_files[@]} -ne 0 ]; then
echo "β Missing required documentation files:"
printf '%s\n' "${missing_files[@]}"
exit 1
fi
echo "β
All required documentation files present"
- name: Check documentation quality
run: |
echo "π Checking documentation quality..."
# Check for empty files
for file in docs/*.md README.md CONTRIBUTING.md CHANGELOG.md; do
if [ -f "$file" ] && [ ! -s "$file" ]; then
echo "β Empty documentation file: $file"
exit 1
fi
done
# Check for basic content in README
if ! grep -q "# GGcode Compiler" README.md; then
echo "β README.md missing main title"
exit 1
fi
if ! grep -q "## Installation" README.md; then
echo "β οΈ README.md missing Installation section"
fi
if ! grep -q "## Usage" README.md; then
echo "β οΈ README.md missing Usage section"
fi
echo "β
Documentation quality checks passed"
- name: Check for outdated documentation
run: |
echo "π
Checking for potentially outdated documentation..."
# Get last modification times
readme_time=$(git log -1 --format="%ct" -- README.md 2>/dev/null || echo "0")
src_time=$(git log -1 --format="%ct" -- src/ 2>/dev/null || echo "0")
# If source code is newer than README by more than 30 days
time_diff=$((src_time - readme_time))
days_diff=$((time_diff / 86400))
if [ "$days_diff" -gt 30 ]; then
echo "β οΈ README.md might be outdated (source code changed $days_diff days after README)"
fi
# Check if package.json version matches CHANGELOG
if [ -f "package.json" ] && [ -f "CHANGELOG.md" ]; then
version=$(node -p "require('./package.json').version")
if ! grep -q "## \[$version\]" CHANGELOG.md; then
echo "β οΈ CHANGELOG.md missing entry for current version $version"
fi
fi
spell-check:
name: Spell Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install aspell
run: sudo apt-get install -y aspell aspell-en
- name: Create custom dictionary
run: |
cat > .aspell.en.pws << 'EOF'
personal_ws-1.1 en 50
GGcode
ggcode
gcode
API
APIs
CLI
npm
Node.js
JavaScript
TypeScript
ESLint
Prettier
Monaco
Three.js
WebGL
JSON
HTTP
HTTPS
SSL
TLS
Docker
nginx
PM2
systemd
Ubuntu
CentOS
macOS
Windows
GitHub
GitLab
CI/CD
README
CHANGELOG
middleware
webpack
babel
async
await
localhost
EOF
- name: Spell check documentation
run: |
echo "π Running spell check on documentation..."
# Check markdown files
for file in README.md CONTRIBUTING.md CHANGELOG.md docs/*.md; do
if [ -f "$file" ]; then
echo "Checking $file..."
# Extract text content and check spelling
# Remove code blocks, URLs, and technical terms
cat "$file" | \
sed 's/```[^`]*```//g' | \
sed 's/`[^`]*`//g' | \
sed 's/http[s]\?:\/\/[^ ]*//g' | \
sed 's/\[[^\]]*\]([^)]*)//g' | \
aspell --personal=.aspell.en.pws --lang=en list | \
sort -u > "$file.misspelled"
if [ -s "$file.misspelled" ]; then
echo "β οΈ Potential misspellings in $file:"
cat "$file.misspelled"
fi
rm -f "$file.misspelled"
fi
done
generate-api-docs:
name: Generate API Documentation
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18.x'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Generate JSDoc documentation
run: |
# Install JSDoc if not already installed
npm install -g jsdoc
# Generate API documentation
mkdir -p docs/api
jsdoc -c .jsdoc.json -d docs/api src/server/routes/*.js src/server/services/*.js
echo "π API documentation generated in docs/api/"
- name: Commit generated documentation
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
if [ -n "$(git status --porcelain docs/api/)" ]; then
git add docs/api/
git commit -m "docs: update generated API documentation"
git push
echo "β
API documentation updated and committed"
else
echo "βΉοΈ No changes to API documentation"
fi