mirror of
https://github.com/BradGroux/veritas-kanban.git
synced 2026-12-04 11:47:19 +00:00
236 lines
7.2 KiB
YAML
236 lines
7.2 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
types: [opened, synchronize, reopened, labeled, unlabeled]
|
|
schedule:
|
|
- cron: '0 8 * * *'
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
NODE_VERSION: '22'
|
|
|
|
jobs:
|
|
# ─── Lint & Type Check ───────────────────────────────────────────
|
|
lint-and-typecheck:
|
|
name: Lint & Type Check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- uses: pnpm/action-setup@v6
|
|
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: pnpm
|
|
|
|
- name: Check pnpm settings location
|
|
run: node scripts/check-pnpm-settings.mjs
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build shared (dependency for typecheck)
|
|
run: pnpm --filter @veritas-kanban/shared build
|
|
|
|
- name: Lint
|
|
run: pnpm lint
|
|
|
|
- name: Enforce lint warning budget
|
|
run: pnpm lint:budget
|
|
|
|
- name: Check permission coverage
|
|
run: node scripts/check-permission-coverage.mjs
|
|
|
|
- name: Type check all packages
|
|
run: pnpm typecheck
|
|
|
|
# ─── Changed PR Tests ────────────────────────────────────────────
|
|
test-changed:
|
|
name: Changed Tests
|
|
if: github.event_name == 'pull_request'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- uses: pnpm/action-setup@v6
|
|
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: pnpm
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build shared test dependency
|
|
run: pnpm --filter @veritas-kanban/shared build
|
|
|
|
- name: Run changed workspace tests
|
|
env:
|
|
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
|
run: |
|
|
selected_count=0
|
|
for package_name in server web cli mcp; do
|
|
package_tests=()
|
|
while IFS= read -r test_file; do
|
|
package_tests+=("${test_file#"$package_name/"}")
|
|
done < <(
|
|
git diff --name-only --diff-filter=ACMR "$BASE_SHA...HEAD" |
|
|
grep -E "^${package_name}/.*\\.(test|spec)\\.[cm]?[jt]sx?$" || true
|
|
)
|
|
if (( ${#package_tests[@]} > 0 )); then
|
|
for test_file in "${package_tests[@]}"; do
|
|
pnpm --filter "@veritas-kanban/${package_name}" exec vitest run \
|
|
--passWithNoTests \
|
|
"$test_file"
|
|
selected_count=$((selected_count + 1))
|
|
done
|
|
fi
|
|
done
|
|
if (( selected_count == 0 )); then
|
|
echo "No changed server, web, CLI, or MCP test files."
|
|
fi
|
|
|
|
- name: Run changed desktop tests
|
|
env:
|
|
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
|
run: |
|
|
desktop_tests=()
|
|
while IFS= read -r test_file; do
|
|
desktop_tests+=("$test_file")
|
|
done < <(
|
|
git diff --name-only --diff-filter=ACMR "$BASE_SHA...HEAD" |
|
|
grep -E '^desktop/.*\.(test|spec)\.[cm]?[jt]sx?$' |
|
|
sed 's#^desktop/##' || true
|
|
)
|
|
if (( ${#desktop_tests[@]} == 0 )); then
|
|
echo "No changed desktop test files."
|
|
else
|
|
for test_file in "${desktop_tests[@]}"; do
|
|
pnpm --filter @veritas-kanban/desktop exec vitest run \
|
|
--config vitest.config.ts \
|
|
--passWithNoTests \
|
|
"$test_file"
|
|
done
|
|
fi
|
|
|
|
# ─── Full Workspace Unit Tests ───────────────────────────────────
|
|
test-workspace:
|
|
name: Workspace Unit Tests
|
|
if: >-
|
|
github.event_name != 'pull_request' ||
|
|
contains(github.event.pull_request.labels.*.name, 'ci:full')
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- uses: pnpm/action-setup@v6
|
|
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: pnpm
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build shared (dependency for workspace tests)
|
|
run: pnpm --filter @veritas-kanban/shared build
|
|
|
|
- name: Run workspace unit tests
|
|
run: pnpm test:unit
|
|
|
|
- name: Run desktop readiness regression tests
|
|
run: pnpm desktop:test:readiness
|
|
|
|
- name: Run dual-storage parity tests
|
|
run: pnpm --filter @veritas-kanban/server test -- src/__tests__/storage/dual-storage-parity.test.ts
|
|
|
|
# ─── Build ───────────────────────────────────────────────────────
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- uses: pnpm/action-setup@v6
|
|
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: pnpm
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build shared (dependency for all builds)
|
|
run: pnpm --filter @veritas-kanban/shared build
|
|
|
|
- name: Build all packages
|
|
run: pnpm build
|
|
|
|
- name: Verify web build output
|
|
run: |
|
|
if [ ! -d "web/dist" ]; then
|
|
echo "::error::Web build output (web/dist) not found"
|
|
exit 1
|
|
fi
|
|
echo "✅ Web build output exists"
|
|
ls -la web/dist/
|
|
|
|
- name: Verify server build output
|
|
run: |
|
|
if [ ! -d "server/dist" ]; then
|
|
echo "::error::Server build output (server/dist) not found"
|
|
exit 1
|
|
fi
|
|
echo "✅ Server build output exists"
|
|
ls -la server/dist/
|
|
|
|
- name: Verify CLI and MCP build output
|
|
run: |
|
|
for file in cli/dist/index.js mcp/dist/index.js; do
|
|
if [ ! -f "$file" ]; then
|
|
echo "::error::$file not found"
|
|
exit 1
|
|
fi
|
|
done
|
|
echo "✅ CLI and MCP build outputs exist"
|
|
|
|
# ─── Security Audit ──────────────────────────────────────────────
|
|
security-audit:
|
|
name: Security Audit
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- uses: pnpm/action-setup@v6
|
|
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: pnpm
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Reject tracked runtime security configuration
|
|
run: pnpm check:security-artifacts
|
|
|
|
- name: Audit production dependencies (blocks on high/critical)
|
|
run: pnpm audit --prod --audit-level=high
|
|
|
|
- name: Audit all dependencies (informational)
|
|
run: pnpm audit
|
|
continue-on-error: true
|