diff --git a/.github/scripts/update-playwright.js b/.github/scripts/update-playwright.js index 53001125a4a..11207eee944 100644 --- a/.github/scripts/update-playwright.js +++ b/.github/scripts/update-playwright.js @@ -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' ] }, diff --git a/.github/workflows/02-e2e-regenerate.yml b/.github/workflows/02-e2e-regenerate.yml new file mode 100644 index 00000000000..f8c08b7ab37 --- /dev/null +++ b/.github/workflows/02-e2e-regenerate.yml @@ -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 diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index 97248961772..e8484d4e978 100644 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -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