spawn/.github/workflows/test.yml
A 262d081756
refactor: move fly TS into cli/src/fly/, add build-clouds.sh (#1604)
Move all fly TypeScript files from fly/lib/*.ts and fly/main.ts into
cli/src/fly/. This gives them access to cli/node_modules (@clack/prompts),
biome linting, and the existing bun:test infrastructure — no symlinks or
NODE_PATH hacks needed.

The org picker now uses @clack/prompts select() directly (static import,
bundled at build time).

New: cli/build-clouds.sh — auto-discovers cli/src/*/main.ts and bundles
each into {cloud}.js. Scalable to future cloud TS migrations:
  bash cli/build-clouds.sh        # build all
  bash cli/build-clouds.sh fly    # build one

Shims now check for cli/src/fly/main.ts (local) or download fly.js from
GitHub releases (remote curl|bash).

Co-authored-by: lab <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-21 12:34:09 -08:00

81 lines
2.2 KiB
YAML

name: Test
on:
pull_request:
branches: [main]
concurrency:
group: test-${{ github.head_ref }}
cancel-in-progress: true
jobs:
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
working-directory: cli
run: bun install
- name: Run bun tests
run: bun test
- name: Verify cloud bundles build
run: bun run cli/build-clouds.ts
mock-tests:
name: Mock Tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
working-directory: cli
run: bun install
- name: Run mock tests
id: tests
env:
NO_COLOR: 1
run: |
set +e
bash test/mock.sh 2>&1 | tee /tmp/mock-output.log
echo "exit_code=${PIPESTATUS[0]}" >> "$GITHUB_OUTPUT"
- name: Post summary
if: always()
run: |
echo '## Mock Test Results' >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
grep -E 'Results:' /tmp/mock-output.log >> "$GITHUB_STEP_SUMMARY" || true
echo '```' >> "$GITHUB_STEP_SUMMARY"
FAILURES=$(grep '✗' /tmp/mock-output.log | head -50)
if [[ -n "$FAILURES" ]]; then
echo '' >> "$GITHUB_STEP_SUMMARY"
echo '<details><summary>Failures (first 50)</summary>' >> "$GITHUB_STEP_SUMMARY"
echo '' >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
printf '%s\n' "$FAILURES" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
echo '</details>' >> "$GITHUB_STEP_SUMMARY"
fi
- name: Check results
if: always()
run: |
if [[ "${{ steps.tests.outputs.exit_code }}" != "0" ]]; then
echo "Mock tests failed (exit code ${{ steps.tests.outputs.exit_code }})"
exit 1
fi