Skip to content

Commit bd0222d

Browse files
committed
ci: add comprehensive website CI/CD test suite
Removed old workflows: - deploy.yml, eosim-sanity.yml, link-check.yml, nightly.yml, release.yml, weekly.yml Added new website-focused CI/CD: 1. website-sanity.yml (on push/PR): - HTML W3C validation (html5validator) - Duplicate DOCTYPE detection (catches doubled files) - HTML structure validation (tag balance, unclosed divs) - Required files existence check (16 pages + CSS) - Meta tag validation (viewport, charset, title) - Internal link validation (href + src) - CSS syntax validation (brace balance, undefined vars, responsive breakpoints) - Mobile compatibility (viewport meta, hamburger menu, no fixed-width overflow) - Cross-page consistency (license, nav links) 2. website-performance.yml (on push/PR + weekly): - Lighthouse Desktop (6 key pages, thresholds: perf 70%, a11y/bp/seo 80%) - Lighthouse Mobile (4 key pages, thresholds: perf 50%, a11y/bp/seo 75%) - JSON result artifacts uploaded 3. website-e2e.yml (on push/PR): - Playwright responsive tests across 5 viewports (iPhone SE to 1080p) - Page load sanity (no JS errors, status < 400) - HTML structure (navbar + footer on every page) - Mobile horizontal overflow detection - Hamburger menu toggle verification - Desktop layout validation - Internal navigation link crawling - Interactive element testing (path switcher) - Visual sanity screenshots (30 captures: 5 viewports x 6 pages) - Screenshot artifacts uploaded 4. deploy.yml (on push to main): - Pre-deploy validation gate (required files, no duplicate DOCTYPE, link check) - GitHub Pages deployment only after validation passes
1 parent 9a7fa03 commit bd0222d

13 files changed

Lines changed: 1152 additions & 385 deletions

.github/workflows/deploy.yml

Lines changed: 58 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: Deploy to GitHub Pages
2-
32
on:
43
push:
54
branches: [main]
@@ -15,61 +14,82 @@ concurrency:
1514
cancel-in-progress: true
1615

1716
jobs:
18-
build:
17+
pre-deploy-checks:
18+
name: Pre-Deploy Validation
1919
runs-on: ubuntu-latest
2020
steps:
2121
- uses: actions/checkout@v4
2222

23-
- name: Validate HTML files exist
23+
- name: Verify all required files exist and are non-empty
2424
run: |
25-
for f in index.html getting-started.html kids.html hardware-lab.html flow.html \
26-
docs/index.html docs/eos.html docs/eboot.html docs/ebuild.html \
27-
docs/eai.html docs/eipc.html docs/eni.html docs/eosim.html \
28-
docs/eosuite.html docs/eostudio.html style.css; do
25+
REQUIRED=(
26+
index.html getting-started.html kids.html hardware-lab.html flow.html style.css
27+
docs/index.html docs/eos.html docs/eboot.html docs/ebuild.html
28+
docs/eai.html docs/eipc.html docs/eni.html docs/eosim.html
29+
docs/eosuite.html docs/eostudio.html
30+
)
31+
EXIT=0
32+
for f in "${REQUIRED[@]}"; do
2933
if [ ! -f "$f" ]; then
30-
echo "ERROR: Missing $f"
31-
exit 1
34+
echo "FAIL: Missing $f"; EXIT=1
35+
else
36+
SIZE=$(stat -c%s "$f")
37+
if [ "$SIZE" -lt 100 ]; then
38+
echo "FAIL: $f is too small ($SIZE bytes)"; EXIT=1
39+
else
40+
echo " OK: $f ($SIZE bytes)"
41+
fi
3242
fi
33-
SIZE=$(stat -c%s "$f" 2>/dev/null || stat -f%z "$f")
34-
if [ "$SIZE" -lt 100 ]; then
35-
echo "ERROR: $f is too small ($SIZE bytes)"
36-
exit 1
43+
done
44+
exit $EXIT
45+
46+
- name: Check no duplicate DOCTYPE
47+
run: |
48+
EXIT=0
49+
for f in $(find . -name '*.html' -not -path './.git/*' -not -path './node_modules/*'); do
50+
COUNT=$(grep -c '<!DOCTYPE' "$f" 2>/dev/null || echo 0)
51+
if [ "$COUNT" -gt 1 ]; then
52+
echo "FAIL: $f has $COUNT <!DOCTYPE> (duplicated content!)"; EXIT=1
3753
fi
38-
echo "OK: $f ($SIZE bytes)"
3954
done
55+
exit $EXIT
4056
41-
- name: Check for broken internal links
57+
- name: Check internal links
4258
run: |
4359
python3 -c "
44-
import os, re
60+
import os, re, sys
4561
errors = []
4662
for root, dirs, files in os.walk('.'):
47-
if '.git' in root: continue
48-
for f in files:
49-
if not f.endswith('.html'): continue
50-
path = os.path.join(root, f)
51-
content = open(path).read()
52-
for m in re.finditer(r'href=\"([^#][^:][^\"]*\.html)', content):
53-
link = m.group(1)
54-
target = os.path.normpath(os.path.join(os.path.dirname(path), link))
55-
if not os.path.exists(target):
56-
errors.append(f'{path}: broken link to {link}')
63+
if '.git' in root or 'node_modules' in root: continue
64+
for f in files:
65+
if not f.endswith('.html'): continue
66+
path = os.path.join(root, f)
67+
content = open(path).read()
68+
for m in re.finditer(r'href=\"([^\"]*\.html)', content):
69+
href = m.group(1)
70+
if href.startswith(('http','#')): continue
71+
target = os.path.normpath(os.path.join(os.path.dirname(path), href.split('#')[0]))
72+
if not os.path.exists(target):
73+
errors.append(f'{path}: broken -> {href}')
5774
if errors:
58-
for e in errors: print('ERROR:', e)
59-
exit(1)
60-
print(f'All internal links valid')
75+
for e in errors: print('FAIL:', e)
76+
sys.exit(1)
77+
print('All links valid')
6178
"
6279
63-
- uses: actions/configure-pages@v4
64-
- uses: actions/upload-pages-artifact@v3
65-
with:
66-
path: .
67-
6880
deploy:
81+
name: Deploy
82+
needs: pre-deploy-checks
83+
runs-on: ubuntu-latest
6984
environment:
7085
name: github-pages
71-
url: ${{ github.event.repository.homepage }}
72-
runs-on: ubuntu-latest
73-
needs: build
86+
url: ${{ steps.deployment.outputs.page_url }}
7487
steps:
75-
- uses: actions/deploy-pages@v4
88+
- uses: actions/checkout@v4
89+
- uses: actions/configure-pages@v4
90+
- uses: actions/upload-pages-artifact@v3
91+
with:
92+
path: .
93+
- name: Deploy to GitHub Pages
94+
id: deployment
95+
uses: actions/deploy-pages@v4

.github/workflows/eosim-sanity.yml

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

.github/workflows/link-check.yml

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

.github/workflows/nightly.yml

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

.github/workflows/release.yml

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

0 commit comments

Comments
 (0)