Skip to content

CI: sequence actions/checkout before actions/setup-go#4473

Closed
lukasschwab wants to merge 1 commit intoprebid:masterfrom
lukasschwab:master
Closed

CI: sequence actions/checkout before actions/setup-go#4473
lukasschwab wants to merge 1 commit intoprebid:masterfrom
lukasschwab:master

Conversation

@lukasschwab
Copy link

Changes

Reorders GitHub workflows using actions/checkout and actions/setup-go: run actions/checkout before actions/setup-go.

Running actions/checkout first checks out the go.sum file so the cache can hit. This matches the step-order demonstrated in the setup-go README:1

steps:
  - uses: actions/checkout@v4
  - uses: actions/setup-go@v5

Motivation

The actions/setup-go build cache always misses because go.sum isn't present when the step runs. Here's the warning message and some timing notes 2

Warning: Restore cache failed: Dependencies file is not found in /home/runner/work/prebid-server/prebid-server. Supported file pattern: go.sum

Timestamp Log Note
17:08:45 Run ./validate.sh --nofmt --cov --race 10 Validate step starts.
17:08:50 go: downloading google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 Last dependency starts downloading.
17:12:56 ok github.com/prebid/prebid-server/v3 0.009s coverage: 3.1% of statements First test log — four minutes later!

Validation

The first time this updated workflow runs (against this PR!) the setup-go step will still cache-miss, but it shouldn't emit the "Dependencies file is not found" log — the cache is just empty!

Subsequent runs should realize the speedup.

Footnotes

  1. https://github.com/actions/setup-go?tab=readme-ov-file#basic

  2. https://github.com/prebid/prebid-server/actions/runs/16729524538/job/47353933940#step:2:16

The actions/setup-go build cache always misses because go.sum isn't
present when the step runs:[^example]

> Warning: Restore cache failed: Dependencies file is not found in /home/runner/work/prebid-server/prebid-server. Supported file pattern: go.sum

[^example]: https://github.com/prebid/prebid-server/actions/runs/16729524538/job/47353933940#step:2:16

Running actions/checkout first checks out the go.sum file so the cache
can hit.

This matches the step-order demonstrated in the setup-go README.
@lukasschwab
Copy link
Author

lukasschwab commented Aug 4, 2025

Unnecessary commentary...

For what it's worth, I think the race stage of validate.sh leaves a lot of room for optimization —

  1. It takes ~1s per package even if there are no tests matching ^TestRace.*$; with 345 packages, that adds up despite parallelism.
  2. I'm not sure the -count flag is necessary here; afaik, it doesn't impact whether or not a race is detected.

Haven't investigated deeply, but I wonder if this whole thing would be faster (and much simpler) with a single pass of go test -cover -race. Unfortunately, that turns up some race conditions in existing tests.

@lukasschwab
Copy link
Author

Closing to clean up my inbox, but happy to reopen if it helps. cc @bsardo, @SyntaxNode, @VeronikaSolovei9, and @guscarreon (involved in a recent CI change #4251) — this would save a few minutes per CI run without changing the check logic at all.

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