Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Prevent auto-update of visual regression screenshots #902

Merged
merged 5 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/UPDATE_VISUAL_SNAPSHOTS.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Update Visual Regression Snapshots

on:
pull_request:
types: [labeled, synchronize]

jobs:
update-snapshots:
if: github.event.pull_request.state != 'closed' && (github.event.label.name == 'update-snapshots' || contains( github.event.pull_request.labels.*.name, 'update-snapshots'))
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.40.1
options: --user 1001:1000

steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Setup NPM cache
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Install node dependencies
run: npm ci
- name: Build frontend
run: npm run build
- name: Build mock website
run: npm run build:e2e
- name: Start server
run: npm run start:visual-preview
- name: Run Playwright tests
run: npm run test:visual -- --update-snapshots
- name: Commit screenshots
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: updated snapshots"
10 changes: 0 additions & 10 deletions .github/workflows/VISUAL_REGRESSION.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,6 @@ jobs:
- name: Run Playwright tests
if: github.ref != 'refs/heads/develop' && github.ref != 'refs/heads/master'
run: npm run test:visual
- name: Overwrite Playwright snapshots
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master'
run: |
npm run test:visual -- --update-snapshots
git config user.name '${{ secrets.BPMN_IO_USERNAME }}'
git config user.email '${{ secrets.BPMN_IO_EMAIL }}'
git add -A
git commit -m "chore(CI): updated snapshots [skip ci]" || echo "No changes to commit"
git push

- uses: actions/upload-artifact@v4
if: always()
with:
Expand Down
Loading