actions / setup-go

Set up your GitHub Actions workflow with a specific version of Go
MIT License
1.41k stars 531 forks source link

Skip cache save feature #497

Open kian99 opened 3 months ago

kian99 commented 3 months ago

Description: I'd like to propose a new input to the action to enable skipping cache saves but maintaining the ability to restore an existing cache. Something like skip-cache-save.

Justification: We have the case in our CI/CD where we have the following jobs running in parallel:

  1. Run tests - i.e. runs go test ./...
  2. Run linting - i.e. run golangci-lint

Both jobs benefit from Go package caching but in the above scenario, the linting job finishes first and creates a cache that doesn't contain Go test artefacts. It would be useful to only have 1 job create the cache i.e. the job that populates the package cache and the test/build cache.

I imagine this can be handled by using actions/cache, but this addition feels like a simple way of achieving better cache control without dropping to a lower level tool.

Are you willing to submit a PR? Possibly, if the feature request is relevant.

priya-kinthali commented 3 months ago

Hello @kian99 👋, Thank you for this feature request. We will investigate it and get back to you as soon as we have some feedback.

adamdecaf commented 3 months ago

Similar to https://github.com/actions/setup-go/issues/495 the caching process takes a long time on our runners. There's no reason to cache by default as Github Actions already has tons of network proxying.

It takes 8s to setup Go in one job, but 2m45s to cache after the job.. Can we disable this post-job caching by default?