-
Notifications
You must be signed in to change notification settings - Fork 108
88 lines (77 loc) · 3.07 KB
/
Copy pathvisual-baselines.yml
File metadata and controls
88 lines (77 loc) · 3.07 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
name: Update visual baselines
on:
push:
branches: [master]
workflow_dispatch:
jobs:
baselines:
name: Capture and publish baselines
runs-on: ubuntu-latest
container:
image: cypress/browsers:latest
options: --user 1001
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'pnpm'
- name: Cache Cypress binary
uses: actions/cache@v5
with:
path: ~/.cache/Cypress
key: ${{ runner.os }}-cypress-${{ hashFiles('regression-test/package-lock.json') }}
- name: Build InstUI
run: pnpm install --frozen-lockfile && pnpm run bootstrap
- name: Install regression-test dependencies
run: npm ci
working-directory: regression-test
- name: Install Cypress binary
run: npx cypress install
working-directory: regression-test
# Capturing baselines is decoupled from the a11y/console assertions: the
# screenshots are valid renders regardless of whether those assertions
# pass, so a failing test must never block the baseline refresh (that's
# what silently froze the baselines branch before). We let Cypress fail
# here, always publish the screenshots below, then re-surface the failure
# in a trailing step so master still shows red and notifies.
- name: Run Cypress
id: cypress
continue-on-error: true
uses: cypress-io/github-action@v7
env:
ELECTRON_EXTRA_LAUNCH_ARGS: "--remote-debugging-port=9222"
with:
install: false
build: npm run build
start: npm start
working-directory: regression-test
- name: Flatten screenshots
if: always()
run: |
mkdir -p baseline-publish/screenshots
find regression-test/cypress/screenshots -name '*.png' -exec cp {} baseline-publish/screenshots/ \;
- name: Push baselines to visual-baselines branch
if: always()
run: |
cd baseline-publish
git init -b visual-baselines
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add screenshots/
git commit -m "update baselines from ${GITHUB_SHA}"
git remote add origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
git push --force origin visual-baselines
# Baselines have been refreshed by this point; now fail loudly if the
# suite had regressions (a11y/console violations or a broken page) so the
# failure is visible on master rather than silently swallowed.
- name: Fail if Cypress reported failures
if: steps.cypress.outcome == 'failure'
run: |
echo "::error::Baselines were published, but the regression suite had failing tests (a11y/console/spec). See the Run Cypress step logs."
exit 1