-
Notifications
You must be signed in to change notification settings - Fork 249
[CICD] Move gofumpt check to CICD, add cache #1518
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why move it into the workflow where it can't be run locally?
gofumpt can still be run locally. I just moved the |
@mikeland73 I was thinking that respecting If you want to use |
.github/workflows/cli-tests.yaml
Outdated
~/.cache/golangci-lint | ||
~/.cache/go-build | ||
~/go/pkg | ||
key: ${{ runner.os }}-${{ hashFiles('go.work.sum') }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go.sum
? We don't have a go-workspace in devbox.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch. My copy paste bad.
.github/workflows/cli-tests.yaml
Outdated
~/.cache/golangci-lint | ||
~/.cache/go-build | ||
~/go/pkg | ||
key: ${{ runner.os }}-${{ hashFiles('go.work.sum') }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion:
key: ${{ runner.os }}-devbox-go-${{ hashFiles('go.work.sum') }}
restore-keys: ${{ runner.os }}-devbox-go-
This may make it faster in the event of a cache miss, since it'll use the pre-existing "closest" cache as a starting point and then download the handful of changed dependencies to update the cache.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with using restore keys, but not with adding devbox-go-
. (I would just use a generic go
or cache-go
like the example you shared). This would allow sharing between go projects if they happen to have identical dependencies. (though that is rare)
oops, I missed the discussion with Greg. Approved modulo what y'all decide about moving the code or not. |
@gcurtis I was hoping to keep One alternative I'm ok with is to put it in bash script on it's own, but that obscures what the devbox.json is doing. Agree that being able to test CICD locally is good, which I think is the point of using Regarding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the diff from this PR disappeared?
I like git diff --exit-code
. If you use that in devbox.json it'll simplify it quite a bit. The complexity for CI needs to go somewhere, and I'd argue it's better to have it all in devbox.json
instead of the YAML. I also think putting it in a separate script would obscure what it's doing, but putting it in the YAML that can only be run in GitHub obscures it more. I'd be fine with compromising on putting it in a separate script.
Regarding --extra I'm not sure how I feel about CICD and local versions doing different things/checks. I think we either decide a rule is important and we enforce it or we don't, otherwise we end up with exceptions.
Having exceptions isn't necessarily bad. I run golangci-lint locally with rules that generate lots of false-positives but sometimes catch bugs. They're too unreliable to run in CI, but still useful for a human. If you really don't like the -extra
then I'm okay with removing it. My point was more that the logic between CI and local differ (CI does a diff and local edits).
I think having stricter checks that we run locally is fine, but if we explicitly run a check on CICD, having the same command do something differently on your machine can be confusing. My main holdup is doing 2 different things depending on the environment. e.g. I would suggest having |
Summary
This mimics how we handle failures in our opensource repo. The CICD logic exists in the github action workflow.
Extra notes:
runx
flow that could eliminate the need to install gofumpt.How was it tested?
devbox run lint
plus
CICD