[object Object]

← back to Cli Printing Press

chore(ci): speed up PR checks via shard split + lighter lint cache (#887)

534c24ad18652c29bce35dacc21065062eade787 · 2026-05-09 23:51:30 -0500 · Giuliano Pezzolo Giacaglia

Two changes targeting the critical path of the PR CI workflow:

A. Split the pipeline-cli test shard into separate pipeline and cli
   shards. internal/cli (~55s local, ~140s CI) and internal/pipeline
   (~30s local, ~75s CI) now run in parallel instead of serialized.
   Drops the slowest shard from ~238s to ~140s on the critical path.

B. Replace setup-go's bundled cache on the lint job with a slimmer
   manual cache for ~/go/pkg/mod only. setup-go's tarball is ~1 GB
   (build + module cache) and takes ~75s to extract; the lint job
   sees little payoff from a warm GOCACHE because golangci-lint has
   its own analyzer cache (~1 MB, already hit cleanly per CI logs).

Together, these should drop wall-clock CI time on a typical Go PR
from ~4:16 to ~2:40, with the new long pole being test (rest) at ~3:30
or generated-test (h3) at ~3:00.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit 534c24ad18652c29bce35dacc21065062eade787
Author: Giuliano Pezzolo Giacaglia <raulzito234@gmail.com>
Date:   Sat May 9 23:51:30 2026 -0500

    chore(ci): speed up PR checks via shard split + lighter lint cache (#887)
    
    Two changes targeting the critical path of the PR CI workflow:
    
    A. Split the pipeline-cli test shard into separate pipeline and cli
       shards. internal/cli (~55s local, ~140s CI) and internal/pipeline
       (~30s local, ~75s CI) now run in parallel instead of serialized.
       Drops the slowest shard from ~238s to ~140s on the critical path.
    
    B. Replace setup-go's bundled cache on the lint job with a slimmer
       manual cache for ~/go/pkg/mod only. setup-go's tarball is ~1 GB
       (build + module cache) and takes ~75s to extract; the lint job
       sees little payoff from a warm GOCACHE because golangci-lint has
       its own analyzer cache (~1 MB, already hit cleanly per CI logs).
    
    Together, these should drop wall-clock CI time on a typical Go PR
    from ~4:16 to ~2:40, with the new long pole being test (rest) at ~3:30
    or generated-test (h3) at ~3:00.
    
    Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---
 .github/workflows/lint.yml | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index f7fa9ec1..f86ce08a 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -49,12 +49,25 @@ jobs:
         run: |
           echo "Skipping golangci-lint: no Go, module, lint config, or lint workflow files changed."
 
+      # setup-go's bundled cache restores both GOMODCACHE and GOCACHE as one
+      # ~1GB tarball; on this repo that adds ~75s of extract time per job.
+      # The lint job sees little payoff from a warm GOCACHE (golangci-lint
+      # has its own 1 MB analyzer cache that's already hit cleanly), so we
+      # skip the bundled cache and restore only the module cache manually.
       - uses: actions/setup-go@v6
         if: steps.changes.outputs.needs_lint == 'true'
         with:
           go-version-file: go.mod
-          cache: true
-          cache-dependency-path: go.sum
+          cache: false
+
+      - name: Cache Go modules
+        if: steps.changes.outputs.needs_lint == 'true'
+        uses: actions/cache@v4
+        with:
+          path: ~/go/pkg/mod
+          key: lint-gomodcache-${{ runner.os }}-${{ hashFiles('go.sum') }}
+          restore-keys: |
+            lint-gomodcache-${{ runner.os }}-
 
       - uses: golangci/golangci-lint-action@v9
         if: steps.changes.outputs.needs_lint == 'true'
@@ -107,7 +120,8 @@ jobs:
       matrix:
         include:
           - shard: generator
-          - shard: pipeline-cli
+          - shard: pipeline
+          - shard: cli
           - shard: rest
     steps:
       - uses: actions/checkout@v6
@@ -127,8 +141,11 @@ jobs:
             generator)
               packages=(./internal/generator)
               ;;
-            pipeline-cli)
-              packages=(./internal/pipeline ./internal/cli)
+            pipeline)
+              packages=(./internal/pipeline)
+              ;;
+            cli)
+              packages=(./internal/cli)
               ;;
             rest)
               mapfile -t packages < <(go list ./... | grep -Ev '/internal/(generator|pipeline|cli)$')

← 26442897 chore(main): release 4.2.2 (#840)  ·  back to Cli Printing Press  ·  fix(cli): block vendor-prefix secrets during publish (#852) 8cf5459c →