mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-06-16 13:06:53 -07:00
refactor(ci): split orchestrator tests into per-PR health checks and nightly exhaustive suite
validate-orchestrator.yml (per-PR, ~5 min):
- Plugin architecture health: compilation, unit tests, plugin loader
graceful degradation, installed service validation, type declaration checks
validate-orchestrator-integration.yml (daily 3 AM UTC cron, ~1-2h):
- 5 parallel jobs mirroring orchestrator-integrity.yml:
plugin-interface, k8s (5 tests), aws (10 tests),
local-docker (9 tests), rclone (1 test)
- Full LocalStack + k3d integration coverage
- continue-on-error on known flaky end2end tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,13 @@
|
|||||||
name: Validate Orchestrator Compatibility
|
name: Validate Orchestrator Compatibility
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
# Essential plugin health checks — runs on every PR and push.
|
||||||
|
# Fast (~5 min): compilation, unit tests, plugin interface, type declarations.
|
||||||
|
#
|
||||||
|
# For exhaustive integration tests (k8s, AWS, local-docker, rclone) see
|
||||||
|
# validate-orchestrator-integration.yml which runs on a daily cron.
|
||||||
|
# ==============================================================================
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
@@ -15,6 +23,7 @@ on:
|
|||||||
- 'src/types/game-ci-orchestrator.d.ts'
|
- 'src/types/game-ci-orchestrator.d.ts'
|
||||||
- 'action.yml'
|
- 'action.yml'
|
||||||
- 'package.json'
|
- 'package.json'
|
||||||
|
- '.github/workflows/validate-orchestrator.yml'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main, 'release/**']
|
branches: [main, 'release/**']
|
||||||
paths:
|
paths:
|
||||||
@@ -28,16 +37,31 @@ on:
|
|||||||
- 'src/types/game-ci-orchestrator.d.ts'
|
- 'src/types/game-ci-orchestrator.d.ts'
|
||||||
- 'action.yml'
|
- 'action.yml'
|
||||||
- 'package.json'
|
- 'package.json'
|
||||||
|
- '.github/workflows/validate-orchestrator.yml'
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
validate-orchestrator:
|
# ============================================================================
|
||||||
name: Orchestrator Compatibility Check
|
# PLUGIN ARCHITECTURE HEALTH CHECK
|
||||||
|
# ============================================================================
|
||||||
|
# Validates that:
|
||||||
|
# 1. unity-builder compiles and its unit tests pass
|
||||||
|
# 2. Plugin loader degrades gracefully without orchestrator
|
||||||
|
# 3. Orchestrator compiles and its unit tests pass
|
||||||
|
# 4. Plugin loader loads all services when orchestrator is installed
|
||||||
|
# 5. Type declarations match actual exports
|
||||||
|
# ============================================================================
|
||||||
|
plugin-health:
|
||||||
|
name: Plugin Architecture Health
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout unity-builder
|
- name: Checkout unity-builder
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Checkout orchestrator repo
|
- name: Checkout orchestrator
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: game-ci/orchestrator
|
repository: game-ci/orchestrator
|
||||||
@@ -49,6 +73,7 @@ jobs:
|
|||||||
node-version: 20
|
node-version: 20
|
||||||
cache: yarn
|
cache: yarn
|
||||||
|
|
||||||
|
# --- unity-builder compilation and tests ---
|
||||||
- name: Install unity-builder dependencies
|
- name: Install unity-builder dependencies
|
||||||
run: yarn install --frozen-lockfile
|
run: yarn install --frozen-lockfile
|
||||||
|
|
||||||
@@ -58,11 +83,12 @@ jobs:
|
|||||||
npx tsc
|
npx tsc
|
||||||
echo "✓ unity-builder compiles successfully"
|
echo "✓ unity-builder compiles successfully"
|
||||||
|
|
||||||
- name: Run unity-builder tests
|
- name: Run orchestrator-plugin unit tests
|
||||||
run: |
|
run: |
|
||||||
echo "Running unity-builder tests..."
|
echo "Running orchestrator-plugin unit tests..."
|
||||||
npx jest --no-cache --passWithNoTests 2>&1 | tail -10
|
npx jest orchestrator-plugin --verbose --detectOpenHandles --forceExit
|
||||||
|
|
||||||
|
# --- Plugin loader without orchestrator ---
|
||||||
- name: Verify plugin loader returns undefined without orchestrator
|
- name: Verify plugin loader returns undefined without orchestrator
|
||||||
run: |
|
run: |
|
||||||
echo "Checking plugin loader handles missing @game-ci/orchestrator..."
|
echo "Checking plugin loader handles missing @game-ci/orchestrator..."
|
||||||
@@ -94,26 +120,31 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Build and install orchestrator standalone
|
# --- Orchestrator compilation and tests ---
|
||||||
|
- name: Build and pack orchestrator
|
||||||
working-directory: orchestrator-standalone
|
working-directory: orchestrator-standalone
|
||||||
run: |
|
run: |
|
||||||
yarn install --frozen-lockfile
|
yarn install --frozen-lockfile
|
||||||
echo "Building orchestrator standalone..."
|
echo "Building orchestrator..."
|
||||||
npx tsc
|
npx tsc
|
||||||
echo "✓ orchestrator standalone compiles successfully"
|
echo "✓ orchestrator compiles successfully"
|
||||||
echo "Packing orchestrator as tarball..."
|
echo "Packing orchestrator as tarball..."
|
||||||
npm pack
|
npm pack
|
||||||
|
|
||||||
- name: Run orchestrator standalone tests
|
- name: Run orchestrator unit tests
|
||||||
working-directory: orchestrator-standalone
|
working-directory: orchestrator-standalone
|
||||||
run: |
|
run: |
|
||||||
echo "Running orchestrator standalone tests..."
|
echo "Running orchestrator unit tests..."
|
||||||
npx jest --no-cache 2>&1 | tail -10
|
npx jest --no-cache 2>&1 | tail -20
|
||||||
|
|
||||||
- name: Verify plugin loader returns exports with orchestrator installed
|
# --- Plugin loader with orchestrator installed ---
|
||||||
|
- name: Install orchestrator into unity-builder
|
||||||
run: |
|
run: |
|
||||||
echo "Installing orchestrator into unity-builder workspace..."
|
echo "Installing orchestrator into unity-builder workspace..."
|
||||||
npm install ./orchestrator-standalone/game-ci-orchestrator-*.tgz --no-save --legacy-peer-deps
|
npm install ./orchestrator-standalone/game-ci-orchestrator-*.tgz --no-save --legacy-peer-deps
|
||||||
|
|
||||||
|
- name: Verify plugin loader returns exports with orchestrator installed
|
||||||
|
run: |
|
||||||
echo "Checking plugin loader returns defined exports..."
|
echo "Checking plugin loader returns defined exports..."
|
||||||
node -e "
|
node -e "
|
||||||
const { loadOrchestrator, loadEnterpriseServices } = require('./lib/model/orchestrator-plugin');
|
const { loadOrchestrator, loadEnterpriseServices } = require('./lib/model/orchestrator-plugin');
|
||||||
@@ -134,6 +165,54 @@ jobs:
|
|||||||
console.error('ERROR: loadEnterpriseServices should return defined exports when package is installed');
|
console.error('ERROR: loadEnterpriseServices should return defined exports when package is installed');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
console.log('✓ loadEnterpriseServices() returns defined exports with orchestrator installed');
|
const expectedServices = [
|
||||||
|
'BuildReliabilityService', 'TestWorkflowService', 'HotRunnerService',
|
||||||
|
'OutputService', 'OutputTypeRegistry', 'ArtifactUploadHandler',
|
||||||
|
'IncrementalSyncService',
|
||||||
|
];
|
||||||
|
for (const svc of expectedServices) {
|
||||||
|
if (services[svc] === undefined) {
|
||||||
|
console.error('ERROR: ' + svc + ' should be defined');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log('✓ loadEnterpriseServices() returns all ' + expectedServices.length + ' services');
|
||||||
|
|
||||||
|
const lazyLoaders = [
|
||||||
|
'loadChildWorkspaceService', 'loadLocalCacheService',
|
||||||
|
'loadSubmoduleProfileService', 'loadLfsAgentService', 'loadGitHooksService',
|
||||||
|
];
|
||||||
|
for (const loader of lazyLoaders) {
|
||||||
|
if (typeof services[loader] !== 'function') {
|
||||||
|
console.error('ERROR: ' + loader + ' should be a function');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
const loaded = await services[loader]();
|
||||||
|
if (loaded === undefined) {
|
||||||
|
console.error('ERROR: ' + loader + '() should return defined service');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log('✓ All ' + lazyLoaders.length + ' lazy loaders return defined services');
|
||||||
})();
|
})();
|
||||||
"
|
"
|
||||||
|
|
||||||
|
- name: Verify type declarations match orchestrator exports
|
||||||
|
run: |
|
||||||
|
echo "Checking type declarations align with orchestrator exports..."
|
||||||
|
node -e "
|
||||||
|
const orch = require('@game-ci/orchestrator');
|
||||||
|
const expectedExports = [
|
||||||
|
'Orchestrator', 'BuildReliabilityService', 'TestWorkflowService',
|
||||||
|
'HotRunnerService', 'OutputService', 'OutputTypeRegistry',
|
||||||
|
'ArtifactUploadHandler', 'IncrementalSyncService',
|
||||||
|
'ChildWorkspaceService', 'LocalCacheService', 'SubmoduleProfileService',
|
||||||
|
'LfsAgentService', 'GitHooksService',
|
||||||
|
];
|
||||||
|
const missing = expectedExports.filter(e => orch[e] === undefined);
|
||||||
|
if (missing.length > 0) {
|
||||||
|
console.error('ERROR: Missing exports from @game-ci/orchestrator:', missing.join(', '));
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
console.log('✓ All ' + expectedExports.length + ' declared exports present in orchestrator package');
|
||||||
|
"
|
||||||
|
|||||||
Reference in New Issue
Block a user