Demo reg suit #19
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 Testing | |
## プルリクエストのスクリーンショットを保存するワークフロー | |
on: | |
pull_request: | |
types: [opened, reopened] | |
jobs: | |
reg-screenshot-test: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
permissions: | |
actions: read # for downloading artifacts | |
contents: write # for pushing screenshot-diff to companion branch | |
pull-requests: write # for creating a comment on pull requests | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0 | |
with: | |
distribution: temurin | |
java-version: 17 | |
# Better than caching and/or extensions of actions/setup-java | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@87a9a15658c426a54dd469d4fc7dc1a73ca9d4a6 # v2.10.0 | |
with: | |
gradle-version: wrapper | |
# - name: workaround for detached HEAD | |
# run: | | |
# git checkout ${GITHUB_REF#refs/heads/} || git checkout -b ${GITHUB_REF#refs/heads/} && git pull origin ${GITHUB_REF#refs/heads/} | |
- name: workaround for detached HEAD | |
if: ${{ github.event_name == 'pull_request' }} | |
run: | | |
git checkout ${GITHUB_HEAD_REF#refs/heads/} || git checkout -b ${GITHUB_HEAD_REF#refs/heads/} && git pull origin ${GITHUB_REF#refs/heads/} | |
- name: create the current snapshot | |
run: | | |
./gradlew recordRoborazziDebug --stacktrace | |
- name: Run reg-suit | |
run: | | |
yarn run reg-suit sync-expected && yarn run reg-suit compare && yarn run reg-suit publish -n | |
# GitHub Page公開元ブランチへレポートをpush | |
- name: deploy report to github page | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: .reg/ | |
destination_dir: ${{ github.head_ref }} # PR毎にディレクトリを分けることで上書きを防ぐ | |
- name: find comment | |
uses: peter-evans/find-comment@v2 | |
id: fc | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: 'github-actions[bot]' | |
body-includes: reg-suit report | |
- name: upsert comment | |
uses: peter-evans/create-or-update-comment@v3 | |
with: | |
comment-id: ${{ steps.fc.outputs.comment-id }} | |
issue-number: ${{ github.event.pull_request.number }} | |
body: | | |
reg-suit report | |
https://takumi-saito.github.io/VrtSampleApp/${{github.head_ref}} | |
edit-mode: replace |