Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@ name: Build
on: [push, pull_request]

jobs:
check-format:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Install code formatters
run: |
sudo apt-get update
sudo apt-get install clang-format git

- name: Check code formatting
run: ./check-format.sh

build:
runs-on: ubuntu-24.04
env:
Expand Down
10 changes: 10 additions & 0 deletions check-format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -eu

diff=$(git clang-format -q --extensions c,cc,cpp,h,hpp --diff HEAD~1)
if [[ -n diff ]]; then
# clang-format outputs some diff, which indicates the commit is not properly
# formatted.
exit 1
fi
Loading