mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-06-01 22:36:15 -07:00
refactor: move CLI to orchestrator, fix validate-orchestrator workflow
- Delete src/cli.ts, src/cli/ (commands, tests, input-mapper) — moved to game-ci/orchestrator repo (PR #813 reference) - Delete .github/workflows/release-cli.yml — moved to orchestrator - Remove bin, pkg, yargs, @types/yargs, pkg from package.json - Fix validate-orchestrator.yml: - Build TypeScript before running require() smoke tests - Remove || echo fallback that swallowed errors - Add smoke test that installs orchestrator via npm pack and verifies loadOrchestrator() returns defined exports Legacy src/model/cli/ (Cli class, CliFunctionsRepository) preserved — used by Input.getInput() and build-parameters.ts on main. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
170
.github/workflows/release-cli.yml
vendored
170
.github/workflows/release-cli.yml
vendored
@@ -1,170 +0,0 @@
|
||||
name: Release CLI
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Release tag to build (e.g., v2.0.0). Uses latest release if empty.'
|
||||
required: false
|
||||
type: string
|
||||
publish-npm:
|
||||
description: 'Publish to npm'
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.release.tag_name || inputs.tag || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build-binaries:
|
||||
name: Build ${{ matrix.target }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- target: linux-x64
|
||||
os: ubuntu-latest
|
||||
pkg-target: node20-linux-x64
|
||||
binary-name: game-ci-linux-x64
|
||||
- target: linux-arm64
|
||||
os: ubuntu-latest
|
||||
pkg-target: node20-linux-arm64
|
||||
binary-name: game-ci-linux-arm64
|
||||
- target: macos-x64
|
||||
os: macos-latest
|
||||
pkg-target: node20-macos-x64
|
||||
binary-name: game-ci-macos-x64
|
||||
- target: macos-arm64
|
||||
os: macos-latest
|
||||
pkg-target: node20-macos-arm64
|
||||
binary-name: game-ci-macos-arm64
|
||||
- target: windows-x64
|
||||
os: windows-latest
|
||||
pkg-target: node20-win-x64
|
||||
binary-name: game-ci-windows-x64.exe
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.release.tag_name || inputs.tag || github.ref }}
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
- name: Build TypeScript
|
||||
run: yarn build
|
||||
|
||||
- name: Verify CLI before packaging
|
||||
run: node lib/cli.js version
|
||||
|
||||
- name: Build standalone binary
|
||||
run: npx pkg lib/cli.js --target ${{ matrix.pkg-target }} --output ${{ matrix.binary-name }} --compress GZip
|
||||
|
||||
- name: Verify standalone binary (non-cross-compiled)
|
||||
if: |
|
||||
(matrix.target == 'linux-x64' && runner.os == 'Linux') ||
|
||||
(matrix.target == 'macos-arm64' && runner.os == 'macOS' && runner.arch == 'ARM64') ||
|
||||
(matrix.target == 'macos-x64' && runner.os == 'macOS' && runner.arch == 'X64') ||
|
||||
(matrix.target == 'windows-x64' && runner.os == 'Windows')
|
||||
run: ./${{ matrix.binary-name }} version
|
||||
shell: bash
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: binary-${{ matrix.target }}
|
||||
path: ${{ matrix.binary-name }}
|
||||
retention-days: 5
|
||||
|
||||
create-checksums-and-upload:
|
||||
name: Checksums and release upload
|
||||
needs: build-binaries
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: binaries
|
||||
pattern: binary-*
|
||||
merge-multiple: true
|
||||
|
||||
- name: List binaries
|
||||
run: ls -la binaries/
|
||||
|
||||
- name: Generate SHA256 checksums
|
||||
run: |
|
||||
cd binaries
|
||||
sha256sum game-ci-* > checksums.txt
|
||||
echo "=== checksums.txt ==="
|
||||
cat checksums.txt
|
||||
|
||||
- name: Determine release tag
|
||||
id: tag
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "release" ]; then
|
||||
echo "tag=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT"
|
||||
elif [ -n "${{ inputs.tag }}" ]; then
|
||||
echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "No release tag available. Skipping upload."
|
||||
echo "tag=" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Upload binaries to release
|
||||
if: steps.tag.outputs.tag != ''
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
cd binaries
|
||||
for f in game-ci-* checksums.txt; do
|
||||
echo "Uploading $f..."
|
||||
gh release upload "${{ steps.tag.outputs.tag }}" "$f" \
|
||||
--repo "${{ github.repository }}" \
|
||||
--clobber
|
||||
done
|
||||
|
||||
publish-npm:
|
||||
name: Publish to npm
|
||||
needs: build-binaries
|
||||
runs-on: ubuntu-latest
|
||||
if: >-
|
||||
(github.event_name == 'release') || (github.event_name == 'workflow_dispatch' && inputs.publish-npm)
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.release.tag_name || inputs.tag || github.ref }}
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
- name: Build
|
||||
run: yarn build
|
||||
|
||||
- name: Run tests
|
||||
run: yarn test
|
||||
|
||||
- name: Verify CLI
|
||||
run: |
|
||||
node lib/cli.js version
|
||||
node lib/cli.js --help
|
||||
|
||||
- name: Publish to npm
|
||||
run: npm publish --provenance --access public
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
55
.github/workflows/validate-orchestrator.yml
vendored
55
.github/workflows/validate-orchestrator.yml
vendored
@@ -51,10 +51,10 @@ jobs:
|
||||
- name: Install unity-builder dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
- name: Verify unity-builder compiles without orchestrator
|
||||
- name: Build unity-builder
|
||||
run: |
|
||||
echo "Verifying unity-builder compiles without @game-ci/orchestrator installed..."
|
||||
npx tsc --noEmit
|
||||
echo "Building unity-builder TypeScript..."
|
||||
npx tsc
|
||||
echo "✓ unity-builder compiles successfully"
|
||||
|
||||
- name: Run unity-builder tests
|
||||
@@ -62,10 +62,9 @@ jobs:
|
||||
echo "Running unity-builder tests..."
|
||||
npx jest --no-cache --passWithNoTests 2>&1 | tail -10
|
||||
|
||||
- name: Verify plugin loader gracefully handles missing orchestrator
|
||||
- name: Verify plugin loader returns undefined without orchestrator
|
||||
run: |
|
||||
echo "Checking that orchestrator-plugin.ts handles missing package..."
|
||||
# The plugin loader should return undefined when @game-ci/orchestrator is not installed
|
||||
echo "Checking plugin loader handles missing @game-ci/orchestrator..."
|
||||
node -e "
|
||||
const { loadOrchestrator, loadEnterpriseServices } = require('./lib/model/orchestrator-plugin');
|
||||
(async () => {
|
||||
@@ -83,7 +82,7 @@ jobs:
|
||||
}
|
||||
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: |
|
||||
@@ -94,16 +93,46 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Run orchestrator standalone tests
|
||||
- name: Build and install orchestrator standalone
|
||||
working-directory: orchestrator-standalone
|
||||
run: |
|
||||
yarn install --frozen-lockfile
|
||||
echo "Building orchestrator standalone..."
|
||||
npx tsc
|
||||
echo "✓ orchestrator standalone compiles successfully"
|
||||
echo "Packing orchestrator as tarball..."
|
||||
npm pack
|
||||
|
||||
- name: Run orchestrator standalone tests
|
||||
working-directory: orchestrator-standalone
|
||||
run: |
|
||||
echo "Running orchestrator standalone tests..."
|
||||
npx jest --no-cache 2>&1 | tail -10
|
||||
|
||||
- name: Verify orchestrator standalone compiles
|
||||
working-directory: orchestrator-standalone
|
||||
- name: Verify plugin loader returns exports with orchestrator installed
|
||||
run: |
|
||||
echo "Verifying orchestrator standalone compiles..."
|
||||
npx tsc --noEmit
|
||||
echo "✓ orchestrator standalone compiles successfully"
|
||||
echo "Installing orchestrator into unity-builder workspace..."
|
||||
npm install ./orchestrator-standalone/game-ci-orchestrator-*.tgz --no-save
|
||||
echo "Checking plugin loader returns defined exports..."
|
||||
node -e "
|
||||
const { loadOrchestrator, loadEnterpriseServices } = require('./lib/model/orchestrator-plugin');
|
||||
(async () => {
|
||||
const orch = await loadOrchestrator();
|
||||
if (orch === undefined) {
|
||||
console.error('ERROR: loadOrchestrator should return defined exports when package is installed');
|
||||
process.exit(1);
|
||||
}
|
||||
if (typeof orch.run !== 'function') {
|
||||
console.error('ERROR: loadOrchestrator().run should be a function');
|
||||
process.exit(1);
|
||||
}
|
||||
console.log('✓ loadOrchestrator() returns defined exports with orchestrator installed');
|
||||
|
||||
const services = await loadEnterpriseServices();
|
||||
if (services === undefined) {
|
||||
console.error('ERROR: loadEnterpriseServices should return defined exports when package is installed');
|
||||
process.exit(1);
|
||||
}
|
||||
console.log('✓ loadEnterpriseServices() returns defined exports with orchestrator installed');
|
||||
})();
|
||||
"
|
||||
|
||||
Reference in New Issue
Block a user