ci: optimize build workflows and caching

This commit is contained in:
Jeremy 2026-04-14 11:16:47 -05:00
parent 2e53b3cbad
commit b03c9401c4
11 changed files with 109 additions and 15 deletions

View file

@ -108,6 +108,7 @@ jobs:
with: with:
node-version: "24" node-version: "24"
registry-url: "https://registry.npmjs.org" registry-url: "https://registry.npmjs.org"
cache: "npm"
- name: Download all artifacts - name: Download all artifacts
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
@ -199,6 +200,16 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
- name: Cache TypeScript incremental state
uses: useblacksmith/cache@v5
with:
path: |
*.tsbuildinfo
packages/*/*.tsbuildinfo
key: tsbuild-${{ runner.os }}-${{ hashFiles('package-lock.json', 'tsconfig*.json', 'packages/*/tsconfig.json') }}
restore-keys: |
tsbuild-${{ runner.os }}-
- name: Build - name: Build
run: npm run build run: npm run build

View file

@ -29,6 +29,7 @@ jobs:
runs-on: blacksmith-4vcpu-ubuntu-2404 runs-on: blacksmith-4vcpu-ubuntu-2404
outputs: outputs:
docs-only: ${{ steps.check.outputs.docs-only }} docs-only: ${{ steps.check.outputs.docs-only }}
portability-changed: ${{ steps.check.outputs.portability-changed }}
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
with: with:
@ -59,6 +60,15 @@ jobs:
echo "Non-docs files changed:" echo "Non-docs files changed:"
echo "$NON_DOCS" echo "$NON_DOCS"
fi fi
PORTABILITY=$(echo "$NON_DOCS" | grep -E '^(src/|packages/|native/|scripts/|web/|package\.json$|package-lock\.json$|web/package-lock\.json$|tsconfig[^/]*\.json$|packages/.*/tsconfig\.json$)' || true)
if [ -n "$PORTABILITY" ]; then
echo "portability-changed=true" >> "$GITHUB_OUTPUT"
echo "Portability-relevant files changed:"
echo "$PORTABILITY"
else
echo "portability-changed=false" >> "$GITHUB_OUTPUT"
echo "::notice::No portability-relevant changes detected — skipping portability matrix jobs"
fi
docs-check: docs-check:
timeout-minutes: 5 timeout-minutes: 5
@ -139,8 +149,18 @@ jobs:
nextjs-${{ runner.os }}-${{ hashFiles('web/package-lock.json') }}- nextjs-${{ runner.os }}-${{ hashFiles('web/package-lock.json') }}-
nextjs-${{ runner.os }}- nextjs-${{ runner.os }}-
- name: Build - name: Cache TypeScript incremental state
run: npm run build uses: useblacksmith/cache@v5
with:
path: |
*.tsbuildinfo
packages/*/*.tsbuildinfo
key: tsbuild-${{ runner.os }}-${{ hashFiles('package-lock.json', 'tsconfig*.json', 'packages/*/tsconfig.json') }}
restore-keys: |
tsbuild-${{ runner.os }}-
- name: Build core
run: npm run build:core
- name: Build web host - name: Build web host
run: npm run build:web-host run: npm run build:web-host
@ -179,16 +199,35 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
# Integration tests need the same compiled artifacts as the build job: # Integration tests need core compiled artifacts:
# - dist/loader.js and packages/pi-coding-agent/dist/** from `npm run build` # - dist/loader.js and packages/pi-coding-agent/dist/** from `npm run build:core`
# - web/node_modules/.bin/next for tests that shell `build:web-host` at runtime # - web/node_modules/.bin/next for tests that shell `build:web-host` at runtime
# Duplicating the build here (instead of sharing artifacts via needs: build) # Duplicating the core build here (instead of sharing artifacts via needs: build)
# preserves wall-clock parallelism with the build job — see PR #4093. # preserves wall-clock parallelism with the build job — see PR #4093.
- name: Install web host dependencies - name: Install web host dependencies
run: npm --prefix web ci run: npm --prefix web ci
- name: Build - name: Cache Next.js build
run: npm run build uses: useblacksmith/cache@v5
with:
path: web/.next/cache
key: nextjs-${{ runner.os }}-${{ hashFiles('web/package-lock.json') }}-${{ hashFiles('web/app/**', 'web/components/**', 'web/lib/**', 'web/hooks/**') }}
restore-keys: |
nextjs-${{ runner.os }}-${{ hashFiles('web/package-lock.json') }}-
nextjs-${{ runner.os }}-
- name: Cache TypeScript incremental state
uses: useblacksmith/cache@v5
with:
path: |
*.tsbuildinfo
packages/*/*.tsbuildinfo
key: tsbuild-${{ runner.os }}-${{ hashFiles('package-lock.json', 'tsconfig*.json', 'packages/*/tsconfig.json') }}
restore-keys: |
tsbuild-${{ runner.os }}-
- name: Build core
run: npm run build:core
- name: Run integration tests - name: Run integration tests
run: npm run test:integration run: npm run test:integration
@ -197,7 +236,8 @@ jobs:
timeout-minutes: 25 timeout-minutes: 25
needs: detect-changes needs: detect-changes
if: >- if: >-
needs.detect-changes.outputs.docs-only != 'true' needs.detect-changes.outputs.docs-only != 'true' &&
needs.detect-changes.outputs.portability-changed == 'true'
runs-on: blacksmith-4vcpu-windows-2025 runs-on: blacksmith-4vcpu-windows-2025
steps: steps:
@ -213,8 +253,18 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
- name: Build - name: Cache TypeScript incremental state
run: npm run build uses: useblacksmith/cache@v5
with:
path: |
*.tsbuildinfo
packages/*/*.tsbuildinfo
key: tsbuild-${{ runner.os }}-${{ hashFiles('package-lock.json', 'tsconfig*.json', 'packages/*/tsconfig.json') }}
restore-keys: |
tsbuild-${{ runner.os }}-
- name: Build core
run: npm run build:core
- name: Typecheck extensions - name: Typecheck extensions
run: npm run typecheck:extensions run: npm run typecheck:extensions
@ -233,7 +283,9 @@ jobs:
rtk-portability: rtk-portability:
timeout-minutes: 20 timeout-minutes: 20
needs: detect-changes needs: detect-changes
if: needs.detect-changes.outputs.docs-only != 'true' if: >-
needs.detect-changes.outputs.docs-only != 'true' &&
needs.detect-changes.outputs.portability-changed == 'true'
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:

