Skip to content

Commit

Permalink
chore: add new workflow to regenerate snapshots on failure (#2373)
Browse files Browse the repository at this point in the history
* chore: add new workflow to regenerate snapshots on failure

* fix: issues with results for workflow call

* test: regeneration

* test: regeneration
  • Loading branch information
nmerget authored Mar 22, 2024
1 parent cc990b3 commit 477e5ff
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/scripts/update-playwright.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const updatePlaywright = () => {
'.github/workflows/02-e2e.yml',
'.github/workflows/02-e2e-foundations.yml',
'.github/workflows/02-e2e-showcases.yml',
'.github/workflows/02-e2e-regenerate.yml',
'e2e/Dockerfile'
]
},
Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/02-e2e-regenerate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: 🎭 Playwright E2E

on:
workflow_call:

permissions:
actions: write
contents: write

jobs:
regenerate-snapshots:
name: 🧪🎭 - Regenerate snapshots
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.42.1
steps:
- name: ⏬ Checkout repo
uses: actions/checkout@v4

- name: 🔄 Init Cache
uses: ./.github/actions/npm-cache

- name: 📲 Install esbuild (binary workaround)
run: npm i -D esbuild-linux-64

- name: ⏬ Download foundations build
uses: actions/download-artifact@v4
with:
name: db-ui-foundations-build
path: packages/foundations/build

- name: ⏬ Download output
uses: actions/download-artifact@v4
with:
name: db-ui-output
path: output

- name: ⏬ Download components styles build
uses: actions/download-artifact@v4
with:
name: db-ui-components-build
path: packages/components/build

- name: ⏬ Download showcases
uses: actions/download-artifact@v4
with:
name: db-ui-showcases
path: build-showcases

- name: 👩‍🔬 Generate snapshots 🎭
env:
HOME: /root
run: |
npm run regenerate:screenshots --workspace=@db-ui/react-components
npm run regenerate:screenshots --workspace=@db-ui/foundations
npm run regenerate:screenshots --workspace=react-showcase
- name: 🆙 Upload snapshots
uses: actions/upload-artifact@v4
with:
name: __snapshots__
path: ./__snapshots__
retention-days: 30
5 changes: 5 additions & 0 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ jobs:
uses: ./.github/workflows/02-e2e-showcases.yml
needs: [build-showcases]

regenerate-snapshots:
if: always() && (needs.test-components.result == 'failure' || needs.test-foundations.result == 'failure' || needs.test-showcases.result == 'failure')
uses: ./.github/workflows/02-e2e-regenerate.yml
needs: [test-components, test-showcases, test-foundations]

checks-done:
if: ${{ always() }}
runs-on: ubuntu-latest
Expand Down

0 comments on commit 477e5ff

Please sign in to comment.