Skip to content

ci: improve Go caching #7954

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

Merged
merged 27 commits into from
Jun 12, 2023
Merged

ci: improve Go caching #7954

merged 27 commits into from
Jun 12, 2023

Conversation

ammario
Copy link
Member

@ammario ammario commented Jun 10, 2023

... Amongst various other minor improvements.

@ammario ammario added the hotfix label Jun 10, 2023
@ammario ammario self-assigned this Jun 10, 2023
@ammario ammario enabled auto-merge (squash) June 10, 2023 17:20
cdr-bot[bot]
cdr-bot bot previously approved these changes Jun 10, 2023
Copy link

@cdr-bot cdr-bot bot left a comment

Choose a reason for hiding this comment

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

This PR is no longer a hotfix.

  • ✅ Base is main
  • ✅ Has hotfix label
  • ✅ Head is from coder/coder
  • ❌ Less than 100 lines

@ammario ammario disabled auto-merge June 10, 2023 17:33
@cdr-bot cdr-bot bot dismissed their stale review June 10, 2023 19:37

This PR is no longer a hotfix.

@ammario ammario requested a review from deansheather June 10, 2023 19:48
@ammario ammario changed the title ci: cache Go only once ci: improve Go caching Jun 10, 2023
@matifali matifali self-requested a review June 11, 2023 12:13
Copy link
Member

@deansheather deansheather left a comment

Choose a reason for hiding this comment

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

The Setup Go workflow needs to work on Windows

Comment on lines +26 to +31
- name: Get cache dirs
shell: bash
run: |
set -x
echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_ENV
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't work on Windows runners

Copy link
Member Author

Choose a reason for hiding this comment

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

Huh?

${{ env.GOMODCACHE }}
key: gomodcache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}-${{ github.job }}
restore-keys: |
gomodcache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}-
Copy link
Member

Choose a reason for hiding this comment

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

GOCACHE also has the github.job one listed

Copy link
Member Author

Choose a reason for hiding this comment

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

I added a comment that may help this make more sense

go-${{ runner.os }}-${{ github.job }}-
go-${{ runner.os }}-
go-
gocache-${{ runner.os }}-${{ github.job }}-
Copy link
Member

Choose a reason for hiding this comment

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

Hyphen at the end?

Copy link
Member Author

Choose a reason for hiding this comment

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

That was on purpose. It's how I've seen it done on a few docs. I guess it clearly symbolizes the end of a token.

repo: gotestyourself/gotestsum
tag: v1.9.0
shell: bash
run: go install gotest.tools/gotestsum@latest
Copy link
Member

Choose a reason for hiding this comment

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

Does not work on Windows AFAIK

Copy link
Member Author

Choose a reason for hiding this comment

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

why?

lint/go:
./scripts/check_enterprise_imports.sh
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.2
Copy link
Member

Choose a reason for hiding this comment

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

Can this be skipped if golangci-lint is in PATH?

Copy link
Member Author

Choose a reason for hiding this comment

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

Why do it though? It runs almost instantly if already installed.

@matifali matifali removed their request for review June 11, 2023 17:33
@ammario ammario requested a review from deansheather June 11, 2023 22:42
@ammario
Copy link
Member Author

ammario commented Jun 11, 2023

@deansheather the windows job seems to run fine?

@ammario
Copy link
Member Author

ammario commented Jun 12, 2023

Force merging as folks are struggling with CI today.

@ammario ammario merged commit a540e62 into main Jun 12, 2023
@ammario ammario deleted the ci-dedup-cache branch June 12, 2023 17:09
@github-actions github-actions bot locked and limited conversation to collaborators Jun 12, 2023
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.

2 participants