Files
skillkit/.github/workflows/ci.yml
Rohit Ghumare e35cd0d0df test: add comprehensive E2E test suite for CLI commands (#7)
* test: add comprehensive E2E test suite for CLI commands

- Add 183 E2E tests covering all major CLI commands
- Core commands: init, list, read, validate, enable, disable, sync
- Translation: all 17 agents, context detection, recommendations
- Team collaboration: init, share, sync, bundle operations
- Methodology & Plan: 5 methodology packs, plan CRUD operations
- Hooks & Orchestration: event triggers, multi-agent coordination
- Plugin system: install, uninstall, enable, disable, marketplace
- Commands & Settings: slash commands, memory, audit, CI/CD

CI/CD updates:
- Add dedicated E2E job running on Node 22 after unit tests
- Upload artifacts on E2E test failures for debugging
- Add ci-success job for branch protection

New npm scripts:
- pnpm test:e2e - Run E2E tests
- pnpm test:e2e:watch - Run E2E tests in watch mode
- pnpm test:all - Run unit + E2E tests

* fix: improve E2E test reliability and align with actual CLI interface

- Fix ESM compatibility: use import.meta.url for __dirname equivalent
- Fix security: use execFileSync instead of execSync to prevent shell injection
- Fix skillCount: use nullish coalescing (??) to respect explicit 0
- Fix weak assertions: replace always-true checks (exitCode !== undefined)
  with meaningful assertions (exitCode <= 1, hasRelevantOutput)
- Fix CLI alignment: update tests to use actual command actions
  - methodology: load -> install, apply -> sync, validate -> info
  - plan: list -> templates, status -> generate
  - team init: add required --registry parameter

All 180 E2E tests now pass.

* fix: add .agent/skills directory check and timeout guards

- Add .agent/skills to directory checks in init tests (fixes CI failure)
- Add explicit timeout guards (exitCode !== -1) before exitCode <= 1 checks
  to fail fast on runCli timeouts instead of false positives
2026-01-24 21:26:54 +00:00

91 lines
1.9 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
# Unit tests run on all Node versions
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20, 22]
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Type check
run: pnpm typecheck
- name: Build
run: pnpm build
- name: Unit Tests
run: pnpm test
# E2E tests run on latest Node only (to save CI time)
e2e:
runs-on: ubuntu-latest
needs: test # Run after unit tests pass
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm build
- name: E2E Tests
run: pnpm test:e2e
- name: Upload E2E Test Results
if: failure()
uses: actions/upload-artifact@v4
with:
name: e2e-test-results
path: |
e2e/**/*.log
/tmp/skillkit-e2e-*
retention-days: 7
# Final status check for branch protection
ci-success:
runs-on: ubuntu-latest
needs: [test, e2e]
if: always()
steps:
- name: Check all jobs passed
run: |
if [[ "${{ needs.test.result }}" != "success" ]] || [[ "${{ needs.e2e.result }}" != "success" ]]; then
echo "One or more jobs failed"
exit 1
fi
echo "All CI checks passed!"