DEPLOY-003 recommended Build Performance

Build performance optimized

Caching and parallelization keep builds fast

Question to ask

"How long do your engineers wait for a build to finish?"

What to check

  • Dependency caching configured
  • Cache keys include lockfile hash
  • Build times under 10 minutes typical
  • Docker layer caching (if applicable)
  • Parallelization used where beneficial

Verification guide

Severity: Recommended

Check automatically:

  1. Check for caching in workflows:

    # Look for cache action usage
    grep -riE "actions/cache|cache:|restore-keys" .github/workflows/*.yml 2>/dev/null
    
  2. Check for dependency caching:

    # Node/pnpm cache patterns
    grep -A10 "actions/cache\|pnpm/action-setup\|actions/setup-node" .github/workflows/*.yml 2>/dev/null | grep -iE "cache|pnpm-store|node_modules|\.npm"
    
  3. Check for Docker layer caching:

    # Docker buildx cache
    grep -riE "cache-from|cache-to|buildx.*cache|docker/build-push-action" .github/workflows/*.yml 2>/dev/null
    
  4. Measure actual build times:

    # Get recent workflow run durations (deployment workflows)
    gh run list --limit 20 --json workflowName,createdAt,updatedAt --jq '[.[] | select(.workflowName | test("deploy|release|build"; "i"))] | .[] | {name: .workflowName, duration_minutes: ((((.updatedAt | fromdateiso8601) - (.createdAt | fromdateiso8601)) / 60) | floor)}'
    
  5. Check for parallelization:

    # Look for matrix builds or parallel jobs
    grep -riE "matrix:|needs:|concurrency:" .github/workflows/*.yml 2>/dev/null
    
  6. Check cache key includes lockfile:

    # Cache keys should include lockfile hash for correctness
    grep -A5 "actions/cache" .github/workflows/*.yml 2>/dev/null | grep -E "key:.*lock|key:.*hashFiles"
    

Cross-reference with:

  • DEPLOY-001 (Workflow stability)
  • Section 28 (Code Architecture - build times)

Pass criteria:

  • Dependency caching configured (node_modules, pnpm store, pip, etc.)
  • Build times reasonable (under 5 min typical, under 10 min for complex builds)
  • Cache keys include lockfile hash (prevents stale cache)
  • Docker layer caching (if using Docker builds)
  • Parallelization used where beneficial

Fail criteria:

  • No caching configured (cold builds every time)
  • Build times consistently >15 minutes
  • Cache keys don't include lockfile hash (stale cache risk)
  • Obvious parallelization opportunities missed

If builds slow, ask user: "Build times averaging over 10 minutes. Is this acceptable for your workflow? Long builds slow down iteration and developer feedback loops. Consider adding caching or parallelization."

Evidence to capture:

  • Caching configured (yes/no, what type)
  • Average build duration (minutes)
  • Cache key pattern (includes lockfile hash?)
  • Parallelization used (matrix, parallel jobs)
  • Docker caching (if applicable)

Section

10. Deployments

Deployment & Operations