forked from Xilinx/XRT
-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (87 loc) · 2.9 KB
/
clangtidy-review.yml
File metadata and controls
102 lines (87 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# SPDX-License-Identifier: MIT
# Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
name: clang-tidy-review
on:
pull_request:
types: [opened, synchronize, reopened]
branches: master
workflow_dispatch:
jobs:
clangtidy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
# Dependencies needed for external cmake configuration
- name: Install dependencies
run: |
sudo apt update
sudo src/runtime_src/tools/scripts/xrtdeps.sh
- name: Configure legacy XRT build
run: |
cmake -B build/legacy \
-DXRT_ENABLE_HIP=ON \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_BUILD_TYPE=Release src
- name: Configure edge XRT
run: |
env XRT_NATIVE_BUILD=no cmake -B build/edge \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_BUILD_TYPE=Release src
- name: Configure NPU XRT
run: |
cmake -B build/npu \
-DXRT_NPU=1 \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_BUILD_TYPE=Release src
- name: Merge databases into one compile_commands.json
run: |
python <<EOF
import json, os
# Last entry is preserved
build_dirs = ["build/npu", "build/edge", "build/legacy"]
merged_commands = {}
for build_dir in build_dirs:
json_path = os.path.join(build_dir, "compile_commands.json")
if os.path.exists(json_path):
with open(json_path, "r") as f:
commands = json.load(f)
for entry in commands:
merged_commands[entry["file"]] = entry
with open("compile_commands.json", "w") as f:
json.dump(list(merged_commands.values()), f, indent=2)
print("Merged compile_commands.json created.")
EOF
- name: Upload merged database
uses: actions/upload-artifact@v4
with:
name: compile_commands
path: compile_commands.json
# Review uses external combined database
- name: Create clang-tidy review
id: review
uses: stsoe/clang-tidy-review@patches
with:
apt_packages: |
cmake, g++, pkg-config, libdrm-dev,
ocl-icd-dev, ocl-icd-libopencl1, ocl-icd-opencl-dev,
libamdhip64-dev,
libboost-dev, libboost-filesystem-dev, libboost-program-options-dev,
libncurses5-dev,
libssl-dev,
rapidjson-dev,
libelf-dev,
libprotoc-dev, protobuf-compiler,
uuid-dev,
systemtap-sdt-dev,
curl, libcurl4-openssl-dev,
libudev-dev
# disable default checks and rely on closest .clangtidy
clang_tidy_checks: ''
split_workflow: true
- name: Upload clang-tidy review
uses: stsoe/clang-tidy-review/upload@patches
id: upload-review