Skip to content

Commit

Permalink
add clang-format to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
r00t- committed Mar 14, 2021
1 parent 66a039a commit 77947c2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/clang-format.yml
@@ -0,0 +1,13 @@
name: clang-format

on: [push]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: install clang-format
run: sudo apt-get install clang-format
- uses: actions/checkout@v2
- run: ./clang-format.sh
11 changes: 11 additions & 0 deletions clang-format.sh
@@ -0,0 +1,11 @@
#!/bin/bash
set -xe
SRCDIRS=(include src tests)
clang-format --version
find "${SRCDIRS[@]}" -type f -name '*.h' -o -name '*.cpp' -o -name '*.hpp' | xargs -I{} -P1 clang-format -i -style=file {}
git diff
if [[ -z "$(git status --porcelain "${SRCDIRS[@]}" ]] ; then
git status
git diff
exit 1
fi

0 comments on commit 77947c2

Please sign in to comment.