From bd1f7577671781a8c0f3f426914744e0a5272fa0 Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Mon, 7 Oct 2024 17:30:34 -0700 Subject: [PATCH] Only run clang-tidy on changed files and create a review. --- .github/workflows/verible-ci.yml | 47 ++++++++++++------------------ common/lsp/lsp-text-buffer_test.cc | 2 +- 2 files changed, 19 insertions(+), 30 deletions(-) diff --git a/.github/workflows/verible-ci.yml b/.github/workflows/verible-ci.yml index f4b83770f..46f4bf3a0 100644 --- a/.github/workflows/verible-ci.yml +++ b/.github/workflows/verible-ci.yml @@ -52,11 +52,8 @@ jobs: path: "**/plot_*.svg" ClangTidy: - container: ubuntu:jammy - runs-on: [self-hosted, Linux, X64, gcp-custom-runners] - - env: - GHA_MACHINE_TYPE: "n2-standard-4" + runs-on: ubuntu-24.04 + if: github.event_name == 'pull_request' steps: @@ -65,21 +62,6 @@ jobs: with: fetch-depth: 0 - - name: Get latest clang-tidy - run: | - apt -qq -y update - apt -qq -y install wget software-properties-common gpg lsb-release - apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 15CF4D18AF4F7421 - wget https://apt.llvm.org/llvm.sh - chmod +x ./llvm.sh - ./llvm.sh 17 - - - name: Install other Dependencies - run: | - apt -qq -y install clang-tidy-11 clang-tidy-17 build-essential git wget - source ./.github/settings.sh - ./.github/bin/install-bazel.sh - - name: Create Cache Timestamp id: cache_timestamp uses: nanzm/get-time-action@v2.0 @@ -95,18 +77,25 @@ jobs: key: clang-tidy-${{ steps.cache_timestamp.outputs.time }} restore-keys: clang-tidy- - - name: Run clang tidy + - name: Make compilation DB run: | - echo "::group::Make Compilation DB" + export USE_BAZEL_VERSION=6.5.0 .github/bin/make-compilation-db.sh - wc -l compile_commands.json - echo "::endgroup::" - # For runtime references, use clang-tidy 11 that still has it, everything else: latest. - CLANG_TIDY=clang-tidy-11 ./.github/bin/run-clang-tidy-cached.cc --checks="-*,google-runtime-references" \ - || ( cat verible_clang-tidy.out ; exit 1) + ls -l compile_commands.json - CLANG_TIDY=clang-tidy-17 ./.github/bin/run-clang-tidy-cached.cc \ - || ( cat verible_clang-tidy.out ; exit 1) + - name: Create clang-tidy review + id: review + uses: ZedThree/clang-tidy-review@v0.19.0 + with: + split_workflow: true # Post comments separately + clang_tidy_version: 17 + config_file: .clang_tidy + token: ${{ secrets.GITHUB_TOKEN }} + + # clang_fixes.json artifact + - name: Finish review + uses: ZedThree/clang-tidy-review/upload@v0.19.0 + id: upload-review - name: 📤 Upload performance graphs uses: actions/upload-artifact@v3 diff --git a/common/lsp/lsp-text-buffer_test.cc b/common/lsp/lsp-text-buffer_test.cc index c3481b6ed..05d2df0d6 100644 --- a/common/lsp/lsp-text-buffer_test.cc +++ b/common/lsp/lsp-text-buffer_test.cc @@ -18,7 +18,7 @@ #include #include "absl/strings/str_cat.h" -#include "absl/strings/string_view.h" +//#include "absl/strings/string_view.h" #include "common/lsp/json-rpc-dispatcher.h" #include "common/lsp/lsp-protocol.h" #include "gtest/gtest.h"