Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 119 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
branches:
- main
- release-*
merge_group:
branches:
- main
# - release-*

permissions:
contents: read
Expand All @@ -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/*'
config:
# Main builds
- os: ubuntu-latest
node-version: '24'
bundle: true

# 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
os: ubuntu-latest
skip: ${{ github.event_name == 'merge_group' }}

exclude:
# No Node 14 on ARM macOS
- node-version: '14'
os: macos-latest
- config:
skip: true

runs-on: ${{ matrix.os }}
name: Test Node ${{ matrix.node-version }} on ${{ matrix.os }}${{ (!matrix.bundle && ' with --no-bundle') || '' }}
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' }}
Expand All @@ -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'
Expand Down Expand Up @@ -294,6 +364,8 @@ jobs:
run: npx hereby build-src --built

baselines:
if: ${{ github.event_name != 'merge_group' }}

runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -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)'