mirror of
https://github.com/glittercowboy/get-shit-done
synced 2026-04-25 17:25:23 +02:00
* ci: explicit rebase check + fail-fast SDK typecheck in install-smoke Stale-base regression guard. Root cause: GitHub's `refs/pull/N/merge` is cached against the PR's recorded merge-base, not current main. When main advances after a PR is opened, the cache stays stale and CI runs against the pre-advance tree. PRs hit this whenever a type error lands on main and gets patched shortly after (e.g. #2611 + #2622) — stale branches replay the broken intermediate state and report confusing downstream failures for hours. Observed failure mode: install-smoke's "Assert gsd-sdk resolves on PATH" step fires with "installSdkIfNeeded() regression" even when the real cause is `npm run build` failing in sdk/ due to a TypeScript cast mismatch already fixed on main. Fix: - Explicit `git merge origin/main` step in both `install-smoke.yml` and `test.yml`. If the merge conflicts, emit a clear "rebase onto main" diagnostic and fail early, rather than let conflicts produce unrelated downstream errors. - Dedicated `npm run build:sdk` typecheck step in install-smoke with a remediation hint ("rebase onto main — the error may already be fixed on trunk"). Fails fast with the actual tsc output instead of masking it behind a PATH assertion. - Drop the `|| true` on `get-shit-done-cc --claude --local` so installer failures surface at the install step with install.js's own error message, not at the downstream PATH assertion where the message misleadingly blames "shim regression". - `fetch-depth: 0` on checkout so the merge-base check has history. * ci: address CodeRabbit — add rebase check to smoke-unpacked, fix fetch flag Two findings from CodeRabbit's review on #2631: 1. `smoke-unpacked` job was missing the same rebase check applied to the `smoke` job. It ran on the cached `refs/pull/N/merge` and could hit the same stale-base failure mode the PR was designed to prevent. Added the identical rebase-check step. 2. `git fetch origin main --depth=0` is an invalid flag — git rejects it with "depth 0 is not a positive number". The intent was "fetch with full depth", but the right way is just `git fetch origin main` (no --depth). Removed the invalid flag and the `||` fallback that was papering over the error.
79 lines
2.6 KiB
YAML
79 lines
2.6 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- 'release/**'
|
|
- 'hotfix/**'
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ${{ matrix.os }}
|
|
timeout-minutes: 10
|
|
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
os: [ubuntu-latest]
|
|
node-version: [22, 24]
|
|
include:
|
|
# Single macOS runner — verifies platform compatibility on the standard version
|
|
- os: macos-latest
|
|
node-version: 24
|
|
# Windows path/separator coverage is handled by hardcoded-paths.test.cjs
|
|
# and windows-robustness.test.cjs (static analysis, runs on all platforms).
|
|
# A dedicated windows-compat workflow runs on a weekly schedule.
|
|
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
# Fetch full history so we can merge origin/main for stale-base detection.
|
|
fetch-depth: 0
|
|
|
|
# GitHub's `refs/pull/N/merge` is cached against the recorded merge-base.
|
|
# When main advances after a PR is opened, the cache stays stale and CI
|
|
# runs against the pre-advance state — hiding bugs that are already fixed
|
|
# on trunk and surfacing type errors that were introduced and then patched
|
|
# on main in between. Explicitly merge current origin/main here so tests
|
|
# always run against the latest trunk.
|
|
- name: Rebase check — merge origin/main into PR head
|
|
if: github.event_name == 'pull_request'
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
git config user.email "ci@gsd-build"
|
|
git config user.name "CI Rebase Check"
|
|
git fetch origin main
|
|
if ! git merge --no-edit --no-ff origin/main; then
|
|
echo "::error::This PR cannot cleanly merge origin/main. Rebase your branch onto current main and push again."
|
|
echo "::error::Conflicting files:"
|
|
git diff --name-only --diff-filter=U
|
|
git merge --abort
|
|
exit 1
|
|
fi
|
|
|
|
- name: Set up Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: 'npm'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Build SDK dist (required by installer)
|
|
run: npm run build:sdk
|
|
|
|
- name: Run tests with coverage
|
|
shell: bash
|
|
run: npm run test:coverage
|