-
Notifications
You must be signed in to change notification settings - Fork 9
137 lines (116 loc) · 4.16 KB
/
hub-client-e2e.yml
File metadata and controls
137 lines (116 loc) · 4.16 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
name: Hub-Client E2E Tests
on:
push:
branches: [main]
paths:
- 'hub-client/**'
- '.github/workflows/hub-client-e2e.yml'
workflow_dispatch:
inputs:
recreate-all-snapshots:
description: 'Delete and recreate ALL visual regression baselines'
type: boolean
default: false
jobs:
e2e-tests:
runs-on: ubuntu-latest-8x
name: Hub-Client E2E Tests
if: github.repository == 'quarto-dev/q2'
steps:
- name: Checkout Repo
uses: actions/checkout@v6
# Fix mtimes for build caching
- name: Restore file modification times
shell: bash
run: |
git ls-files | while read file; do
time=$(git log -1 --format='@%ct' -- "$file" 2>/dev/null || echo '@0')
[ "$time" != "@0" ] && touch -d "$time" "$file" 2>/dev/null || true
done
# Rust toolchain for WASM build
- name: Set up Rust nightly
uses: dtolnay/rust-toolchain@nightly
with:
targets: wasm32-unknown-unknown
- name: Set up Clang
uses: egor-tensin/setup-clang@v2
with:
version: latest
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Install wasm-pack
run: cargo install wasm-pack
# tree-sitter for grammar builds
- name: Set up tree-sitter CLI
run: |
curl -LO https://github.com/tree-sitter/tree-sitter/releases/download/v0.25.8/tree-sitter-linux-x86.gz
gunzip tree-sitter-linux-x86.gz
chmod +x tree-sitter-linux-x86
sudo mv tree-sitter-linux-x86 /usr/local/bin/tree-sitter
# Node.js and dependencies
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'npm'
- name: Install npm dependencies
run: npm ci
- name: Build TypeScript packages
run: npm run build
# Build WASM module
- name: Build WASM
run: |
cd hub-client
npm run build:wasm
# Install Playwright browsers
- name: Install Playwright
run: |
cd hub-client
npx playwright install --with-deps chromium
# Delete all snapshots if recreating from scratch
- name: Delete all snapshots (recreate mode)
if: inputs.recreate-all-snapshots == true
run: find hub-client/e2e -type d -name '*-snapshots' -exec rm -rf {} + || true
# Run E2E tests (functional)
- name: Run E2E tests
run: |
cd hub-client
npx playwright test
# Run visual regression tests
- name: Run visual tests
id: visual
continue-on-error: true
run: |
cd hub-client
npx playwright test --config playwright.visual.config.ts
# If visual tests failed, retry with --update-snapshots=missing
# This only creates baselines for NEW tests; existing mismatches still fail
- name: Retry visual tests (add missing baselines)
id: visual-retry
if: steps.visual.outcome == 'failure'
run: |
cd hub-client
npx playwright test --config playwright.visual.config.ts --update-snapshots=missing
# If retry passed (only missing baselines), commit them back
- name: Commit new baselines
if: steps.visual.outcome == 'failure' && steps.visual-retry.outcome == 'success'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -f hub-client/e2e/**/*-snapshots/
git diff --cached --quiet || git commit -m "Add missing Playwright visual regression baselines"
git push
# Fail the workflow if visual retry also failed (real regression)
- name: Fail on visual regression
if: steps.visual-retry.outcome == 'failure'
run: exit 1
# Upload test artifacts on failure
- name: Upload Playwright report
uses: actions/upload-artifact@v7
if: failure()
with:
name: playwright-report
path: hub-client/playwright-report/
retention-days: 7