View file

@ -54,8 +54,21 @@ jobs:
nextjs-${{ runner.os }}-${{ hashFiles('web/package-lock.json') }}- nextjs-${{ runner.os }}-${{ hashFiles('web/package-lock.json') }}-
nextjs-${{ runner.os }}- nextjs-${{ runner.os }}-
- name: Build - name: Cache TypeScript incremental state
run: npm run build uses: useblacksmith/cache@v5
with:
path: |
*.tsbuildinfo
packages/*/*.tsbuildinfo
key: tsbuild-${{ runner.os }}-${{ hashFiles('package-lock.json', 'tsconfig*.json', 'packages/*/tsconfig.json') }}
restore-keys: |
tsbuild-${{ runner.os }}-
- name: Build core
run: npm run build:core
- name: Build web host
run: npm run build:web-host
- name: Stamp dev version and sync platform packages - name: Stamp dev version and sync platform packages
id: stamp id: stamp
@ -175,6 +188,16 @@ jobs:
nextjs-${{ runner.os }}-${{ hashFiles('web/package-lock.json') }}- nextjs-${{ runner.os }}-${{ hashFiles('web/package-lock.json') }}-
nextjs-${{ runner.os }}- nextjs-${{ runner.os }}-
- name: Cache TypeScript incremental state
uses: useblacksmith/cache@v5
with:
path: |
*.tsbuildinfo
packages/*/*.tsbuildinfo
key: tsbuild-${{ runner.os }}-${{ hashFiles('package-lock.json', 'tsconfig*.json', 'packages/*/tsconfig.json') }}
restore-keys: |
tsbuild-${{ runner.os }}-
- name: Run live LLM tests (optional) - name: Run live LLM tests (optional)
continue-on-error: true continue-on-error: true
run: npm run test:live || echo "::warning::Live LLM tests failed — non-blocking, but worth investigating" run: npm run test:live || echo "::warning::Live LLM tests failed — non-blocking, but worth investigating"

