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 e1e3cd8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 30 deletions.
46 changes: 17 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/get-time-action@v2.0
Expand All @@ -95,18 +77,24 @@ 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:
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
Expand Down
4 changes: 3 additions & 1 deletion common/strings/obfuscator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ std::string Obfuscator::save() const {

absl::Status Obfuscator::load(absl::string_view mapping) {
const std::vector<absl::string_view> lines =
absl::StrSplit(mapping, '\n', absl::SkipEmpty());
absl::StrSplit(mapping, '\n', absl::SkipEmpty());
BijectiveMap<std::string, std::string,
StringViewCompare, StringViewCompare> footesting;
for (const auto &line : lines) {
const std::vector<absl::string_view> elements =
absl::StrSplit(absl::StripAsciiWhitespace(line), kPairSeparator);
Expand Down

0 comments on commit e1e3cd8

Please sign in to comment.