Skip to content

Update Visual Tests #231

Update Visual Tests

Update Visual Tests #231

name: Update Visual Tests
on:
workflow_dispatch:
inputs:
commitMessage:
description: "Commit message for the update"
required: true
default:
jobs:
update-visual-tests-ubuntu:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.52.0-jammy
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
ref: ${{ github.head_ref }}
- name: Install
uses: ./.github/actions/node
- name: Build
run: |
apt-get update
apt-get install zip --yes
yarn tokens build
yarn tailwind-preset build
yarn components build
- name: Update Visual Tests
run: yarn components test-ct --update-snapshots
- name: Setup git config
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git config user.name "kiwicom-orbit-bot"
git config user.email "[email protected]"
- name: Commit changes
run: |
git fetch
git add **/*.png
if git diff-index --quiet HEAD; then
echo "No changes to linux visual tests. Exiting."
exit 0
else
echo "Commiting changes to linux visual tests"
git commit -m "${{ github.event.inputs.commitMessage || 'chore: update visual tests (linux)' }}"
git pull --rebase
git push
fi
update-visual-tests-macos:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
ref: ${{ github.head_ref }}
- name: Install Node.js
uses: ./.github/actions/node
- name: Install Playwright
run: npx playwright install --with-deps
- name: Build
run: |
yarn tokens build
yarn tailwind-preset build
yarn components build
- name: Update Visual Tests
run: yarn components test-ct --update-snapshots
- name: Setup git config
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git config user.name "kiwicom-orbit-bot"
git config user.email "[email protected]"
- name: Commit changes
run: |
git fetch
git add **/*.png
if git diff-index --quiet HEAD; then
echo "No changes to macos visual tests. Exiting."
exit 0
else
echo "Commiting changes to macos visual tests"
git commit -m "${{ github.event.inputs.commitMessage || 'chore: update visual tests (macos)' }}"
git pull --rebase
git push
fi