Skip to content

Commit fecc24b

Browse files
hmaciakvpirogov
andauthored
ci: clang-tidy: speed-up clang-tidy
Co-authored-by: Vadim Pirogov <vadim.o.pirogov@intel.com>
1 parent f596714 commit fecc24b

File tree

3 files changed

+39
-11
lines changed

3 files changed

+39
-11
lines changed

.github/automation/x64/build_linters.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@ if [[ "$ONEDNN_ACTION" == "configure" ]]; then
1717
-DDNNL_EXPERIMENTAL_PROFILING=ON \
1818
-DDNNL_EXPERIMENTAL_UKERNEL=ON \
1919
-DONEDNN_EXPERIMENTAL_LOGGING=ON \
20-
-DDNNL_USE_CLANG_TIDY=CHECK \
2120
-DDNNL_CPU_RUNTIME=OMP \
2221
-DDNNL_GPU_RUNTIME=OCL \
2322
-DDNNL_WERROR=ON \
24-
-DDNNL_BUILD_FOR_CI=ON
23+
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
2524
set +x
2625
elif [[ "$GITHUB_JOB" == "pr-format-tags" ]]; then
2726
set -x

.github/workflows/clang-tidy.yml

+35-6
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ jobs:
3737
steps:
3838
- name: Checkout oneDNN
3939
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
40+
with:
41+
ref: ${{ github.event.pull_request.head.ref }}
42+
fetch-depth: 0
4043

4144
- name: Install clang
4245
run: |
@@ -48,10 +51,36 @@ jobs:
4851
env:
4952
ONEDNN_ACTION: configure
5053

51-
- name: Build oneDNN
54+
- name: Check source files
5255
run: |
53-
.github/automation/x64/build_linters.sh 2>&1 | tee build.log
54-
grep -i "warning:" build.log | sort -u
55-
grep -q -i "warning:" build.log && exit 1 || true
56-
env:
57-
ONEDNN_ACTION: build
56+
echo -e "Checking Clang-Tidy $(clang-tidy --version)\n"
57+
touch source-check.log
58+
for file in $(git diff --name-only ${{ github.event.pull_request.base.sha }} | grep -E '\.cpp$');
59+
do
60+
if grep -q "$file" "build/compile_commands.json"; then
61+
echo -e "\nAnalyzing $file"
62+
clang-tidy -p build --header-filter='' $file 2>&1 | tee -a source-check.log
63+
else
64+
echo "Skipped $file as it's not built in x64 OpenMP/OpenCL configuration."
65+
fi
66+
done
67+
grep -i -E "warning:|error:" source-check.log | sort -u
68+
grep -q -i -E "warning:|error:" source-check.log && exit 1 || true
69+
70+
- name: Check header files
71+
if: always()
72+
continue-on-error: true
73+
run: |
74+
echo -e "Checking Clang-Tidy $(clang-tidy --version)\n"
75+
touch headers-check.log
76+
for file in $(git diff --name-only ${{ github.event.pull_request.base.sha }} | grep -E '\.cpp$');
77+
do
78+
if grep -q "$file" "build/compile_commands.json"; then
79+
echo -e "\nAnalyzing $file"
80+
clang-tidy -p build $file 2>&1 | tee -a headers-check.log
81+
else
82+
echo "Skipped $file as it's not built in x64 OpenMP/OpenCL configuration."
83+
fi
84+
done
85+
grep -i -E "warning:|error:" headers-check.log | sort -u
86+
grep -q -i -E "warning:|error:" headers-check.log && exit 1 || true

.github/workflows/pr-linter.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ concurrency:
3232

3333
jobs:
3434
pr-commits:
35-
name: "Commit messages"
35+
name: Commit messages
3636
runs-on: ubuntu-latest
3737
steps:
3838
- name: Checkout
@@ -43,7 +43,7 @@ jobs:
4343
run: python3 ./.github/automation/commit-msg-check.py "${{ github.event.pull_request.head.sha }}" "${{ github.event.pull_request.base.sha }}"
4444

4545
pr-clang-format:
46-
name: "Clang-Format"
46+
name: Clang-Format
4747
runs-on: ubuntu-22.04
4848
steps:
4949
- name: Checkout
@@ -90,7 +90,7 @@ jobs:
9090
git diff | grep . && exit 1 || true
9191
9292
pr-status:
93-
name: "Formatting"
93+
name: Formatting
9494
runs-on: ubuntu-latest
9595
needs: [ pr-commits, pr-clang-format, pr-format-tags ]
9696
steps:

0 commit comments

Comments
 (0)