Skip to content

tech: Use yarn v3 #2073

tech: Use yarn v3

tech: Use yarn v3 #2073

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 }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Find changes
uses: dorny/paths-filter@v2
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@v3
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- name: Install dependencies
run: YARN_ENABLE_SCRIPTS=false yarn install --immutable
- 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@v3
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@v3
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- name: Install dependencies
run: YARN_ENABLE_SCRIPTS=false yarn install --immutable
- name: Download Playwright blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v3
with:
name: all-blob-reports
path: all-blob-reports
- 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@v3
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@v3
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: Install dependencies
run: YARN_ENABLE_SCRIPTS=false yarn install --immutable
- uses: andresz1/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# only affects current branch
skip_step: install
directory: packages/vkui/
# В 1.7.0 пока нет этого свойства. См. packages/vkui/yarn.lock
# package_manager: yarn
build_script: 'size:ci'
script: /bin/bash -c "npx 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@v3
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- name: Install dependencies
run: YARN_ENABLE_SCRIPTS=false yarn install --immutable
- name: Build
run: yarn run docs:styleguide:build
- name: Upload dist
uses: actions/upload-artifact@v3
with:
name: styleguide-dist
path: styleguide/dist
docs_storybook_upload:
if: ${{ needs.changed_files.outputs.docs_styleguide == 'true' }}
needs: changed_files
runs-on: ubuntu-latest
name: Upload docs dist artifact (storybook)
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- name: Install dependencies
run: YARN_ENABLE_SCRIPTS=false yarn install --immutable
- name: Build
run: yarn docs:storybook:build
- name: Upload dist
uses: actions/upload-artifact@v3
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