Introduce helpers for static analysis Gitlab CI jobs
This change adds a new GitLab CI job template called ".static-analysis", that will build the project and will run clazy and clang-tidy on it. When the job is ran on a merge request, the static analyzers are only executed on C++ files that have changed compared to the merge request target branch (which speeds things up considerably). When executed on arbitrary commit, it will perform check on all files in the repo.
The way it works is that
- The entire project is compiled as usual (using clang)
- The branch base commit (where the branch has diverged from the target branch) is identified
- Files that have changed between the base commit and HEAD of the source branch are identified
- Clazy and clang-tidy are executed on all changed files (parallelism is supported)
- A codequality report is generated, so the failed checks are shown as failed test in the merge request on GitLab