tech: biome format #8234
This file contains hidden or 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: 'Pull Request / Packages' | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| paths-ignore: | |
| - '.husky/**' | |
| - '.github/**' | |
| - '!.github/actions/**' | |
| - '.github/actions/**/*.yml' | |
| - '**/*.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_storybook: ${{ steps.changes.outputs.docs_storybook }} | |
| docs_website: ${{ steps.changes.outputs.docs_website }} | |
| dependencies: ${{ steps.changes.outputs.dependencies }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - 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@v5 | |
| - 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@v5 | |
| 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@v5 | |
| - name: Node setup | |
| uses: ./.github/actions/node-setup | |
| - name: Download Playwright blob reports from GitHub Actions Artifacts | |
| uses: actions/download-artifact@v5 | |
| 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 | |
| build_package: | |
| if: ${{ needs.changed_files.outputs.package_vkui == 'true' }} | |
| needs: changed_files | |
| runs-on: ubuntu-latest | |
| name: Build package | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Node setup | |
| uses: ./.github/actions/node-setup | |
| - name: Generate archive | |
| run: yarn workspace @vkontakte/vkui pack --out ../../out/_pkg.tgz | |
| shell: bash | |
| - name: Upload dist | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: package | |
| path: out | |
| 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@v5 | |
| - 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" | |
| diff_build: | |
| if: ${{ needs.changed_files.outputs.package_vkui == 'true' }} | |
| needs: changed_files | |
| runs-on: ubuntu-latest | |
| name: Generate Diff | |
| steps: | |
| - name: Checkout PR branch | |
| uses: actions/checkout@v5 | |
| - name: Node setup (pr) | |
| uses: ./.github/actions/node-setup | |
| - name: Build vkui PR (pr) | |
| working-directory: packages/vkui | |
| run: | | |
| yarn run build | |
| yarn run -T biome format --write ./dist | |
| - name: Checkout target | |
| run: | | |
| git fetch origin ${{ github.base_ref }} --depth=1 | |
| git checkout -f ${{ github.base_ref }} | |
| - name: Node setup (target) | |
| uses: ./.github/actions/node-setup | |
| - name: Rename dist folder from pr | |
| working-directory: packages/vkui | |
| run: | | |
| mv dist pr_dist | |
| - name: Build vkui (target) | |
| working-directory: packages/vkui | |
| run: | | |
| yarn run build | |
| yarn run -T biome format --write ./dist | |
| - name: Generate diff | |
| id: generate-diff | |
| run: | | |
| git diff --no-index packages/vkui/dist/ packages/vkui/pr_dist/ > code_diff.dif || true | |
| if [ -s code_diff.dif ]; then | |
| echo "has_diff=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "has_diff=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Generate HTML report | |
| if: steps.generate-diff.outputs.has_diff == 'true' | |
| run: | | |
| mkdir diff | |
| yarn run diff2html -i file -F diff/diff-report.html --summary open --title "VKUI Bundle Diff" --style side -- code_diff.dif | |
| - name: Upload report | |
| if: steps.generate-diff.outputs.has_diff == 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: diff-report | |
| path: diff/ | |
| 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@v5 | |
| - 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 | |
| docs_website_upload: | |
| if: ${{ needs.changed_files.outputs.docs_website == 'true' }} | |
| needs: changed_files | |
| runs-on: ubuntu-latest | |
| name: Upload docs dist artifact | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Node setup | |
| uses: ./.github/actions/node-setup | |
| - name: Build VKUI | |
| run: yarn build:vkui | |
| - name: Build | |
| run: yarn docs:website:build | |
| env: | |
| NEXT_PUBLIC_VKUI_DOCS_BASE_PATH: /pull/${{ github.event.pull_request.number }}/${{ github.event.pull_request.head.sha }} | |
| - name: Upload dist | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: docs-website-dist | |
| path: website/out | |
| upload_pr_workflow_payload: | |
| # Дожидаемся выгрузки артефактов, на случай если вокрфлоу будет отменён или перезапушен | |
| needs: [test, test_e2e_prepare_and_upload_report, 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@v5 | |
| - name: Enable Corepack | |
| run: corepack enable | |
| shell: bash | |
| - name: Setup NodeJS | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'yarn' | |
| - name: Install dependencies | |
| run: YARN_ENABLE_SCRIPTS=false yarn install --immutable --check-cache --check-resolutions |