Skip to content

Commit

Permalink
Only run clang-tidy on changed files and create a review.
Browse files Browse the repository at this point in the history
  • Loading branch information
hzeller committed Oct 8, 2024
1 parent 32b2456 commit bd1f757
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 30 deletions.
47 changes: 18 additions & 29 deletions .github/workflows/verible-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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/[email protected]
Expand All @@ -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/[email protected]
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/[email protected]
id: upload-review

- name: 📤 Upload performance graphs
uses: actions/upload-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion common/lsp/lsp-text-buffer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <string>

#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"
Expand Down

0 comments on commit bd1f757

Please sign in to comment.