From 071bec4b0c7e93f2a80366257a7b53e5f93b04f3 Mon Sep 17 00:00:00 2001 From: Theo Gravity Date: Sat, 2 May 2026 23:53:42 -0700 Subject: [PATCH] fix(ci): prime module cache before monorel runs GOPROXY=off tidy setup-go alone wasn't enough: monorel v0.12+ runs `go mod tidy` per sub-module with GOPROXY=off, so it can only resolve modules already in the local module cache. On a fresh runner with no cache hit, the tidy step fails with: go.loglayer.dev/transports/cli/v2 imports github.com/mattn/go-isatty: module lookup disabled by GOPROXY=off Two changes per workflow: 1. setup-go now has `cache: true` and `cache-dependency-path: '**/go.sum'` (mirrors ci.yml). On warm cache hits (typical case), modules are pre-extracted into the runner's GOMODCACHE. 2. New "Prime module cache for monorel tidy" step walks every go.mod in the repo and runs `go mod download` per module. This populates the cache from the network on cache-miss runs (e.g., the first run after a sub-module's go.sum changes), so monorel's GOPROXY=off tidy always finds what it needs. Applied to both release-pr.yml and release.yml. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/release-pr.yml | 19 +++++++++++++++---- .github/workflows/release.yml | 19 +++++++++++++++---- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml index dabdf5d..e529486 100644 --- a/.github/workflows/release-pr.yml +++ b/.github/workflows/release-pr.yml @@ -33,13 +33,24 @@ jobs: with: fetch-depth: 0 - # The monorel CI action runs `go mod tidy` per sub-module to refresh - # go.sum entries. Sub-modules require Go 1.25; the runner default is - # older and the action sets GOTOOLCHAIN=local, so install the Go we - # need explicitly before invoking monorel. + # The monorel CI action runs `go mod tidy` per sub-module with + # GOPROXY=off, so it can only resolve modules already in the local + # cache. Sub-modules also require Go 1.25, which the runner default + # doesn't supply. Install Go 1.25 with caching enabled, then prime + # the module cache via `go mod download` per module so monorel's + # GOPROXY=off tidy can find every transitive dep. - uses: actions/setup-go@v5 with: go-version: '1.25' + cache: true + cache-dependency-path: '**/go.sum' + + - name: Prime module cache for monorel tidy + run: | + set -euo pipefail + while IFS= read -r mod; do + (cd "$(dirname "$mod")" && go mod download) + done < <(find . -name go.mod -not -path './.git/*' | sort) - uses: disaresta-org/monorel/ci/github@v0.11.0 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fb6e675..a2a4602 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,13 +42,24 @@ jobs: with: fetch-depth: 0 - # The monorel CI action runs `go mod tidy` per sub-module to refresh - # go.sum entries. Sub-modules require Go 1.25; the runner default is - # older and the action sets GOTOOLCHAIN=local, so install the Go we - # need explicitly before invoking monorel. + # The monorel CI action runs `go mod tidy` per sub-module with + # GOPROXY=off, so it can only resolve modules already in the local + # cache. Sub-modules also require Go 1.25, which the runner default + # doesn't supply. Install Go 1.25 with caching enabled, then prime + # the module cache via `go mod download` per module so monorel's + # GOPROXY=off tidy can find every transitive dep. - uses: actions/setup-go@v5 with: go-version: '1.25' + cache: true + cache-dependency-path: '**/go.sum' + + - name: Prime module cache for monorel tidy + run: | + set -euo pipefail + while IFS= read -r mod; do + (cd "$(dirname "$mod")" && go mod download) + done < <(find . -name go.mod -not -path './.git/*' | sort) - uses: disaresta-org/monorel/ci/github@v0.11.0 with: