Restructure CI to prepare for required checks and merge queues (#61978)

This commit is contained in:
Jake Bailey 2025-07-31 16:04:06 -07:00 committed by GitHub
parent 39c5d01877
commit c1f5656041
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,6 +9,10 @@ on:
branches:
- main
- release-*
merge_group:
branches:
- main
# - release-*
permissions:
contents: read
@ -24,43 +28,107 @@ jobs:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
node-version:
- '22'
- '20'
- '18'
- '16'
- '14'
bundle:
- 'true'
include:
- node-version: 'lts/*'
bundle: false
os: ubuntu-latest
exclude:
# No Node 14 on ARM macOS
- node-version: '14'
os: macos-latest
config:
# Main builds
- os: ubuntu-latest
node-version: '24'
bundle: true
runs-on: ${{ matrix.os }}
name: Test Node ${{ matrix.node-version }} on ${{ matrix.os }}${{ (!matrix.bundle && ' with --no-bundle') || '' }}
# Other builds (skipped in merge queues)
- os: windows-latest
node-version: '24'
bundle: true
skip: ${{ github.event_name == 'merge_group' }}
- os: macos-latest
node-version: '24'
bundle: true
skip: ${{ github.event_name == 'merge_group' }}
- os: ubuntu-latest
node-version: '22'
bundle: true
- os: windows-latest
node-version: '22'
bundle: true
skip: ${{ github.event_name == 'merge_group' }}
# Skip macOS for this version; resources are limited.
# - os: macos-latest
# node-version: '22'
# bundle: true
# skip: ${{ github.event_name == 'merge_group' }}
- os: ubuntu-latest
node-version: '20'
bundle: true
- os: windows-latest
node-version: '20'
bundle: true
skip: ${{ github.event_name == 'merge_group' }}
# Skip macOS for this version; resources are limited.
# - os: macos-latest
# node-version: '20'
# bundle: true
# skip: ${{ github.event_name == 'merge_group' }}
- os: ubuntu-latest
node-version: '18'
bundle: true
- os: windows-latest
node-version: '18'
bundle: true
skip: ${{ github.event_name == 'merge_group' }}
# Skip macOS for this version; resources are limited.
# - os: macos-latest
# node-version: '18'
# bundle: true
# skip: ${{ github.event_name == 'merge_group' }}
- os: ubuntu-latest
node-version: '16'
bundle: true
- os: windows-latest
node-version: '16'
bundle: true
skip: ${{ github.event_name == 'merge_group' }}
- os: macos-latest
node-version: '16'
bundle: true
skip: ${{ github.event_name == 'merge_group' }}
- os: ubuntu-latest
node-version: '14'
bundle: true
skip: ${{ github.event_name == 'merge_group' }}
- os: windows-latest
node-version: '14'
bundle: true
skip: ${{ github.event_name == 'merge_group' }}
# No Node 14 on ARM macOS
# - os: macos-latest
# node-version: '14'
# bundle: true
# skip: ${{ github.event_name == 'merge_group' }}
- os: ubuntu-latest
node-version: 'lts/*'
bundle: false
skip: ${{ github.event_name == 'merge_group' }}
exclude:
- config:
skip: true
runs-on: ${{ matrix.config.os }}
name: Test Node ${{ matrix.config.node-version }} on ${{ matrix.config.os }}${{ (!matrix.config.bundle && ' with --no-bundle') || '' }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Use node version ${{ matrix.node-version }}
- name: Use node version ${{ matrix.config.node-version }}
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: ${{ matrix.node-version }}
node-version: ${{ matrix.config.node-version }}
check-latest: true
- run: npm ci
- name: Tests
id: test
# run tests, but lint separately
run: npm run test -- --no-lint --bundle=${{ matrix.bundle }}
run: npm run test -- --no-lint --bundle=${{ matrix.config.bundle }}
- name: Print baseline diff on failure
if: ${{ failure() && steps.test.conclusion == 'failure' }}
@ -70,6 +138,8 @@ jobs:
git diff --staged --exit-code
coverage:
if: ${{ github.event_name != 'merge_group' }}
runs-on:
- 'self-hosted'
- '1ES.Pool=TypeScript-1ES-GitHub-Large'
@ -294,6 +364,8 @@ jobs:
run: npx hereby build-src --built
baselines:
if: ${{ github.event_name != 'merge_group' }}
runs-on: ubuntu-latest
steps:
@ -338,3 +410,27 @@ jobs:
with:
name: fix_baselines.patch
path: fix_baselines.patch
required:
runs-on: ubuntu-latest
if: ${{ always() }}
needs:
- test
- coverage
- lint
- knip
- format
- browser-integration
- typecheck
- smoke
- package-size
- misc
- self-check
- baselines
steps:
- name: Check required jobs
env:
NEEDS: ${{ toJson(needs) }}
run: |
! echo $NEEDS | jq -e 'to_entries[] | { job: .key, result: .value.result } | select((.result == "success" or .result == "skipped") | not)'