Skip to content

Bump primer upstream 0.50.0 #219

Bump primer upstream 0.50.0

Bump primer upstream 0.50.0 #219

Workflow file for this run

name: test-visual
on:
pull_request:
permissions:
contents: write
pull-requests: write
concurrency:
group: test-visual-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
FERRUM_PROCESS_TIMEOUT: 30
jobs:
visual:
name: Visual and Semantic Markup Regressions
if: ${{ github.event_name == 'pull_request' }}
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
bundler-cache: true
- uses: actions/setup-node@v5
with:
node-version: 20
cache: "npm"
cache-dependency-path: |
package-lock.json
demo/package-lock.json
- name: Build
run: |
npm ci
bundle install
bundle exec rake static:dump
cd demo
npm ci
bundle install
- name: Install Overmind
run: |
sudo apt-get install tmux
gem install overmind
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
id: playwright-run
continue-on-error: true
run: ./script/run-playwright
- name: Update to latest branch tip
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
run: |
set -e
BRANCH="${{ github.event.pull_request.head.ref }}"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git stash push -u -m "pre-auto-commit" || true
git fetch origin "$BRANCH" --depth=1
git checkout "$BRANCH"
git reset --hard "origin/$BRANCH"
git stash pop || true
- id: auto-commit
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
uses: stefanzweifel/git-auto-commit-action@v7.1.0
with:
commit_message: Generating component snapshots
file_pattern: .playwright/screenshots/**/*.png .playwright/screenshots/**/*.yml
push_options: --force-with-lease
- name: "Changes detected"
if: steps.auto-commit.outputs.changes_detected == 'true'
uses: phulsechinmay/rewritable-pr-comment@v0.3.0
with:
message: |
### ⚠️ Visual or ARIA snapshot differences found
Our visual and ARIA snapshot tests found UI differences. Please review the differences by viewing the files changed tab to ensure that the changes were intentional.
[Review differences](https://github.com/opf/primer_view_components/pull/${{ github.event.number }}/files?file-filters%5B%5D=.png&file-filters%5B%5D=.yml&show-viewed-files=false)
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMENT_IDENTIFIER: "visual-comparison-diff"
- uses: actions/upload-artifact@v6
with:
name: playwright-report
path: .playwright/report/
retention-days: 30
- name: Failure
if: ${{ steps.auto-commit.outputs.changes_detected == 'true' || steps.playwright-run.outcome == 'failure' }}
run: exit 1