Bazelify go-protoparser, and use it in CI tests #81
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a quick first pass at using Bazel in
go-protoparser
. This makes the CI tests run via Bazel. You can do the same on your machine, by runningbazel test //...
. If you don't have bazel, recommend you install bazelisk, which will manage your bazel version for you:https://bazel.build/install/bazelisk
Roughly, this is the result of:
WORKSPACE
and rootBUILD.bazel
file, with go rules andgazelle
in itgazelle
against the repo:bazel run //:gazelle
, to generateBUILD.bazel
files for every package_example/dump/main.go
to read_testdata/simple.proto
as a default argument at runtimebazel
commands where possibleYou can see the benefits of the caching in CI, if you rerun the builds -- you'll see that Bazel correctly doesn't re-run the tests again, and the build finishes very quickly:
https://github.com/shaldengeki/go-protoparser/actions/runs/7945280017/job/21691752664
(Or you can run
bazel test //...
locally twice, and observe that the second run finishes ~instantly.)I left the linting commands & job un-Bazelified. I think this'll take some more work -- basically, some of the linting packages take some work to bazelify, and doing it only partway will make the lint CI job slow (~40s).
Let me know what you think! I'm happy to keep plugging away at the lints if you'd rather do this in one fell swoop.