Skip to content

[WIP] baseブランチと画像比較できるように修正 #68

[WIP] baseブランチと画像比較できるように修正

[WIP] baseブランチと画像比較できるように修正 #68

Workflow file for this run

name: Visual Regression Testing
on:
pull_request:
types: [opened, synchronize]
jobs:
prepare-screenshots-actual:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.46.1-jammy
timeout-minutes: 60
outputs:
sha: ${{ steps.screenshots.outputs.sha }}
steps:
- uses: actions/checkout@v4
- uses: './.github/actions/screenshots'
id: screenshots
with:
ref: ${{ github.event.pull_request.head.sha }}
path: '.reg/screenshots'
prepare-screenshots-expected:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.46.1-jammy
timeout-minutes: 60
outputs:
sha: ${{ steps.screenshots.outputs.sha }}
steps:
- uses: actions/checkout@v4
- uses: './.github/actions/screenshots'
id: screenshots
with:
ref: ${{ github.base_ref }}
path: '.reg/screenshots'
test:
needs: [prepare-screenshots-actual, prepare-screenshots-expected]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Restore actual screenshots
uses: actions/cache@v4
with:
path: '.reg/screenshots'
key: vrt-${{ needs.prepare-screenshots-actual.outputs.sha }}
- run: mv .reg/screenshots .reg/actual
- name: Restore expected screenshots
uses: actions/cache@v4
with:
path: '.reg/screenshots'
key: vrt-${{ needs.prepare-screenshots-expected.outputs.sha }}
- run: mv .reg/screenshots .reg/expected
- name: Run visual tests
continue-on-error: true
id: vrt
run: npm run test:vrt
- uses: ./.github/actions/netlify
id: netlify
timeout-minutes: 1
with:
publish-dir: ./.reg
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
netlify-site-id: ${{ secrets.NETLIFY_SITE_ID }}
- if: ${{ steps.vrt.outcome == 'success' }}
name: Comment PR if success
uses: thollander/actions-comment-pull-request@v2
with:
message: |
**✨✨ That's perfect, there is no visual difference! ✨✨**
You can check [this report](${{ steps.netlify.outputs.netlify-url }}) out here.
comment_tag: test-report-vrt
- if: ${{ steps.vrt.outcome == 'failure' }}
name: Comment PR if failure
uses: thollander/actions-comment-pull-request@v2
with:
message: |
**reg-suit detected visual differences.**
Check [this report](${{ steps.netlify.outputs.netlify-url }}), and review them.
comment_tag: test-report-vrt