Skip to content

Commit d67577c

Browse files
committed
Add reviewdog with clang-format
1 parent 8e79c98 commit d67577c

2 files changed

Lines changed: 53 additions & 10 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ jobs:
1313
fail-fast: true
1414
matrix:
1515
compiler: [ [clang++-12, clang-12] ]
16-
build: [ Debug, Release ]
16+
build: [ Debug ]
17+
#build: [ Debug, Release ]
1718

1819
continue-on-error: false
1920
steps:
@@ -53,15 +54,6 @@ jobs:
5354
libclang-cpp12-dev \
5455
clang-tidy-12
5556
56-
- name: Run clang-format
57-
uses: DoozyX/clang-format-lint-action@v0.13
58-
with:
59-
source: '.'
60-
extensions: 'h,cpp,c'
61-
clangFormatVersion: 12
62-
#exclude: './lib'
63-
# inplace: True
64-
6557
#- name: Building Phasar in ${{ matrix.build }} with ${{ matrix.compiler[0] }}
6658
# env:
6759
# BUILD_TYPE: ${{ matrix.build }}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Phasar clang-format review runner
2+
3+
on:
4+
pull_request:
5+
branches: [ master, development ]
6+
7+
jobs:
8+
format:
9+
runs-on: ubuntu-20.04
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
tool: [ clang-format ]
14+
include:
15+
- tool: clang-format
16+
install: |
17+
sudo apt-key adv --fetch-keys https://apt.llvm.org/llvm-snapshot.gpg.key
18+
sudo add-apt-repository -y 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-11 main'
19+
sudo apt-get update
20+
sudo apt-get -y install --no-install-recommends clang-format-11
21+
regex: \.(h|c|hpp|cpp)$
22+
command: clang-format-11 --style=file -i
23+
24+
continue-on-error: false
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v2
28+
with:
29+
submodules: recursive
30+
31+
- name: Install Dependencies
32+
shell: bash
33+
run: ${{ matrix.install }}
34+
35+
- name: Fetch Base Branch
36+
shell: bash
37+
run: |
38+
git fetch --depth=1 origin +refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
39+
40+
- name: Run Tool
41+
shell: bash
42+
run: |
43+
FILES=$(git diff --name-only --diff-filter=AM origin/${{ github.base_ref }} HEAD | egrep "${{ matrix.regex }}" || true)
44+
[ -z "$FILES" ] || (${{ matrix.command }} $FILES && git diff --diff-filter=M $FILES)
45+
46+
- name: Add Suggestions
47+
uses: reviewdog/action-suggester@v1
48+
with:
49+
tool_name: ${{ matrix.tool }}
50+
filter_mode: diff_context
51+
level: warning

0 commit comments

Comments
 (0)