Skip to content

feat: add use client directive #5651

feat: add use client directive

feat: add use client directive #5651

name: 'Pull Request / Packages'
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths-ignore:
- '.husky/**'
- '.codesandbox/**'
- '.github/**'
- '!.github/actions/**'
- '.github/actions/**/*.yml'
- '**/*.md'
- '!packages/vkui/src/**/*.md'
- '!styleguide/pages/**/*.md'
- '**/__image_snapshots__/*.png'
concurrency:
group: pr-packages-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
changed_files:
runs-on: ubuntu-latest
name: Detect what files changed
outputs:
package_vkui: ${{ steps.changes.outputs.package_vkui }}
docs_styleguide: ${{ steps.changes.outputs.docs_styleguide }}
docs_storybook: ${{ steps.changes.outputs.docs_storybook }}
dependencies: ${{ steps.changes.outputs.dependencies }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Find changes
uses: dorny/paths-filter@v3
id: changes
with:
token: ${{ secrets.GITHUB_TOKEN }}
filters: .github/file-filters.yml
linters:
runs-on: ubuntu-latest
name: Run linters
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Node setup
uses: ./.github/actions/node-setup
- name: Run Stylelint
run: yarn run lint:style
- name: Run types checking
run: yarn run lint:types
- name: Run ESLint
run: yarn run lint:es:ci
- name: Check if the generated files have been updated
run: yarn run lint:generated-files
- name: Report lint results
if: ${{ !cancelled() }}
uses: VKCOM/gh-actions/VKUI/reporter@main
test:
name: Call reusable workflow
uses: ./.github/workflows/reusable_workflow_test.yml
test_report:
if: ${{ !cancelled() && (success() || failure()) }}
needs: test
runs-on: ubuntu-latest
name: Report unit test results
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: test-output
- name: Report
uses: VKCOM/gh-actions/VKUI/reporter@main
test_e2e:
if: ${{ needs.changed_files.outputs.package_vkui == 'true' }}
needs: changed_files
name: Call reusable workflow
uses: ./.github/workflows/reusable_workflow_test_e2e.yml
test_e2e_prepare_and_upload_report:
if: ${{ !cancelled() && (success() || failure()) }}
needs: test_e2e
name: Prepare and upload e2e's HTML report artifact
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Node setup
uses: ./.github/actions/node-setup
- name: Download Playwright blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v4
with:
path: packages/vkui/artifacts
- name: Prepare downloaded Playwright blob reports for merging
run: |
mkdir all-blob-reports
if [ -d packages/vkui/artifacts ]; then
for i in {1..10}
do
mv packages/vkui/artifacts/all-blob-reports-$i-10/* all-blob-reports/
done
fi
rm -r packages/vkui/artifacts
shell: bash
- name: Merge Playwright blob reports into HTML Report
run: yarn run playwright:cmd:merge-reports --reporter html ./all-blob-reports
- name: Upload Playwright HTML report to GitHub Actions Artifacts
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report
retention-days: 30
analyze_bundle_size:
if: ${{ needs.changed_files.outputs.package_vkui == 'true' }}
needs: changed_files
runs-on: ubuntu-latest
name: Analyze bundle size
env:
CI_JOB_NUMBER: 1
# Для Dependabot
permissions:
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Node setup
uses: ./.github/actions/node-setup
- uses: andresz1/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
directory: packages/vkui/
package_manager: yarn
# only affects current branch
skip_step: install
build_script: 'size:ci'
script: yarn run -T size-limit --json"
docs_styleguide_upload:
if: ${{ needs.changed_files.outputs.docs_styleguide == 'true' }}
needs: changed_files
runs-on: ubuntu-latest
name: Upload docs dist artifact (styleguide)
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Node setup
uses: ./.github/actions/node-setup
- name: Build
run: yarn run docs:styleguide:build
- name: Upload dist
uses: actions/upload-artifact@v4
with:
name: styleguide-dist
path: styleguide/dist
docs_storybook_upload:
if: ${{ needs.changed_files.outputs.docs_storybook == 'true' }}
needs: changed_files
runs-on: ubuntu-latest
name: Upload docs dist artifact (storybook)
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Node setup
uses: ./.github/actions/node-setup
- name: Build
run: yarn docs:storybook:build
- name: Upload dist
uses: actions/upload-artifact@v4
with:
name: storybook-dist
path: packages/vkui/storybook-static
upload_pr_workflow_payload:
# Дожидаемся выгрузки артефактов, на случай если вокрфлоу будет отменён или перезапушен
needs: [test, test_e2e_prepare_and_upload_report, docs_styleguide_upload, docs_storybook_upload]
# Не используем always(), т.к. он не учитывает отмену воркфлоу
# см. https://github.com/orgs/community/discussions/26303
if: ${{ !cancelled() }}
name: Call reusable workflow
uses: ./.github/workflows/reusable_workflow_pr_worfklow_payload.yml
with:
action: upload
check_dependencies:
if: ${{ needs.changed_files.outputs.dependencies == 'true' }}
needs: changed_files
runs-on: ubuntu-latest
name: Check dependencies
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Enable Corepack
run: corepack enable
shell: bash
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install dependencies
run: YARN_ENABLE_SCRIPTS=false yarn install --immutable --check-cache --check-resolutions