Skip to content

Commit d3da405

Browse files
committed
internal/ci: skip the test cache via GOFLAGS=-count=1
I verified that GOFLAGS=-count=1 does not break cmd/go subcommands which don't take this flag, such as vet. It seems like GOFLAGS is implemented such that it knows chich commands support which flags. The previous comments were also somewhat confused; the use of -count=1 does not break the test caches on the trybot repo, because this step does not run on the trybot repo at all. It seems to me like the only reason we used `go clean -testcache` over `GOFLAGS=-count=1` was to keep the cache sizes lean. This is no longer a factor with Namespace runners. Signed-off-by: Daniel Martí <[email protected]> Change-Id: I2c45e1384fb6f1c547e5c5dc60388d89c154a59f Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1217815 TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Paul Jolly <[email protected]> Unity-Result: CUE porcuepine <[email protected]>
1 parent f615383 commit d3da405

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

.github/workflows/trybot.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484
- if: |-
8585
github.repository == 'cue-lang/cue' && (((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, '
8686
Dispatch-Trailer: {"type":"')))) || (github.ref == 'refs/heads/ci/test'))
87-
run: go clean -testcache
87+
run: go env -w GOFLAGS=-count=1
8888
- run: go run cuelang.org/go/cmd/cue login --token=${{ secrets.NOTCUECKOO_CUE_TOKEN }}
8989
- if: (matrix.go-version == '1.24.x' && matrix.runner == 'namespace-profile-ubuntu-24-04-amd64-8x16')
9090
name: Early git and code sanity checks

internal/ci/base/github.cue

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -159,22 +159,14 @@ setupGoActionsCaches: [
159159
with: cache: "go"
160160
},
161161

162-
// All tests on protected branches should skip the test cache. The
163-
// canonical way to do this is with -count=1. However, we want the
164-
// resulting test cache to be valid and current so that subsequent CLs
165-
// in the trybot repo can leverage the updated cache. Therefore, we
166-
// instead perform a clean of the testcache.
162+
// All tests on protected branches should skip the test cache,
163+
// which helps spot test flakes and bugs hidden by the caching.
167164
//
168-
// Critically we only want to do this in the main repo, not the trybot
169-
// repo.
170-
//
171-
// TODO(mvdan): rethink for Namespace, where trimming the cache size is irrelevant.
172-
// A better approach there is likely to set GOFLAGS=-count=1 for "go test",
173-
// assuming that does not interfere with other commands like "go vet",
174-
// as -count=1 is the canonical way to disable test caching.
165+
// Critically, we don't skip the test cache on the trybot repo,
166+
// so that the testing of CLs can rely on an up to date test cache.
175167
githubactions.#Step & {
176168
if: "github.repository == '\(githubRepositoryPath)' && (\(isProtectedBranch) || \(isTestDefaultBranch))"
177-
run: "go clean -testcache"
169+
run: "go env -w GOFLAGS=-count=1"
178170
},
179171
]
180172

0 commit comments

Comments
 (0)