View file

@ -1,6 +1,6 @@
{ {
"name": "gsd-pi", "name": "gsd-pi",
"version": "2.74.0", "version": "2.73.1",
"description": "GSD — Get Shit Done coding agent", "description": "GSD — Get Shit Done coding agent",
"license": "MIT", "license": "MIT",
"repository": { "repository": {
@ -49,7 +49,8 @@
"build:rpc-client": "npm run build -w @gsd-build/rpc-client", "build:rpc-client": "npm run build -w @gsd-build/rpc-client",
"build:pi": "npm run build:native-pkg && npm run build:pi-tui && npm run build:pi-ai && npm run build:pi-agent-core && npm run build:pi-coding-agent", "build:pi": "npm run build:native-pkg && npm run build:pi-tui && npm run build:pi-ai && npm run build:pi-agent-core && npm run build:pi-coding-agent",
"build:mcp-server": "npm run build -w @gsd-build/mcp-server", "build:mcp-server": "npm run build -w @gsd-build/mcp-server",
"build": "npm run build:pi && npm run build:rpc-client && npm run build:mcp-server && tsc && npm run copy-resources && npm run copy-themes && npm run copy-export-html && node scripts/build-web-if-stale.cjs", "build:core": "npm run build:pi && npm run build:rpc-client && npm run build:mcp-server && tsc && npm run copy-resources && npm run copy-themes && npm run copy-export-html",
"build": "npm run build:core && node scripts/build-web-if-stale.cjs",
"stage:web-host": "node scripts/stage-web-standalone.cjs", "stage:web-host": "node scripts/stage-web-standalone.cjs",
"build:web-host": "npm --prefix web run build && npm run stage:web-host", "build:web-host": "npm --prefix web run build && npm run stage:web-host",
"copy-resources": "node scripts/copy-resources.cjs", "copy-resources": "node scripts/copy-resources.cjs",

View file

@ -6,6 +6,7 @@
"strict": true, "strict": true,
"esModuleInterop": true, "esModuleInterop": true,
"skipLibCheck": true, "skipLibCheck": true,
"incremental": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": true,

View file

@ -6,6 +6,7 @@
"strict": true, "strict": true,
"esModuleInterop": true, "esModuleInterop": true,
"skipLibCheck": true, "skipLibCheck": true,
"incremental": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": true,

View file

@ -6,6 +6,7 @@
"strict": true, "strict": true,
"esModuleInterop": true, "esModuleInterop": true,
"skipLibCheck": true, "skipLibCheck": true,
"incremental": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": true,

View file

@ -6,6 +6,7 @@
"strict": true, "strict": true,
"esModuleInterop": true, "esModuleInterop": true,
"skipLibCheck": true, "skipLibCheck": true,
"incremental": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": true,

View file

@ -6,6 +6,7 @@
"strict": true, "strict": true,
"esModuleInterop": true, "esModuleInterop": true,
"skipLibCheck": true, "skipLibCheck": true,
"incremental": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": true,

View file

@ -6,6 +6,7 @@
"strict": true, "strict": true,
"esModuleInterop": true, "esModuleInterop": true,
"skipLibCheck": true, "skipLibCheck": true,
"incremental": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": true,

View file

@ -7,6 +7,7 @@
"rootDir": "src", "rootDir": "src",
"strict": true, "strict": true,
"declaration": true, "declaration": true,
"incremental": true,
"esModuleInterop": true, "esModuleInterop": true,
"skipLibCheck": true "skipLibCheck": true
}, },