test: stub gh in GitService tests so CI does not time out (#17) #72
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm run build | |
| - name: Smoke test CLI bundle | |
| run: pnpm -C apps/kimi-code run smoke | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shard: [1, 2, 3, 4, 5] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm run test --shard=${{ matrix.shard }}/5 | |
| # pi-tui's suite runs on node:test (not vitest), so the root `pnpm run test` | |
| # does not execute it; it needs its own job. | |
| test-pi-tui: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm --filter @moonshot-ai/pi-tui test | |
| # The VS Code extension suite runs on the default (v2) engine as part of the | |
| # sharded root run above; this job reruns it on the legacy v1 engine, which | |
| # the extension selects through the rollback env var. | |
| test-vscode-legacy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm --filter kimi-code test | |
| env: | |
| KIMI_CODE_LEGACY_FLAG: "1" | |
| test-windows: | |
| runs-on: windows-latest | |
| # Temporarily disabled while Windows tests are being stabilized. | |
| if: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| # Windows runners are slower and run the whole suite (including | |
| # in-process e2e tests) under more contention, so the default 5s test | |
| # timeout causes flaky failures. Give it more headroom. | |
| - run: pnpm run test -- --testTimeout=30000 | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm run lint | |
| - run: pnpm run sherif | |
| typecheck: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - name: Typecheck | |
| run: | | |
| pnpm dlx --package @typescript/native-preview@beta tsgo --version | |
| for config in packages/*/tsconfig.json apps/kimi-code/tsconfig.json; do | |
| echo "Typechecking ${config}" | |
| pnpm dlx --package @typescript/native-preview@beta tsgo -p "${config}" --noEmit | |
| done | |
| - name: Typecheck VS Code extension | |
| run: pnpm --filter kimi-code run typecheck | |
| - name: Typecheck vis-server | |
| run: pnpm --filter @moonshot-ai/vis-server run typecheck | |
| - name: Typecheck vis-web | |
| run: pnpm --filter @moonshot-ai/vis-web run typecheck | |
| # Aggregate gate that carries the branch-protection required check "CI". | |
| # GitHub names the workflow-level check after the workflow, but the PR merge | |
| # machinery matches required contexts against job names here, so an explicit | |
| # job named CI is needed for the required check to be satisfiable. | |
| CI: | |
| runs-on: ubuntu-latest | |
| needs: [build, test, test-pi-tui, lint, typecheck] | |
| if: always() | |
| steps: | |
| - name: Aggregate CI result | |
| run: | | |
| if [ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" = "true" ]; then | |
| echo "One or more CI jobs failed" && exit 1 | |
| fi | |
| echo "All CI jobs passed" |