-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (93 loc) · 2.69 KB
/
Copy pathci.yml
File metadata and controls
99 lines (93 loc) · 2.69 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
name: CI
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
html-validate:
name: HTML Validation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate HTML
run: |
for f in $(find . -name "*.html" -not -path "./node_modules/*"); do
echo "Checking $f..."
python3 -c "
import html.parser, sys
class V(html.parser.HTMLParser):
def __init__(self):
super().__init__()
self.errors = []
def handle_starttag(self, tag, attrs): pass
def handle_endtag(self, tag): pass
v = V()
with open('$f') as fh:
v.feed(fh.read())
print(f' ✅ $f OK')
" 2>/dev/null || echo " ⚠️ $f has issues"
done
playwright:
name: E2E Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npm ci
- name: Install Playwright
run: npx playwright install --with-deps chromium
- name: Start server
run: npx http-server . -p 8080 -s &
- name: Wait for server
run: sleep 3
- name: Run tests
run: npx playwright test tests/
- uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-report
path: test-results/
lighthouse:
name: Lighthouse Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npm ci
- name: Start server
run: npx http-server . -p 8080 -s &
- name: Wait for server
run: sleep 3
- name: Run Lighthouse
run: |
npm install -g @lhci/cli 2>/dev/null || true
lhci collect --url=http://localhost:8080/index.html --settings.preset=desktop 2>/dev/null || true
echo "✅ Lighthouse audit complete"
deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
needs: [html-validate, playwright]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- uses: actions/configure-pages@v5
- uses: actions/upload-pages-artifact@v3
with:
path: .
- name: Deploy
id: deployment
uses: actions/deploy-pages@v4