ci: progressive test gates lighter PRs, heavier staging

This commit is contained in:
quotentiroler
2026-02-06 18:27:37 -08:00
parent b351ae1d8c
commit b43af44dc6
2 changed files with 33 additions and 80 deletions

View File

@@ -8,7 +8,13 @@ on:
- beta
pull_request:
workflow_call:
# Called by testing-strategy.yml for releases
# Called by testing-strategy.yml for staged releases
inputs:
test_stage:
description: "Testing stage: develop, alpha, beta, or stable. Controls which platform tests run."
required: false
type: string
default: ""
outputs:
checks_result:
description: "Result of core checks"
@@ -19,6 +25,12 @@ on:
windows_result:
description: "Result of Windows checks"
value: ${{ jobs.checks-windows.result }}
macos_result:
description: "Result of macOS checks"
value: ${{ jobs.checks-macos.result }}
macos_app_result:
description: "Result of macOS app checks"
value: ${{ jobs.macos-app.result }}
concurrency:
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -202,6 +214,10 @@ jobs:
fi
checks-windows:
# Windows tests: beta+ staging only (not on regular PRs to save compute)
if: |
inputs.test_stage == 'beta' ||
inputs.test_stage == 'stable'
runs-on: blacksmith-4vcpu-windows-2025
env:
NODE_OPTIONS: --max-old-space-size=4096
@@ -310,12 +326,9 @@ jobs:
- name: Run ${{ matrix.task }} (${{ matrix.runtime }})
run: ${{ matrix.command }}
# Consolidated macOS job: runs TS tests + Swift lint/build/test sequentially
# on a single runner. GitHub limits macOS concurrent jobs to 5 per org;
# running 4 separate jobs per PR (as before) starved the queue. One job
# per PR allows 5 PRs to run macOS checks simultaneously.
macos:
if: github.event_name == 'pull_request'
checks-macos:
# macOS tests: stable staging only (not on regular PRs to save compute)
if: inputs.test_stage == 'stable'
runs-on: macos-latest
steps:
- name: Checkout

View File

@@ -1,11 +1,12 @@
name: Testing Strategy
# Reusable testing workflow for staged releases
# Calls ci.yml for core tests, adds stage-specific extras
# Passes test_stage to ci.yml to control which platform tests run
#
# Test coverage by stage:
# - develop/alpha/beta: Uses ci.yml (checks, secrets, windows)
# - stable: + macOS tests, install smoke
# Progressive test coverage by stage:
# - develop/alpha: core checks + secrets + android
# - beta: + Windows tests
# - stable: + macOS tests, macOS app, install smoke
on:
workflow_call:
@@ -28,71 +29,14 @@ on:
required: false
jobs:
# Run existing CI workflow (checks, secrets, windows)
# Run CI with stage-appropriate platform gates
ci:
name: Core CI
uses: ./.github/workflows/ci.yml
with:
test_stage: ${{ inputs.test_stage }}
secrets: inherit
# macOS tests (stable only)
checks-macos:
name: macOS Checks
if: inputs.test_stage == 'stable'
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: false
- name: Checkout submodules (retry)
run: |
set -euo pipefail
git submodule sync --recursive
for attempt in 1 2 3 4 5; do
if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then
exit 0
fi
echo "Submodule update failed (attempt $attempt/5). Retrying…"
sleep $((attempt * 10))
done
exit 1
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22.x
check-latest: true
- name: Setup pnpm (corepack retry)
run: |
set -euo pipefail
corepack enable
for attempt in 1 2 3; do
if corepack prepare pnpm@10.23.0 --activate; then
pnpm -v
exit 0
fi
echo "corepack prepare failed (attempt $attempt/3). Retrying..."
sleep $((attempt * 10))
done
exit 1
- name: Capture node path
run: echo "NODE_BIN=$(dirname \"$(node -p \"process.execPath\")\")" >> "$GITHUB_ENV"
- name: Install dependencies
env:
CI: true
run: |
export PATH="$NODE_BIN:$PATH"
pnpm install --frozen-lockfile --ignore-scripts=false --config.engine-strict=false --config.enable-pre-post-scripts=true
- name: Run tests
env:
NODE_OPTIONS: --max-old-space-size=4096
run: pnpm test
# Install smoke test (stable only)
install-smoke:
name: Install Smoke Test
@@ -133,7 +77,7 @@ jobs:
test-summary:
name: Test Summary (${{ inputs.test_stage }})
runs-on: ubuntu-latest
needs: [ci, checks-macos, install-smoke]
needs: [ci, install-smoke]
if: always()
outputs:
overall_status: ${{ steps.summary.outputs.overall_status }}
@@ -145,26 +89,22 @@ jobs:
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Test Suite | Result |" >> $GITHUB_STEP_SUMMARY
echo "|------------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| CI (checks + secrets + windows) | ${{ needs.ci.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| macOS Checks | ${{ needs.checks-macos.result || 'skipped' }} |" >> $GITHUB_STEP_SUMMARY
echo "| CI (checks + secrets) | ${{ needs.ci.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Install Smoke | ${{ needs.install-smoke.result || 'skipped' }} |" >> $GITHUB_STEP_SUMMARY
# CI must pass
# CI must pass (includes platform-specific jobs based on test_stage)
if [ "${{ needs.ci.result }}" != "success" ]; then
echo "overall_status=failed" >> $GITHUB_OUTPUT
echo "" >> $GITHUB_STEP_SUMMARY
echo "### ❌ Core CI failed" >> $GITHUB_STEP_SUMMARY
echo "### ❌ CI failed" >> $GITHUB_STEP_SUMMARY
exit 0
fi
# Stage-specific checks (stable only has extras)
# Stage-specific checks
STAGE="${{ inputs.test_stage }}"
FAILED=false
if [ "$STAGE" = "stable" ]; then
if [ "${{ needs.checks-macos.result }}" = "failure" ]; then
FAILED=true
fi
if [ "${{ needs.install-smoke.result }}" = "failure" ]; then
FAILED=true
fi