Skip to content

ci(build): track build performance with Next.js cache + metrics#7

Merged
factory-sam merged 3 commits into
mainfrom
feat/build-performance-tracking
Jun 15, 2026
Merged

ci(build): track build performance with Next.js cache + metrics#7
factory-sam merged 3 commits into
mainfrom
feat/build-performance-tracking

Conversation

@factory-sam

Copy link
Copy Markdown
Owner

Summary

Adds deliberate build performance tracking to CI, which previously never built the app and had no build caching or timing.

Changes

  • .github/workflows/code-quality.yml - new build job that:
    • Restores the Next.js incremental build cache (.next/cache) via actions/cache, keyed on the lockfile + source hash with a restore-keys fallback, so rebuilds reuse compiler work instead of always building cold.
    • Runs pnpm build:metrics with public, non-secret placeholder Supabase env (deterministic build, no secret dependency).
    • Uploads reports/build-metrics.json as a build-metrics artifact and passes the cache-hit through to the script.
  • scripts/build-metrics.mjs (new) - times the production build (wall-clock), writes a machine-readable report (duration, cache-hit, Next/Node versions, commit, timestamp), appends a summary to the GitHub job page, and forwards the build exit code.
  • package.json - adds the build:metrics script.
  • AGENTS.md - documents the command and the CI build-performance practice.

Why

Satisfies the agent-readiness build_performance_tracking signal with real value: CI now actually builds the app (catching build breakage), uses incremental build caching, and tracks/exports build duration so regressions are visible over time.

Verified locally: pnpm build:metrics builds successfully and emits valid metrics JSON; pnpm lint and pnpm validate-docs pass.

factory-sam and others added 2 commits June 15, 2026 13:34
Add a CI build job that restores the Next.js incremental cache (.next/cache)
keyed on lockfile + source hash, then runs pnpm build:metrics. The new
scripts/build-metrics.mjs times the production build, writes
reports/build-metrics.json, appends a job summary, and uploads it as an
artifact so build-duration regressions are visible across runs.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown

Droid finished @factory-sam's task —— View job


Security Review

Good addition overall: CI now builds with incremental caching and exports build timing as an artifact. Two follow-ups: handle spawn() failures in build-metrics, and align AGENTS.md with the actual JSON field name.

Comment thread scripts/build-metrics.mjs
Comment thread AGENTS.md Outdated
Address code-review findings on PR #7:
- Add a child 'error' handler (with a settle guard) so a failed pnpm spawn
  still resolves and forwards a non-zero exit code instead of crashing.
- AGENTS.md referenced a 'cache-hit' field; the report writes cacheRestored.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown

Droid finished @factory-sam's task —— View job


Security Review

LGTM, the CI build-performance tracking changes look correct and I did not find any high-confidence actionable issues.

@factory-sam factory-sam merged commit 535ebbc into main Jun 15, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant