golang / protobuf

Go support for Google's protocol buffers
BSD 3-Clause "New" or "Revised" License
9.74k stars 1.58k forks source link

GitHub Actions CI fails when the cache is hit #1562

Closed stapelberg closed 1 year ago

stapelberg commented 1 year ago

See e.g. run https://github.com/protocolbuffers/protobuf-go/actions/runs/6120891451/job/16613621767, which fails with the following error:

=== RUN   Test
=== RUN   Test/GeneratedGoFiles
    integration_test.go:91: executing (go run -tags protolegacy ./internal/cmd/generate-protos): exit status 1
        executing: protoc --plugin=protoc-gen-go=/tmp/go-build3962162[…]

        panic: exec: "protoc": executable file not found in $PATH

I looked into this a bit, and I think the reason is that protoc is built via bazel, and bazel stores the build output in $HOME/.cache/bazel, which is outside the $PWD/.cache that we save/restore in GitHub Actions.

The fix might be as simple as adding ~/.cache/bazel to the list of cached paths, but I want to take this opportunity to also update to actions/setup-go@v4 and actions/cache@v3 while at it, which will give us zstd compression for the cache.

I’ll send a change once I have a successful GitHub Actions run in my personal repository.