Files
SnapOtter/.github/workflows/update-visual-baselines.yml
T
dependabot[bot]andGitHub 624795803a chore(deps): bump the actions group with 2 updates
Bumps the actions group with 2 updates: [actions/cache](https://github.com/actions/cache) and [actions/setup-python](https://github.com/actions/setup-python).


Updates `actions/cache` from 5.0.5 to 6.1.0
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/27d5ce7f107fe9357f9df03efb73ab90386fccae...55cc8345863c7cc4c66a329aec7e433d2d1c52a9)

Updates `actions/setup-python` from 6.2.0 to 6.3.0
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/a309ff8b426b58ec0e2a45f0f869d46889d02405...ece7cb06caefa5fff74198d8649806c4678c61a1)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: 6.1.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/setup-python
  dependency-version: 6.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-29 05:36:51 +00:00

79 lines
3.0 KiB
YAML

name: Update Visual Baselines
on:
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
update-baselines:
name: Regenerate linux visual baselines
runs-on: ubuntu-latest
timeout-minutes: 120
# The e2e webServer (playwright.config.ts) creates an isolated database via
# tests/e2e-pg-create-db.cjs, so it needs Postgres + Redis on localhost.
# Without these services the webServer fails with "failed to create database".
services:
postgres:
image: postgres:17-alpine
env:
POSTGRES_USER: snapotter
POSTGRES_PASSWORD: snapotter
POSTGRES_DB: snapotter
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U snapotter"
--health-interval 5s
--health-timeout 3s
--health-retries 10
redis:
image: redis:8-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 3s
--health-retries 10
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- uses: ./.github/actions/setup
- name: Get Playwright version
id: pw-version
run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> "$GITHUB_OUTPUT"
- name: Cache Playwright browsers
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ steps.pw-version.outputs.version }}
- name: Install Playwright browsers (chromium + webkit for device projects)
run: pnpm playwright install --with-deps chromium webkit
- name: Regenerate baselines (desktop + device projects)
run: pnpm playwright test --project=chromium-visual --project=mobile-chromium --project=mobile-webkit --project=tablet-webkit --project=tablet-chromium --update-snapshots
env:
PW_WORKERS: "2"
- name: Open PR with refreshed baselines
env:
GH_TOKEN: ${{ github.token }}
run: |
if git diff --quiet -- 'tests/e2e/__screenshots__'; then
untracked=$(git ls-files --others --exclude-standard -- 'tests/e2e/__screenshots__')
if [ -z "$untracked" ]; then
echo "No baseline changes."
exit 0
fi
fi
BRANCH="chore/visual-baselines-${GITHUB_RUN_ID}"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -b "$BRANCH"
git add tests/e2e/__screenshots__
git commit -m "test(e2e): refresh linux visual baselines"
git push origin "$BRANCH"
gh pr create --title "test(e2e): refresh linux visual baselines" \
--body "Automated baseline refresh from the update-visual-baselines workflow. Review the image diffs before merging." \
--base main --head "$BRANCH"