I have a GitLab repository containing Protocol Buffers code (i.e., .proto
files).
The specifics of what I wish to accomplish shouldn't matter to my main question, but the context may help, so here goes. I wish to add a Protocol Buffers source code formatter to the repository's GitLab CI pipeline that checks whether the proto
files in any merge request are correctly formatted (say, by running the formatter on the source files and checking that no changes are produced). The formatter I've settled on for this task is clang-format
.
Clang-format
is distributed as a binary. What is the right approach to integrate the binary into the GitLab CI pipeline for this purpose? By right approach, I'm mainly looking for:
- solutions that are idiomatic and follow best practices; and
- solutions that are efficient (e.g., not re-download the binary for each run, if possible)