Skip to content

Update screenshots for mendrew/fix/Input/hover-in-error-state #762

Update screenshots for mendrew/fix/Input/hover-in-error-state

Update screenshots for mendrew/fix/Input/hover-in-error-state #762

Workflow file for this run

name: 'Update screenshots'
on:
workflow_dispatch:
push:
branches:
- '*-stable'
run-name: Update screenshots for ${{ github.ref_name }}
jobs:
get_playwright_docker_image:
runs-on: ubuntu-latest
outputs:
image: ${{ steps.result.outputs.value }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: ./.github/actions/get-playwright-docker-image
id: result
update_screens:
needs: get_playwright_docker_image
if: success()
runs-on: ubuntu-latest
container:
image: ${{ needs.get_playwright_docker_image.outputs.image }}
options: --ipc=host
strategy:
fail-fast: false
matrix:
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
shardTotal: [10]
name: 'Run e2e tests for (shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }})'
steps:
- name: Checkout
uses: actions/checkout@v4
# см. https://github.com/actions/checkout/issues/1169
- name: Set safe directory
run: git config --global --add safe.directory /__w/VKUI/VKUI
# см. https://github.com/microsoft/playwright/issues/21920
- name: Install git lfs
run: |
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
apt-get install -y git-lfs
- name: Install rsync
run: |
apt-get install -y rsync
- name: Install zip
run: |
apt-get install -y zip
- name: Create LFS file list
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
- name: Restore LFS cache
uses: actions/cache@v4
with:
path: .git/lfs
key: lfs-${{ hashFiles('.lfs-assets-id') }}
- name: Checkout LFS objects
run: git lfs pull
- name: Node setup
uses: ./.github/actions/node-setup
- name: Update screenshots
# Почему HOME=/root см. https://github.com/microsoft/playwright/issues/6500
run: HOME=/root yarn run test:e2e-update:ci --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
- name: Zip changed screenshots
id: zip-screenshots
run: |
git add ./**/*.png
mkdir screenshots
rsync -R $(git diff --name-only --cached --relative) screenshots
if [ -d screenshots/components ]; then
echo "needUpload=true" >> $GITHUB_OUTPUT
cd screenshots
zip -q -r ../../screenshots-${{ matrix.shardIndex }}-${{ matrix.shardTotal }}.zip components
fi
shell: bash
working-directory: ./packages/vkui/src
- name: Upload archive
if: steps.zip-screenshots.outputs.needUpload == 'true'
uses: actions/upload-artifact@v4
with:
name: screenshots-${{ matrix.shardIndex }}-${{ matrix.shardTotal }}
path: packages/vkui/screenshots-${{ matrix.shardIndex }}-${{ matrix.shardTotal }}.zip
collect_all_chnages_and_push:
runs-on: ubuntu-latest
needs: [update_screens]
name: 'Collect updated screenshots and push changes'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
id: artifacts
uses: actions/download-artifact@v4
with:
path: packages/vkui/artifacts
- name: Unzip archives
id: unzip
run: |
if [ -d artifacts ]; then
echo "found=true" >> $GITHUB_OUTPUT
cd artifacts
find . -type f -name 'screenshots-*.zip' -exec unzip -q -o -d ../src {} \;
fi
shell: bash
working-directory: ./packages/vkui
- name: Set Git credentials
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
- name: Push updated screenshots
if: ${{ steps.unzip.outputs.found == 'true' && github.event_name != 'push' }}
uses: VKCOM/gh-actions/VKUI/push-screenshots@main
- name: Create pull request with updated screenshots
if: ${{ steps.unzip.outputs.found == 'true' && github.event_name == 'push' }}
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: 'ci(e2e): Update screenshots for ${{ github.ref_name }}'
branch: ${{ github.ref_name }}-screenshots-updates
commit-message: 'chore(e2e): update screenshots'
body: Automated screenshots updates
add-paths: |
**/*.png