Skip to content

ci: clang-tidy: speed-up clang-tidy #189

ci: clang-tidy: speed-up clang-tidy

ci: clang-tidy: speed-up clang-tidy #189

Workflow file for this run

name: "Clang-Tidy"
on:
pull_request:
types: [opened, edited, synchronize, reopened]
paths:
- ".github/automation/x64/**"
- ".github/workflows/clang-tidy.yml"
- "cmake/**"
- "examples/**"
- "include/**"
- "src/common/**"
- "src/cpu/*"
- "src/cpu/gemm/**"
- "src/cpu/matmul/**"
- "src/cpu/reorder/**"
- "src/cpu/rnn/**"
- "src/cpu/x64/**"
- "src/gpu/*"
- "src/gpu/intel/**"
- "src/graph/**"
- "tests/**"
- "CMakeLists.txt"
## Declare default permissions as read only.
permissions: read-all
# Kill stale checks
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
pr-clang-tidy:
name: Clang-Tidy
runs-on: ubuntu-latest
steps:
- name: Checkout oneDNN
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- name: Install clang
run: |
sudo apt-get update
sudo apt-get install -y clang libomp-dev ocl-icd-libopencl1 ocl-icd-opencl-dev
- name: Configure oneDNN
run: |
.github/automation/x64/build_linters.sh
env:
ONEDNN_ACTION: configure
- name: Check source files
continue-on-error: true
run: |
for file in $(git diff --name-only ${{ github.event.pull_request.base.sha }} | grep -E '\.cpp$|\.c$'); do
if grep -q "$file" "build/compile_commands.json"; then
clang-tidy -p build --header-filter='' $file 2>&1 | tee -a source-check.log
fi
done
grep -i "warning:" source-check.log | sort -u
grep -q -i "warning:" source-check.log && exit 1 || true
- name: Check header files
continue-on-error: true
run: |
for file in $(git diff --name-only ${{ github.event.pull_request.base.sha }} | grep -E '\.hpp$|\.h$'); do
header_dir=$(dirname "$file")
if [[ "$header_dir" =~ ^include || $(grep -q $header_dir "build/compile_commands.json") ]]; then
echo $header_dir
clang-tidy -p build --header-filter='' $file | tee headers-check.log
fi
done
grep -i "warning:" headers-check.log | sort -u
grep -q -i "warning:" headers-check.log && exit 1 || true