Skip to content

Commit 75e0b0e

Browse files
svenvhAlexeySotkin
authored andcommitted
[CI] Align clang-tidy/format versions to LLVM version
Using a different LLVM version to obtain the compile commands may cause inclusion of compiler flags that aren't recognized by the older version of clang-tidy.
1 parent 43c071f commit 75e0b0e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

.github/workflows/check-code-style.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ jobs:
6161
curl -L "https://apt.llvm.org/llvm-snapshot.gpg.key" | sudo apt-key add -
6262
echo "deb https://apt.llvm.org/bionic/ llvm-toolchain-bionic main" | sudo tee -a /etc/apt/sources.list
6363
sudo apt-get update
64-
sudo apt-get install -yqq clang-format-9 clang-tidy-9 llvm-${{ env.LLVM_VERSION }}-dev libomp-${{ env.LLVM_VERSION }}-dev
64+
sudo apt-get install -yqq \
65+
clang-format-${{ env.LLVM_VERSION }} clang-tidy-${{ env.LLVM_VERSION }} \
66+
llvm-${{ env.LLVM_VERSION }}-dev libomp-${{ env.LLVM_VERSION }}-dev
6567
6668
- name: Generate compile command database
6769
if: ${{ steps.gather-list-of-changes.outputs.HAS_CHANGES }}
@@ -73,7 +75,7 @@ jobs:
7375
if: ${{ steps.gather-list-of-changes.outputs.HAS_CHANGES }}
7476
id: run-clang-format
7577
run: |
76-
cat diff-to-inspect.txt | /usr/share/clang/clang-format-9/clang-format-diff.py -p1 > clang-format.patch
78+
cat diff-to-inspect.txt | /usr/share/clang/clang-format-${{ env.LLVM_VERSION }}/clang-format-diff.py -p1 > clang-format.patch
7779
if [ -s clang-format.patch ]; then
7880
echo "clang-format found incorrectly formatted code:"
7981
cat clang-format.patch;
@@ -91,8 +93,8 @@ jobs:
9193
if: ${{ always() && steps.gather-list-of-changes.outputs.HAS_CHANGES }}
9294
id: run-clang-tidy
9395
run: |
94-
cat diff-to-inspect.txt | /usr/lib/llvm-9/share/clang/clang-tidy-diff.py \
95-
-p1 -clang-tidy-binary clang-tidy-9 -quiet \
96+
cat diff-to-inspect.txt | /usr/lib/llvm-${{ env.LLVM_VERSION }}/share/clang/clang-tidy-diff.py \
97+
-p1 -clang-tidy-binary clang-tidy-${{ env.LLVM_VERSION }} -quiet \
9698
-path ${{ github.workspace}}/build > clang-tidy.log 2>/dev/null
9799
# By some reason, clang-tidy log contains tons of extra empty lines,
98100
# that confuse the check below

0 commit comments

Comments
 (0)