-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Go: update make
and CI to use bazel
#16398
Conversation
make
and CI to work with bazelmake
and CI to use bazel
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.
Thank you for separating this out in its own PR! Mostly looks good: I have a few minor points, and a couple of questions/suggestions for possibly improving the developer experience.
go/actions/test/action.yml
Outdated
- name: Check that all Go code is autoformatted | ||
if: inputs.run-code-checks == 'true' | ||
shell: bash | ||
run: | | ||
cd go | ||
make check-formatting | ||
|
||
- name: Check checked-in generated code | ||
if: inputs.run-code-checks == 'true' | ||
shell: bash | ||
run: | | ||
bazel run go:gen | ||
git add . | ||
git diff --exit-code HEAD || ( | ||
echo "please run bazel run //go:gen" | ||
exit 1 | ||
) |
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.
Would it make sense to change the conditions to inputs.run-code-checks == 'true' && always()
so that they run, even if a previous step failed? That way the checks would be performed, even if the build / a previous check fails and save us from potentially needing multiple CI runs / incremental fixes. (Would need to check that the proposed conditions work as intended, since always()
is sort of magical.)
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 suggestion, but I guess that this shouldn't be required if we move this check up as you suggested
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 it would probably still make sense to have for the "Check checked-in generated code" step, since it would be nice to run it even if "Check that all Go code is autoformatted" fails so that potentially two issues can become apparent from one CI run.
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.
Indeed. As far as I know the correct magic github action incantation to get that is !cancelled()
(as otherwise always()
would run even when the workflow got cancelled, which is not ideal, and cancellation is forcibly done any way after a short timeout)
go/actions/test/action.yml
Outdated
) | ||
|
||
- name: Compile qhelp files to markdown | ||
if: inputs.run-code-checks == 'true' |
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.
Same as above
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.
yeah, this on the other hand might make sense to render independent... but maybe we could do that with a separate parallel job?
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.
A separate parallel job would work, too. The downside to doing that may be that it requires the overhead of checking out the repo on a separate runner. It's a question of whether we care about that overhead or not. I have no strong opinion.
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 ended up keeping it here, as there was also the go
setup being required, which I prefer having shared here with one place where the go version should be updated.
go/actions/test/action.yml
Outdated
env QHELP_OUT_DIR=qhelp-out make qhelp-to-markdown | ||
|
||
- name: Upload qhelp markdown | ||
if: inputs.run-code-checks == 'true' |
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.
Same as above
go/actions/test/action.yml
Outdated
- name: Build | ||
shell: bash | ||
run: | | ||
bazel run go:create-extractor-pack |
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.
It may be good to add a comment here noting that this explicitly does not run make
(and therefore no bazel run :gen
) because we want generated files to be checked-in. This uses whatever is checked-in for the extractor pack and the later check then complains if the generated files aren't up-to-date.
Related question: Might we want the "Check checked-in generated code" step to take place before "Build" to fail the build if the generated files are not up-to-date, rather than performing this step with whatever is checked-in?
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.
hmm, yeah, it makes sense to do that I think, thanks!
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.
LGTM, but I'll defer to the go team for approval on this.
Co-authored-by: Michael B. Gale <[email protected]>
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.
LGTM, thank you ✨
No description provided.