Repository navigation
139 lines (122 loc) Β· 3.98 KB
/
Copy pathvisual-regression.yml
File metadata and controls
139 lines (122 loc) Β· 3.98 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
name: Visual regression checks
on:
pull_request:
branches: [main, master, v1.0-dev]
paths:
- "_config.yml"
- "_data/**"
- "_bibliography/**"
- "_pages/**"
- "_posts/**"
- "_projects/**"
- "assets/**"
- "test/visual/**"
- ".github/workflows/visual-regression.yml"
- "package.json"
- "package-lock.json"
- "Gemfile"
- "Gemfile.lock"
push:
branches: [v1.0-dev]
paths:
- "_config.yml"
- "_data/**"
- "_bibliography/**"
- "_pages/**"
- "_posts/**"
- "_projects/**"
- "assets/**"
- "test/visual/**"
- ".github/workflows/visual-regression.yml"
- "package.json"
- "package-lock.json"
- "Gemfile"
- "Gemfile.lock"
jobs:
visual-regression:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout candidate ποΈ
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Ruby π
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3.5"
bundler-cache: true
- name: Setup Node π§°
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Install JS deps π¦
run: npm ci
- name: Prepare baseline worktree (v0.16.3) π§±
run: |
git worktree add ../al-folio-baseline v0.16.3
(cd ../al-folio-baseline && bundle install && npm ci)
- name: Install Jupyter + ImageMagick runtime deps π§°
run: |
sudo apt-get update
sudo apt-get install -y imagemagick python3-pip
pip3 install --user jupyter nbconvert
- name: Install Playwright browser π§ͺ
run: npx playwright install --with-deps chromium webkit
- name: Run visual parity checks π
env:
BASELINE_URL: http://127.0.0.1:4100
NO_WEBSERVER: "1"
run: |
set -euo pipefail
export PATH="$HOME/.local/bin:$PATH"
(cd ../al-folio-baseline && bundle exec jekyll serve --host 127.0.0.1 --port 4100 --baseurl /al-folio --quiet > /tmp/jekyll-baseline.log 2>&1) &
BASELINE_PID=$!
(bundle exec jekyll serve --host 127.0.0.1 --port 4000 --baseurl /al-folio --quiet > /tmp/jekyll-candidate.log 2>&1) &
CANDIDATE_PID=$!
cleanup() {
kill "$BASELINE_PID" "$CANDIDATE_PID" >/dev/null 2>&1 || true
}
trap cleanup EXIT
READY=0
for _ in {1..150}; do
if curl -fsS http://127.0.0.1:4000/al-folio/ >/dev/null && curl -fsS http://127.0.0.1:4100/al-folio/ >/dev/null; then
READY=1
break
fi
if ! kill -0 "$BASELINE_PID" >/dev/null 2>&1 || ! kill -0 "$CANDIDATE_PID" >/dev/null 2>&1; then
echo "Jekyll server exited before becoming ready."
echo "--- baseline log ---"
cat /tmp/jekyll-baseline.log || true
echo "--- candidate log ---"
cat /tmp/jekyll-candidate.log || true
exit 1
fi
sleep 2
done
if [ "$READY" -ne 1 ]; then
echo "Timed out waiting for Jekyll servers (5 minutes)."
echo "--- baseline log ---"
cat /tmp/jekyll-baseline.log || true
echo "--- candidate log ---"
cat /tmp/jekyll-candidate.log || true
exit 1
fi
npm run test:visual -- --reporter=line
- name: Upload Playwright report π
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report
if-no-files-found: ignore
- name: Upload Jekyll logs π
if: always()
uses: actions/upload-artifact@v4
with:
name: jekyll-visual-logs
path: |
/tmp/jekyll-baseline.log
/tmp/jekyll-candidate.log
if-no-files-found: ignore