/
githubmirror
/
gutenberg
Обзор
Документация
Войти
/
githubmirror
/
gutenberg
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
.github/workflows/static-checks.yml
131 строка
5 KB
Adrian Moldovan
CI: Add job timeouts to E2E, static checks, bundle size, and create block (#80801)
04 авг 2026, 04:17
Не верифицирован
04 авг 2026, 04:17
27f57c9
Код
Авторство
О чём код?
name: Static Analysis (Linting, License, Type checks...) on: pull_request: push: branches: - trunk - 'release/**' - 'wp/**' # Cancels all previous workflow runs for pull requests that have not completed. concurrency: # The concurrency group contains the workflow name and the branch name for pull requests # or the commit hash for any other events. group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} cancel-in-progress: true # Disable permissions for all available scopes by default. # Any needed permissions should be configured at the job level. permissions: {} jobs: check: name: All${{ (matrix.node != '20' || matrix.os != 'ubuntu-24.04') && format(' (Node.js {0} on {1})', matrix.node, contains(matrix.os, 'macos-') && 'MacOS' || contains(matrix.os, 'windows-') && 'Windows' || 'Linux') || '' }} runs-on: ${{ matrix.os }} env: NODE_OPTIONS: --max-old-space-size=4096 permissions: contents: read if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }} timeout-minutes: 30 strategy: matrix: event: ['${{ github.event_name }}'] node: ['20', '22', '24'] os: ['macos-15', 'ubuntu-24.04', 'windows-2025'] include: # Only generate annotations once. - node: '24' os: 'ubuntu-24.04' annotations: true exclude: # On PRs: Only test Node 20 on Ubuntu and Windows - event: 'pull_request' node: '22' - event: 'pull_request' os: 'macos-15' steps: # The BASE branch commit must be present for the check-root-dependencies script to read the package.json and # compare with the HEAD branch. Fetching a depth of 2 ensures that's present. # All other jobs only require a depth of 1. - name: Checkout repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} fetch-depth: ${{ matrix.annotations && github.event_name == 'pull_request' && 2 || 1 }} persist-credentials: false - name: Use desired version of Node.js uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version: ${{ matrix.node }} cache: npm - name: Pin npm version for consistency run: | npm install --global npm@10 npm --version - name: npm install # A "full" install is executed, since `npm ci` does not always exit # with an error status code if the lock file is inaccurate. This also # helps to catch dependencies not being installed with exact version. # # See: https://github.com/WordPress/gutenberg/issues/16157 # See: https://github.com/WordPress/gutenberg/pull/39865 run: npm install - name: Lint package.json files run: npm run lint:pkg-json - name: Lint dependency versions across workspaces run: npm run lint:deps - name: Check root dependencies if: ${{ matrix.annotations && github.event_name == 'pull_request' }} run: | BASE_SHA="$(git rev-parse HEAD^1)" npm run --workspace @wordpress/validation-tools check-root-dependencies -- --base "$BASE_SHA" - name: Lint package-lock.json file run: npm run lint:lockfile - name: Validate TypeScript config run: npm run lint:tsconfig - name: Lint JavaScript if: ${{ matrix.annotations }} # `--quiet` reports only errors so they aren't buried under warnings in the CI log. # `--prune-suppressions` ensures `suppressions.json` stays in sync. run: npm run lint:js -- --format compact --quiet --prune-suppressions - name: Test agent skill setup run: npm run test:unit -- tools/agents/test/setup-skills.test.js --runInBand - name: Lint Styles if: ${{ matrix.annotations }} # Stylelint has no separate prune flag. Run lint first so new violations fail, # then `--suppress` to prune stale suppressions (same outcome as ESLint's # `--prune-suppressions` + check-local-changes). run: | npm run lint:css -- --formatter compact npm run lint:css:update-suppressions - name: Type checking run: npm run build - name: Validate package contents run: npm run lint:package-contents - name: Audit published dependencies if: ${{ matrix.annotations }} run: npm run lint:published-deps -- --fail-unused-ignores - name: Check local changes run: npm run other:check-local-changes - name: License compatibility run: npm run other:check-licenses