singularity-forge/.github/workflows/ci.yml
TÂCHES 968815cd22 ci: add timeout-minutes to all CI jobs (#2148)
A hung unit test on PR #2120 ran for 3+ hours before manual cancellation,
burning ~185 minutes of Actions quota. Add timeouts to cap runaway jobs:
detect-changes (2m), docs-check/lint (5m), build/windows (15m).

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 09:52:13 -06:00

169 lines
4.3 KiB
YAML

name: CI
on:
push:
branches: [main]
paths-ignore:
- '.github/workflows/ai-triage.yml'
- '.github/workflows/build-native.yml'
- '.github/workflows/cleanup-dev-versions.yml'
- '.github/workflows/pipeline.yml'
- 'LICENSE'
pull_request:
branches: [main]
paths-ignore:
- '.github/workflows/ai-triage.yml'
- '.github/workflows/build-native.yml'
- '.github/workflows/cleanup-dev-versions.yml'
- '.github/workflows/pipeline.yml'
- 'LICENSE'
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
detect-changes:
timeout-minutes: 2
runs-on: ubuntu-latest
outputs:
docs-only: ${{ steps.check.outputs.docs-only }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check if only documentation changed
id: check
env:
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
PUSH_BEFORE_SHA: ${{ github.event.before }}
EVENT_NAME: ${{ github.event_name }}
HEAD_SHA: ${{ github.sha }}
run: |
if [ "$EVENT_NAME" = "pull_request" ]; then
BASE="$PR_BASE_SHA"
else
BASE="$PUSH_BEFORE_SHA"
fi
FILES=$(git diff --name-only "$BASE" "$HEAD_SHA" 2>/dev/null || git diff --name-only HEAD~1)
echo "Changed files:"
echo "$FILES"
NON_DOCS=$(echo "$FILES" | grep -vE '\.(md|markdown)$' | grep -vE '^docs/' | grep -vE '^LICENSE$' || true)
if [ -z "$NON_DOCS" ]; then
echo "docs-only=true" >> "$GITHUB_OUTPUT"
echo "::notice::Only documentation files changed — skipping build/test"
else
echo "docs-only=false" >> "$GITHUB_OUTPUT"
echo "Non-docs files changed:"
echo "$NON_DOCS"
fi
docs-check:
timeout-minutes: 5
runs-on: ubuntu-latest
needs: detect-changes
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Scan documentation for prompt injection
run: bash scripts/docs-prompt-injection-scan.sh --diff origin/main
lint:
timeout-minutes: 5
needs: detect-changes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 2
- name: Scan for hardcoded secrets
run: bash scripts/secret-scan.sh --diff origin/main
- name: Ensure .gsd/ is not checked in
run: |
if [ -d ".gsd" ]; then
echo "::error::.gsd/ directory must not be checked in"
exit 1
fi
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
- name: Validate skill references
run: node scripts/check-skill-references.mjs
build:
timeout-minutes: 15
needs: detect-changes
if: needs.detect-changes.outputs.docs-only != 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Install web host dependencies
run: npm --prefix web ci
- name: Build
run: npm run build
- name: Build web host
run: npm run build:web-host
- name: Typecheck extensions
run: npm run typecheck:extensions
- name: Validate package is installable
run: npm run validate-pack
- name: Run unit tests
run: npm run test:unit
- name: Run integration tests
run: npm run test:integration
windows-portability:
timeout-minutes: 15
needs: detect-changes
if: >-
needs.detect-changes.outputs.docs-only != 'true' &&
github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Typecheck extensions
run: npm run typecheck:extensions
- name: Run unit tests
run: npm run test:unit