Migrate fabric-custom-xl with common fabric component #179
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Visual regression | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
pull_request: | |
permissions: write-all | |
jobs: | |
test: | |
name: Visual regression | |
timeout-minutes: 30 | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- run: corepack enable | |
shell: bash | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'pnpm' | |
- run: pnpm install --frozen-lockfile | |
shell: bash | |
- name: Install Playwright Browsers | |
run: pnpm playwright install --with-deps chromium | |
- name: Start Commercial Templates | |
run: pnpm dev & npx wait-on -v -i 1000 http://localhost:7777 | |
- name: Run Playwright | |
continue-on-error: true | |
run: pnpm playwright test | |
- name: Construct results table | |
run: node scripts/analyse-visual-results | |
- uses: actions/github-script@v7 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
const { readFileSync, resolve } = require('fs'); | |
const resultsTable = readFileSync('./test-results/visual-regression-results-table.txt', 'utf8'); | |
const body = `### Visual regression testing results 🔍 | |
If any tests are failing, please check that any visual changes are intentional before merging your PR. | |
${resultsTable}` | |
if (context.eventName === 'pull_request') { | |
const comments = await github.rest.issues.listComments({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
}); | |
const existingComment = comments.data.find(comment => comment.body.includes('Visual regression testing results')); | |
if (existingComment) { | |
await github.rest.issues.updateComment({ | |
comment_id: existingComment.id, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body | |
}); | |
return; | |
} else { | |
const { data } = await github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body | |
}); | |
} | |
} | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: visual-regression-report | |
path: ./test-results/ | |
retention-days: 5 |