mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-06-02 06:46:15 -07:00
refactor: extract orchestrator — delete 30k lines, decouple all imports
Remove the entire src/model/orchestrator/ directory (148 files, ~30k lines) and refactor all dependent code to use the plugin loader pattern. Key changes: - build-parameters.ts: replace OrchestratorOptions with Input.getInput() - input.ts: remove OrchestratorQueryOverride input source - github.ts: strip to minimal class (only githubInputEnabled remains) - cli/cli.ts: remove orchestrator CLI commands, simplify to core structure - input-readers/*: replace OrchestratorSystem.Run with child_process.exec - orchestrator-plugin.ts: import from @game-ci/orchestrator package - orchestrate.ts, build.ts: use plugin loader instead of direct imports - index.ts: inline SyncStrategy type, fix implicit any types - Add type declarations for @game-ci/orchestrator - Remove orchestrator-only npm dependencies (AWS SDK, K8s, etc.) - Remove orchestrator-specific npm scripts and CI workflows - Update validate-orchestrator.yml for external repo validation All enterprise features gracefully degrade when @game-ci/orchestrator is not installed — the plugin loader returns undefined and optional chaining in index.ts skips all enterprise service calls. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
61
.github/workflows/orchestrator-async-checks.yml
vendored
61
.github/workflows/orchestrator-async-checks.yml
vendored
@@ -1,61 +0,0 @@
|
||||
name: Async Checks API
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
checksObject:
|
||||
description: ''
|
||||
required: false
|
||||
default: ''
|
||||
|
||||
permissions:
|
||||
checks: write
|
||||
|
||||
env:
|
||||
GKE_ZONE: 'us-central1'
|
||||
GKE_REGION: 'us-central1'
|
||||
GKE_PROJECT: 'unitykubernetesbuilder'
|
||||
GKE_CLUSTER: 'game-ci-github-pipelines'
|
||||
GCP_LOGGING: true
|
||||
GCP_PROJECT: unitykubernetesbuilder
|
||||
GCP_LOG_FILE: ${{ github.workspace }}/orchestrator-logs.txt
|
||||
# Commented out: Using LocalStack tests instead of real AWS
|
||||
# AWS_REGION: eu-west-2
|
||||
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
# AWS_DEFAULT_REGION: eu-west-2
|
||||
# AWS_STACK_NAME: game-ci-github-pipelines
|
||||
ORCHESTRATOR_BRANCH: ${{ github.ref }}
|
||||
ORCHESTRATOR_DEBUG: true
|
||||
ORCHESTRATOR_DEBUG_TREE: true
|
||||
DEBUG: true
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
PROJECT_PATH: test-project
|
||||
UNITY_VERSION: 2019.3.15f1
|
||||
USE_IL2CPP: false
|
||||
|
||||
jobs:
|
||||
asyncChecks:
|
||||
name: Async Checks
|
||||
if: github.event.event_type != 'pull_request_target'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- timeout-minutes: 180
|
||||
env:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
PROJECT_PATH: test-project
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GIT_PRIVATE_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
TARGET_PLATFORM: StandaloneWindows64
|
||||
orchestratorTests: true
|
||||
versioning: None
|
||||
ORCHESTRATOR_CLUSTER: local-docker
|
||||
# Commented out: Using LocalStack tests instead of real AWS
|
||||
# AWS_STACK_NAME: game-ci-github-pipelines
|
||||
CHECKS_UPDATE: ${{ github.event.inputs.checksObject }}
|
||||
run: |
|
||||
git clone -b main https://github.com/game-ci/unity-builder
|
||||
cd unity-builder
|
||||
yarn
|
||||
ls
|
||||
yarn run cli -m checks-update
|
||||
1250
.github/workflows/orchestrator-integrity.yml
vendored
1250
.github/workflows/orchestrator-integrity.yml
vendored
File diff suppressed because it is too large
Load Diff
102
.github/workflows/validate-orchestrator.yml
vendored
102
.github/workflows/validate-orchestrator.yml
vendored
@@ -4,31 +4,29 @@ on:
|
||||
push:
|
||||
branches: [main, 'release/**', 'feature/**']
|
||||
paths:
|
||||
- 'src/model/orchestrator/**'
|
||||
- 'src/model/orchestrator-plugin.ts'
|
||||
- 'src/model/build-parameters.ts'
|
||||
- 'src/model/input.ts'
|
||||
- 'src/model/github.ts'
|
||||
- 'src/model/docker.ts'
|
||||
- 'src/model/cli/cli.ts'
|
||||
- 'src/model/cli/cli-functions-repository.ts'
|
||||
- 'src/model/input-readers/**'
|
||||
- 'src/model/shared-types.ts'
|
||||
- 'src/model/image-tag.ts'
|
||||
- 'src/model/action.ts'
|
||||
- 'src/index.ts'
|
||||
- 'src/types/game-ci-orchestrator.d.ts'
|
||||
- 'action.yml'
|
||||
- 'package.json'
|
||||
pull_request:
|
||||
branches: [main, 'release/**']
|
||||
paths:
|
||||
- 'src/model/orchestrator/**'
|
||||
- 'src/model/orchestrator-plugin.ts'
|
||||
- 'src/model/build-parameters.ts'
|
||||
- 'src/model/input.ts'
|
||||
- 'src/model/github.ts'
|
||||
- 'src/model/docker.ts'
|
||||
- 'src/model/cli/cli.ts'
|
||||
- 'src/model/cli/cli-functions-repository.ts'
|
||||
- 'src/model/input-readers/**'
|
||||
- 'src/model/shared-types.ts'
|
||||
- 'src/model/image-tag.ts'
|
||||
- 'src/model/action.ts'
|
||||
- 'src/index.ts'
|
||||
- 'src/types/game-ci-orchestrator.d.ts'
|
||||
- 'action.yml'
|
||||
- 'package.json'
|
||||
|
||||
jobs:
|
||||
validate-orchestrator:
|
||||
@@ -53,43 +51,59 @@ jobs:
|
||||
- name: Install unity-builder dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
- name: Verify orchestrator source is in sync
|
||||
- name: Verify unity-builder compiles without orchestrator
|
||||
run: |
|
||||
echo "Comparing orchestrator source files..."
|
||||
# Compare orchestrator source between unity-builder and standalone repo
|
||||
# Exclude interfaces.ts which only exists in standalone
|
||||
DIFF_OUTPUT=$(diff -rq src/model/orchestrator/ orchestrator-standalone/src/model/orchestrator/ --exclude="interfaces.ts" 2>&1 || true)
|
||||
if [ -n "$DIFF_OUTPUT" ]; then
|
||||
echo "::warning::Orchestrator source has diverged from standalone repo:"
|
||||
echo "$DIFF_OUTPUT"
|
||||
echo ""
|
||||
echo "Files that differ:"
|
||||
diff -rq src/model/orchestrator/ orchestrator-standalone/src/model/orchestrator/ --exclude="interfaces.ts" | head -20 || true
|
||||
echo "Verifying unity-builder compiles without @game-ci/orchestrator installed..."
|
||||
npx tsc --noEmit
|
||||
echo "✓ unity-builder compiles successfully"
|
||||
|
||||
- name: Run unity-builder tests
|
||||
run: |
|
||||
echo "Running unity-builder tests..."
|
||||
npx jest --no-cache --passWithNoTests 2>&1 | tail -10
|
||||
|
||||
- name: Verify plugin loader gracefully handles missing orchestrator
|
||||
run: |
|
||||
echo "Checking that orchestrator-plugin.ts handles missing package..."
|
||||
# The plugin loader should return undefined when @game-ci/orchestrator is not installed
|
||||
node -e "
|
||||
const { loadOrchestrator, loadEnterpriseServices } = require('./lib/model/orchestrator-plugin');
|
||||
(async () => {
|
||||
const orch = await loadOrchestrator();
|
||||
if (orch !== undefined) {
|
||||
console.error('ERROR: loadOrchestrator should return undefined when package not installed');
|
||||
process.exit(1);
|
||||
}
|
||||
console.log('✓ loadOrchestrator() returns undefined when package not installed');
|
||||
|
||||
const services = await loadEnterpriseServices();
|
||||
if (services !== undefined) {
|
||||
console.error('ERROR: loadEnterpriseServices should return undefined when package not installed');
|
||||
process.exit(1);
|
||||
}
|
||||
console.log('✓ loadEnterpriseServices() returns undefined when package not installed');
|
||||
})();
|
||||
" 2>&1 || echo "::warning::Plugin loader test requires compiled JS (run yarn build first)"
|
||||
|
||||
- name: Verify orchestrator type declarations exist
|
||||
run: |
|
||||
if [ -f "src/types/game-ci-orchestrator.d.ts" ]; then
|
||||
echo "✓ Type declarations for @game-ci/orchestrator exist"
|
||||
else
|
||||
echo "✓ All orchestrator source files are in sync"
|
||||
echo "::error::Missing type declarations: src/types/game-ci-orchestrator.d.ts"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Verify bridge file compatibility
|
||||
run: |
|
||||
echo "Checking that bridge file exports match unity-builder exports..."
|
||||
# Verify key exports exist in both repos
|
||||
for file in build-parameters input github docker action image-tag; do
|
||||
if [ -f "orchestrator-standalone/src/model/${file}.ts" ]; then
|
||||
echo "✓ Bridge file exists: src/model/${file}.ts"
|
||||
else
|
||||
echo "::error::Missing bridge file in orchestrator: src/model/${file}.ts"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
- name: Run orchestrator tests in unity-builder context
|
||||
run: |
|
||||
echo "Running orchestrator unit tests..."
|
||||
npx jest --no-cache --testPathPattern="src/model/orchestrator/" --passWithNoTests 2>&1 | tail -5
|
||||
|
||||
- name: Run orchestrator tests in standalone context
|
||||
- name: Run orchestrator standalone tests
|
||||
working-directory: orchestrator-standalone
|
||||
run: |
|
||||
yarn install --frozen-lockfile
|
||||
echo "Running orchestrator standalone tests..."
|
||||
npx jest --no-cache 2>&1 | tail -5
|
||||
npx jest --no-cache 2>&1 | tail -10
|
||||
|
||||
- name: Verify orchestrator standalone compiles
|
||||
working-directory: orchestrator-standalone
|
||||
run: |
|
||||
echo "Verifying orchestrator standalone compiles..."
|
||||
npx tsc --noEmit
|
||||
echo "✓ orchestrator standalone compiles successfully"
|
||||
|
||||
Reference in New Issue
Block a user