What I’m trying to achieve
- Check build and formatting using GitHub Actions
- Create a script anyone can call to format
*.cppand*.hppfiles on demand
Deploying CI on GH
I made a file called ci.yml under .github/workflows/, and configured two jobs.
One job downloads dependencies and runs build. It yells at you if the build failed.
The other does a “dry-run” of .clang-format to see if your files are still formatted Google Style-wise.
This also yells at you if it fails.
Both of these jobs only run when you open a PR.
Creating a formatting script
I made format.sh which looks at 3 possible locations for the clang-format binary.
It works for me on my NVIM setup because I have clang-format running on-save using
conform.nvim and mason.
If this doesn’t mean anything to you, don’t worry…
Hopefully format.sh works for Saf because he uses VSCode and I’m not 100% sure if
the path I used to find the clang-format binary is correct for him… Time will tell.
Driving questions
- I had to downgrade our version of
CMaketo avoid having the GH runners install a big package for every build… will this affect us in the future? - To what extent did I add friction by forcing a format, and adding and forcing you to
use an environment variable to get CMake to know where your
vcpkgis?
Next
- I want to take a step back and start running simple UI tests.