/
githubmirror
/
ydb-embedded-ui
Обзор
Документация
Войти
/
githubmirror
/
ydb-embedded-ui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
.github/workflows/quality.yml
199 строк
6 KB
Anton Standrik
ci: cancel superseded pull request workflows (#4227)
12 авг 2026, 13:23
Не верифицирован
12 авг 2026, 13:23
197c98f
Код
Авторство
О чём код?
name: Quality Checks on: pull_request: branches: ['**'] push: branches: [main] concurrency: group: ${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.run_attempt == '1' && github.event.pull_request.number) || github.run_id }} cancel-in-progress: ${{ github.event_name == 'pull_request' && github.run_attempt == '1' }} jobs: e2e_tests: name: Playwright Tests (${{ matrix.shard }}/${{ matrix.shardTotal }}) timeout-minutes: 30 runs-on: ubuntu-latest permissions: contents: read strategy: fail-fast: false matrix: shard: [1, 2, 3, 4, 5, 6, 7, 8] shardTotal: [8] steps: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha || github.sha }} fetch-depth: 0 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 24 - name: Start local YDB id: ydb uses: astandrik/setup-local-ydb@07ceb4e25e2fcefd51c9cad5b6ee396767ef030b # v1.1.0 with: version: nightly topology: root auth: 'false' cleanup: 'true' - name: Run Playwright tests run: bash scripts/playwright-docker.sh --shard=${{ matrix.shard }}/${{ matrix.shardTotal }} env: CI: 'true' PLAYWRIGHT_APP_BACKEND: ${{ steps.ydb.outputs.monitoring-url }} # Playwright 1.58 internal weighted sharding; remeasure after suite/version changes. PWTEST_SHARD_WEIGHTS: '222:154:103:97:84:46:99:71' - name: Upload blob report if: always() uses: actions/upload-artifact@v4 with: name: blob-report-${{ matrix.shard }} path: blob-report retention-days: 1 merge_reports: name: Merge Playwright Reports if: ${{ !cancelled() }} needs: [e2e_tests] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha || github.sha }} fetch-depth: 0 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 24 cache: npm - name: Install Playwright run: npm install --no-save @playwright/test - name: Download blob reports uses: actions/download-artifact@v4 with: path: all-blob-reports pattern: blob-report-* merge-multiple: true - name: Merge reports run: npx playwright merge-reports --config=merge.config.ts ./all-blob-reports - name: Upload Playwright artifacts if: always() uses: actions/upload-artifact@v4 with: name: playwright-artifacts path: playwright-artifacts retention-days: 5 bundle_size: name: Check Bundle Size runs-on: ubuntu-latest if: github.event_name == 'pull_request' outputs: current_size: ${{ steps.current_size.outputs.size }} main_size: ${{ steps.main_size.outputs.size }} diff: ${{ steps.size_diff.outputs.diff }} percent: ${{ steps.size_diff.outputs.percent }} steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 24 cache: npm - name: Install dependencies run: npm ci - name: Build bundle (current branch) run: npm run build - name: Get current bundle size id: current_size run: | size=$(du -sb build | cut -f1) echo "size=$size" >> $GITHUB_OUTPUT - name: Checkout main branch uses: actions/checkout@v4 with: ref: main - name: Install dependencies (main) run: npm ci - name: Build bundle (main branch) run: npm run build - name: Get main bundle size id: main_size run: | size=$(du -sb build | cut -f1) echo "size=$size" >> $GITHUB_OUTPUT - name: Calculate size difference id: size_diff run: | current=${{ steps.current_size.outputs.size }} main=${{ steps.main_size.outputs.size }} diff=$((current - main)) if [ "$main" -ne "0" ]; then percent=$(awk "BEGIN {printf \"%.2f\", ($diff/$main) * 100}") else percent="N/A" fi echo "diff=$diff" >> $GITHUB_OUTPUT echo "percent=$percent" >> $GITHUB_OUTPUT update_pr: name: Update PR Description needs: [merge_reports, bundle_size] if: ${{ !cancelled() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }} runs-on: ubuntu-latest permissions: pull-requests: write steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Download Playwright artifacts uses: actions/download-artifact@v4 with: name: playwright-artifacts path: playwright-artifacts - name: Fetch gh-pages branch run: | git fetch origin gh-pages:gh-pages mkdir gh-pages git --work-tree=gh-pages checkout gh-pages -- . - name: Update PR description uses: actions/github-script@v6 env: CURRENT_SIZE: ${{ needs.bundle_size.outputs.current_size }} MAIN_SIZE: ${{ needs.bundle_size.outputs.main_size }} SIZE_DIFF: ${{ needs.bundle_size.outputs.diff }} SIZE_PERCENT: ${{ needs.bundle_size.outputs.percent }} with: github-token: ${{secrets.GITHUB_TOKEN}} script: | const updatePRDescription = require('./.github/workflows/scripts/update-pr-description.js'); await updatePRDescription(github, context);