Skip to content

Commit c63b984

Browse files
committed
ci: add test workflow for PR validation on master/main/en
1 parent c6fd881 commit c63b984

1 file changed

Lines changed: 64 additions & 0 deletions

File tree

.github/workflows/test.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Test MkDocs Build
2+
3+
on:
4+
pull_request:
5+
branches: [master, main, en]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- uses: actions/setup-python@v5
14+
with:
15+
python-version: '3.x'
16+
17+
- run: pip install mkdocs-material mkdocs-static-i18n
18+
19+
- name: Build site
20+
run: mkdocs build --strict
21+
22+
- name: Check all page URLs
23+
run: |
24+
# Start local server
25+
python -m http.server 8000 -d site &
26+
SERVER_PID=$!
27+
sleep 2
28+
29+
BASE_URL="http://localhost:8000"
30+
FAILED=0
31+
TOTAL=0
32+
33+
check_url() {
34+
local url="$1"
35+
TOTAL=$((TOTAL + 1))
36+
STATUS=$(curl -sf -o /dev/null -w "%{http_code}" "$url" || true)
37+
if [ "$STATUS" != "200" ]; then
38+
echo "FAIL [$STATUS]: $url"
39+
FAILED=$((FAILED + 1))
40+
else
41+
echo " OK: $url"
42+
fi
43+
}
44+
45+
# English pages (exclude es/hu subdirs)
46+
while IFS= read -r f; do
47+
rel="${f#docs/}"; rel="${rel%.md}"
48+
if [ "$rel" = "index" ]; then check_url "$BASE_URL/"; else check_url "$BASE_URL/$rel/"; fi
49+
done < <(find docs -name '*.md' -not -path 'docs/es/*' -not -path 'docs/hu/*' | sort)
50+
51+
# ES and HU pages
52+
for lang in es hu; do
53+
[ -d "docs/$lang" ] || continue
54+
while IFS= read -r f; do
55+
rel="${f#docs/$lang/}"; rel="${rel%.md}"
56+
if [ "$rel" = "index" ]; then check_url "$BASE_URL/$lang/"; else check_url "$BASE_URL/$lang/$rel/"; fi
57+
done < <(find "docs/$lang" -name '*.md' | sort)
58+
done
59+
60+
kill $SERVER_PID 2>/dev/null || true
61+
62+
echo ""
63+
echo "Checked: $TOTAL | Failed: $FAILED"
64+
[ "$FAILED" -eq 0 ]

0 commit comments

Comments
 (0)