Skip to content

Update screenshots for dependabot/npm_and_yarn/playwright-7273afcc65 #819

Update screenshots for dependabot/npm_and_yarn/playwright-7273afcc65

Update screenshots for dependabot/npm_and_yarn/playwright-7273afcc65 #819

Workflow file for this run

name: 'Update screenshots'
on:
workflow_dispatch:
push:
branches:
- v6
- '*-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
# Создаем кэш для ветки один раз
- name: Checkout LFS objects
uses: ./.github/actions/lfs
- 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
- name: Checkout LFS objects
uses: ./.github/actions/lfs
- name: Install rsync && zip
run: |
apt-get install -y rsync zip
- 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
permissions:
pull-requests: write
contents: write
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@v7
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