File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name : ci
2+
23on :
34 push :
45 branches :
@@ -10,19 +11,38 @@ defaults:
1011 run :
1112 shell : bash
1213
13- # Cancels a previous run if a new commit is made on the same pull request
1414concurrency :
1515 group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1616 cancel-in-progress : true
1717
18-
1918jobs :
19+ clang-format-check :
20+ name : Check code formatting
21+ runs-on : ubuntu-latest
22+
23+ steps :
24+ - name : Checkout repository
25+ uses : actions/checkout@v4
26+
27+ - name : Install clang-format
28+ run : |
29+ sudo apt-get update
30+ sudo apt-get install -y clang-format
31+
32+ - name : Run clang-format check
33+ run : |
34+ clang-format --version
35+ files=$(git ls-files '*.cc' '*.cpp' '*.h' '*.hpp')
36+ [ -z "$files" ] || clang-format --dry-run --Werror $files
37+
2038 build :
39+ name : Bazel tests
2140 strategy :
2241 matrix :
2342 os : [ubuntu-latest, macos-latest]
2443
2544 runs-on : ${{ matrix.os }}
45+ needs : [clang-format-check] # Don't run build if format check fails
2646
2747 steps :
2848 - name : Checkout repository
4666 run : |
4767 brew install clang-format
4868
49- - name : Check formatting
50- run : |
51- clang-format --version
52- files=$(git ls-files '*.cc' '*.h' '*.cpp' '*.hpp')
53- [ -z "$files" ] || clang-format --dry-run --Werror $files
54-
5569 - name : Bazel tests
5670 run : bazel test src:all
You can’t perform that action at this time.
0 commit comments