Skip to content

Commit dcd8ade

Browse files
committed
update the CI
1 parent 868bb63 commit dcd8ade

1 file changed

Lines changed: 22 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: ci
2+
23
on:
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
1414
concurrency:
1515
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1616
cancel-in-progress: true
1717

18-
1918
jobs:
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
@@ -46,11 +66,5 @@ jobs:
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

0 commit comments

Comments
 (0)