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 7196ec5 commit d3baf10
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/check-formatting.yml
@@ -0,0 +1,11 @@
name: check-formatting
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: ./check-formatting.sh
6 changes: 6 additions & 0 deletions check-formatting.sh
@@ -0,0 +1,6 @@
#!/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 {}
[[ -z "$(git status --porcelain "${SRCDIRS[@]}")" ]] || (git status; git diff; false)

0 comments on commit d3baf10

Please sign in to comment.