From 0848767514e91c3319e714f3c2582f965a2fdadf Mon Sep 17 00:00:00 2001 From: sbaluja Date: Tue, 17 Mar 2026 14:39:42 -0400 Subject: [PATCH 1/4] Add clang-tidy to CI --- .github/workflows/clang-tidy.yml | 57 ++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/clang-tidy.yml diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml new file mode 100644 index 000000000000..4fb994716a30 --- /dev/null +++ b/.github/workflows/clang-tidy.yml @@ -0,0 +1,57 @@ +name: clang-tidy-check + +on: + pull_request: + types: [opened, synchronize] + branches: + - main + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: clang-tidy-${{ github.ref }} + cancel-in-progress: true + +jobs: + tidy-check: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y clang-tidy cmake libcurl4-openssl-dev libssl-dev + + - name: Configure CMake + run: | + cmake -B build \ + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ + -DBUILD_ONLY="s3" \ + -DENABLE_TESTING=OFF + + - name: Get changed files + id: changed + env: + BASE_BRANCH: "${{ github.event.pull_request.base.ref }}" + HEAD_BRANCH: "${{ github.event.pull_request.head.ref }}" + run: | + git fetch origin "$BASE_BRANCH" + git fetch origin "$HEAD_BRANCH" + git diff --name-only --diff-filter=d origin/$BASE_BRANCH...origin/$HEAD_BRANCH \ + | grep -E '\.(cpp|cc|cxx|c|h|hh|hpp)$' \ + | grep -v '^generated/' > changed_files.txt || true + echo "count=$(wc -l < changed_files.txt | tr -d ' ')" >> "$GITHUB_OUTPUT" + + - name: Run clang-tidy + if: steps.changed.outputs.count != '0' + run: | + echo "Running clang-tidy on changed files:" + cat changed_files.txt + xargs -a changed_files.txt clang-tidy -p build --warnings-as-errors='performance-*' From 2ba26a8e9994dab448ed2414dd7157e5ce6cf3b2 Mon Sep 17 00:00:00 2001 From: sbaluja Date: Tue, 17 Mar 2026 14:40:31 -0400 Subject: [PATCH 2/4] Add fake TODO comment to test clang-tidy --- .../source/AmazonSerializableWebServiceRequest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aws-cpp-sdk-core/source/AmazonSerializableWebServiceRequest.cpp b/src/aws-cpp-sdk-core/source/AmazonSerializableWebServiceRequest.cpp index 0c401b01b20b..99ce8b16906d 100644 --- a/src/aws-cpp-sdk-core/source/AmazonSerializableWebServiceRequest.cpp +++ b/src/aws-cpp-sdk-core/source/AmazonSerializableWebServiceRequest.cpp @@ -6,7 +6,7 @@ #include #include -using namespace Aws; +using namespace Aws; // TODO: remove this test comment for clang-tidy CI validation std::shared_ptr AmazonSerializableWebServiceRequest::GetBody() const { From 357d3eee3478c79549400f49f0fa35251a4acf32 Mon Sep 17 00:00:00 2001 From: sbaluja Date: Tue, 17 Mar 2026 14:46:20 -0400 Subject: [PATCH 3/4] Update clang-tidy.yml to recurse submodules for cmake command --- .github/workflows/clang-tidy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index 4fb994716a30..230b44bb950c 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -23,6 +23,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + submodules: recursive - name: Install dependencies run: | From 153f63b6083f536eaa0ff97332bbac905d1603cf Mon Sep 17 00:00:00 2001 From: sbaluja Date: Tue, 17 Mar 2026 16:25:20 -0400 Subject: [PATCH 4/4] Remove test comment for CI job --- .../source/AmazonSerializableWebServiceRequest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aws-cpp-sdk-core/source/AmazonSerializableWebServiceRequest.cpp b/src/aws-cpp-sdk-core/source/AmazonSerializableWebServiceRequest.cpp index 99ce8b16906d..0c401b01b20b 100644 --- a/src/aws-cpp-sdk-core/source/AmazonSerializableWebServiceRequest.cpp +++ b/src/aws-cpp-sdk-core/source/AmazonSerializableWebServiceRequest.cpp @@ -6,7 +6,7 @@ #include #include -using namespace Aws; // TODO: remove this test comment for clang-tidy CI validation +using namespace Aws; std::shared_ptr AmazonSerializableWebServiceRequest::GetBody() const {