@@ -11,9 +11,12 @@ concurrency:
1111 group : ci-${{ github.ref }}
1212 cancel-in-progress : true
1313
14+ permissions :
15+ contents : read
16+
1417jobs :
1518 validate :
16- name : Validate HTML & Links
19+ name : Validate HTML, Links & Playwright
1720 runs-on : ubuntu-latest
1821 steps :
1922 - uses : actions/checkout@v4
2225 with :
2326 node-version : ' 20'
2427 - name : Install dependencies
25- run : npm ci || npm install || true
26- - name : Check HTML files exist
2728 run : |
28- echo "Checking HTML files..."
29- find . -name "*.html" | head -20
30- echo "✅ HTML files found"
29+ if [ -f package-lock.json ]; then
30+ npm ci
31+ elif [ -f package.json ]; then
32+ npm install
33+ else
34+ npm init -y && npm install --save-dev @playwright/test http-server
35+ fi
36+ - name : Install Playwright browsers
37+ run : npx playwright install --with-deps chromium
38+ - name : Start static server
39+ run : npx http-server . -p 8080 -s &
40+ - name : Wait for server
41+ run : npx wait-on http://localhost:8080 --timeout 15000
42+ - name : Run Playwright tests
43+ run : |
44+ if [ -d tests ]; then
45+ npx playwright test tests/ --project=chromium --reporter=list
46+ else
47+ echo "::warning::No tests/ directory found, running site smoke test"
48+ curl -fsSL http://localhost:8080/ -o /dev/null
49+ fi
50+ - name : Link check (offline)
51+ uses : lycheeverse/lychee-action@v2
52+ with :
53+ args : --offline --no-progress --verbose './**/*.html'
54+ fail : true
55+ - name : HTML minification dry-run
56+ run : |
57+ npx --yes html-minifier-terser \
58+ --collapse-whitespace --remove-comments --minify-css true --minify-js true \
59+ --output /tmp/min.html index.html 2>/dev/null || echo "(minify check skipped)"
60+ - uses : actions/upload-artifact@v4
61+ if : failure()
62+ with :
63+ name : test-results
64+ path : test-results/
0 commit comments