Skip to content

baseブランチと画像比較できるように修正 #90

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

baseブランチと画像比較できるように修正 #90

Workflow file for this run

name: Visual Regression Testing
on:
pull_request:
types: [opened, synchronize]
env:
screenshots-dir: './.reg/screenshots'
jobs:
prepare-screenshots-actual:
name: Take actual screenshots
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.46.1-jammy
timeout-minutes: 60
outputs:
cache-key: ${{ steps.screenshots.outputs.cache-key }}
steps:
- uses: actions/checkout@v4
- uses: './.github/actions/screenshots'
id: screenshots
with:
ref: ${{ github.event.pull_request.head.sha }}
path: ${{ env.screenshots-dir }}
prepare-screenshots-expected:
name: Take expected screenshots
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.46.1-jammy
timeout-minutes: 60
outputs:
cache-key: ${{ steps.screenshots.outputs.cache-key }}
steps:
- uses: actions/checkout@v4
- uses: './.github/actions/screenshots'
id: screenshots
with:
ref: ${{ github.base_ref }}
path: ${{ env.screenshots-dir }}
test:
name: Verify screenshots
needs: [prepare-screenshots-actual, prepare-screenshots-expected]
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.46.1-jammy
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Restore actual screenshots
uses: actions/cache@v4
with:
path: ${{ env.screenshots-dir }}
key: ${{ needs.prepare-screenshots-actual.outputs.cache-key }}
- run: mv ${{ env.screenshots-dir }} .reg/actual
- run: ls .reg/actual/Home
- name: Restore expected screenshots
uses: actions/cache@v4
with:
path: ${{ env.screenshots-dir }}
key: ${{ needs.prepare-screenshots-expected.outputs.cache-key }}
- run: mv ${{ env.screenshots-dir }} .reg/expected
- run: ls .reg/expected/Home
- 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