[OMON-736] Enable C++20 and fix related warnings #232
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Clang format | |
on: [pull_request] | |
jobs: | |
clang-format: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Install prerequisites | |
run: | | |
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-11 100 | |
sudo update-alternatives --install /usr/bin/git-clang-format git-clang-format /usr/bin/git-clang-format-11 100 | |
- name: Run clang-format on changed files | |
run: | | |
set -x | |
git fetch origin ${{ github.event.pull_request.base.ref }} | |
base_commit=$(git rev-parse ${{ github.event.pull_request.base.sha }}) | |
result_output=$(git diff --diff-filter d --name-only "$base_commit" | | |
xargs -d '\n' git-clang-format --commit "$base_commit" --diff --style file) | |
if [ "$result_output" = 'no modified files to format' ] || | |
[ "$result_output" = 'clang-format did not modify any files' ] | |
then | |
exit 0 | |
else | |
git-clang-format --commit "$base_commit" --diff --style file | |
echo "$result_output" | |
exit 1 | |
fi |