Skip to content

fix(seer-explorer): Do not open a reasoning box that renders nothing #59154

fix(seer-explorer): Do not open a reasoning box that renders nothing

fix(seer-explorer): Do not open a reasoning box that renders nothing #59154

name: 'frontend-snapshots'
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, edited]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
NODE_OPTIONS: '--max-old-space-size=4096'
SNAPSHOT_OUTPUT_DIR: .artifacts/snapshots
jobs:
snapshots:
name: snapshot tests
# Skip 'edited' events that aren't a base branch change (e.g. title/body edits).
# When the base branch changes, the diff target changes so we need a fresh run.
if: github.event.action != 'edited' || github.event.changes.base != ''
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
# Checkout the HEAD of the PR (or the commit if not a PR)
# Explicitly need to do this to avoid cases where the merge commit is used instead of the PR head,
# which can introduce diffs that aren't explicitly caused by the PR changes.
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
with:
node-version-file: '.node-version'
- uses: pnpm/action-setup@36de12bed180fa130ed56a35e7344f2fa7a820ab # v4
- name: node_modules cache
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
id: nodemodulescache
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('pnpm-lock.yaml', '.node-version') }}
- name: Install Javascript Dependencies
if: steps.nodemodulescache.outputs.cache-hit != 'true'
run: pnpm install --frozen-lockfile
- name: Install Playwright system deps
timeout-minutes: 15
run: |
echo 'Acquire::Retries "3";' | sudo tee /etc/apt/apt.conf.d/99-retries
echo 'Acquire::http::Timeout "30";' | sudo tee -a /etc/apt/apt.conf.d/99-retries
for i in 1 2 3; do
echo "::group::playwright install-deps (attempt $i)"
timeout -k 30 4m pnpm exec playwright install-deps chromium && ok=1 || ok=0
echo "::endgroup::"
[ "$ok" = 1 ] && exit 0
echo "Attempt $i failed; clearing apt locks and retrying in 15s..."
sudo pkill -9 -f apt-get 2>/dev/null || true
sudo rm -f /var/lib/apt/lists/lock /var/lib/dpkg/lock* /var/cache/apt/archives/lock 2>/dev/null || true
sudo dpkg --configure -a 2>/dev/null || true
sleep 15
done
echo "playwright install-deps failed after 3 attempts"
exit 1
- name: Playwright browser cache
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
id: playwrightcache
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
- name: Install Playwright browser
if: steps.playwrightcache.outputs.cache-hit != 'true'
timeout-minutes: 15
run: |
for i in 1 2 3; do
echo "::group::playwright install browser (attempt $i)"
timeout -k 30 4m pnpm exec playwright install chromium && ok=1 || ok=0
echo "::endgroup::"
[ "$ok" = 1 ] && exit 0
echo "Attempt $i failed or timed out; retrying in 15s..."
sleep 15
done
echo "playwright browser install failed after 3 attempts"
exit 1
- name: Run snapshot tests
env:
SENTRY_DSN: ${{ secrets.SENTRY_SNAPSHOTS_DSN }}
GITHUB_PR_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
GITHUB_PR_REF: ${{ github.event.pull_request.head.ref || github.ref }}
run: pnpm run snapshots
- name: Compute merge base SHA
if: github.event_name == 'pull_request' && !cancelled()
id: merge-base
env:
GH_TOKEN: ${{ github.token }}
run: |
MERGE_BASE=$(gh api repos/${{ github.repository }}/compare/${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }} --jq '.merge_base_commit.sha')
echo "sha=$MERGE_BASE" >> "$GITHUB_OUTPUT"
- name: Install sentry-cli
if: ${{ !cancelled() }}
uses: getsentry/action-setup-cli@70d7e587b84c2e78cf4d37cd33d7b74fb3729c1b # v1
with:
version: '3.5.0'
- name: Upload snapshots
id: upload
if: ${{ success() }}
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_SNAPSHOTS_AUTH_TOKEN }}
BASE_SHA: ${{ steps.merge-base.outputs.sha }}
run: |
sentry-cli \
--log-level=debug \
snapshots upload "$SNAPSHOT_OUTPUT_DIR" \
--app-id sentry-frontend \
--project sentry-frontend \
${BASE_SHA:+--base-sha "$BASE_SHA"}
- name: Report upload failure to Sentry
if: ${{ failure() && steps.upload.outcome == 'failure' }}
env:
SENTRY_DSN: ${{ secrets.SENTRY_SNAPSHOTS_DSN }}
run: |
sentry-cli send-event \
--message "Frontend snapshot upload failed" \
--tag workflow:frontend-snapshots \
--tag commit:"${{ github.sha }}"