Skip to content

Better test coverage #734

Better test coverage

Better test coverage #734

name: Check Formatting
on: [pull_request]
jobs:
check-format:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v1
with:
submodules: true
- name: Install dependencies from APT
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 14
sudo apt install -y git clang-format-14
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-14 100
sudo update-alternatives --set clang-format /usr/bin/clang-format-14
- name: Check Formatting
run: |
cd ${{ github.workspace }}
git reset --soft $(git merge-base HEAD origin/master)
diff=$(git clang-format-14 --style=file --diff)
if [ $(echo "${diff}" | wc -l) != 1 ]; then
echo "Formatting errors detected! Suggested changes:" >&2
echo "${diff}" >&2
exit 1
else
echo "No formatting errors detected!"
exit 0
fi