Skip to content

Commit

Permalink
[gccjit][ci] enable code formatting checks in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Lancern committed Dec 3, 2024
1 parent b8cb9b6 commit 4fe3baa
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
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

0 comments on commit 4fe3baa

Please sign in to comment.