Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Optimize Go caches in Github Actions #4064

Merged
merged 1 commit into from
Nov 7, 2024
Merged

Conversation

KapJI
Copy link
Contributor

@KapJI KapJI commented Nov 6, 2024

  • Set GOPATH, GOCACHE and GOMODCACHE on Windows jobs. Drive C:/ on Windows workers is extremely slow and now these jobs are as fast as on MacOS or Linux.
    • test-windows job is down to 6m8s from 18m30s, 67% imrovement!
    • lint-windows-2022 is down to 58s from 3m10s, 70% improvement!
  • This also saves 1.2 GB per cache version for duplicated Windows cache.
  • Enable cache for codeql job. Re-use cache key generated by actions/setup-go. Run time is improved from 2m19s to 1m49s, by ~22%.

@bradenhilton
Copy link
Collaborator

bradenhilton commented Nov 6, 2024

I think we still need setup-go for the docs because we use Go templates.

args = [
'go',
'run',
Path(config_dir, '../../internal/cmds/execute-template/main.go'),
]

@KapJI
Copy link
Contributor Author

KapJI commented Nov 6, 2024

Thanks for the pointer! It actually works without it, but slower because of no cache.

@KapJI KapJI force-pushed the go-cache branch 7 times, most recently from 02e9d0e to 1978bc7 Compare November 6, 2024 22:11
@KapJI
Copy link
Contributor Author

KapJI commented Nov 6, 2024

@twpayne I fixed issue with Windows jobs. They are 3 times faster now.

Comment on lines -312 to -317
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was creating duplicating cache entry which also was super slow to unpack.

@twpayne twpayne merged commit 62bb0e0 into twpayne:master Nov 7, 2024
23 checks passed
@twpayne
Copy link
Owner

twpayne commented Nov 7, 2024

Awesome, thank you very much!

@KapJI KapJI deleted the go-cache branch November 7, 2024 17:43
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants