Skip to content

Commit

Permalink
Add CI check for fomatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Sigmanificient committed Apr 19, 2024
1 parent d105d4e commit c111b29
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/fmt-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on:
workflow_dispatch:
push:
paths:
- "**.nix"
- "**.lock"
- ".github/workflows/nix-build.yml"

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v26
with:
nix_path: nixpkgs=channel:nixos-unstable

- run: |
nix buld nixpkgs#clang-tools
find . -type f -name "*.c" -or -name "*.h" \
| xargs -i ./result/bin/clang-format -i {}
out=out=$(git status \
| grep "modified" \
| cut -d ":" -f 2 \
| sort \
| xargs \
| tee /dev/stderr \
| wc -c)
[ $out -ge 1 ] && exit 1 || exit 0
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
bear
python3Packages.compiledb
gcovr
clang-tools
];
};

Expand Down

0 comments on commit c111b29

Please sign in to comment.