From 2a0076d16779a74292b39fbd75e7b889d4a6b9f6 Mon Sep 17 00:00:00 2001 From: Xianpeng Shen <3353385+shenxianpeng@users.noreply.github.com> Date: Sun, 25 Oct 2026 15:11:40 +0000 Subject: [PATCH 1/3] test: end-to-end check of cpp-linter-action#501 with clang-tools 2.0.0 --- .github/workflows/test-action-pr501-r2.yml | 162 +++++++++++++++++++++ src/demo.cpp | 14 +- 2 files changed, 175 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test-action-pr501-r2.yml diff --git a/.github/workflows/test-action-pr501-r2.yml b/.github/workflows/test-action-pr501-r2.yml new file mode 100644 index 0000000..857d0d4 --- /dev/null +++ b/.github/workflows/test-action-pr501-r2.yml @@ -0,0 +1,162 @@ +# Temporary: end-to-end check of cpp-linter/cpp-linter-action#501 +# (cpp-linter 1.14.1 -> 1.15.1, clang-tools 1.3.0 -> 2.0.0). Remove after the test. +name: test action#501 (1.15.1 + clang-tools 2.0.0) + +on: + push: + branches: [claude/project-thread-nfsfml] + pull_request: + branches: [master] + +permissions: + contents: write + pull-requests: write + +jobs: + candidate: + name: "candidate ${{ matrix.os }}" + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest, windows-11-arm] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v7 + with: + persist-credentials: false + - name: Generate compilation database + run: cmake -Bbuild src + - name: Run cpp-linter-action (cpp-linter 1.15.1, clang-tools 2.0.0) + uses: cpp-linter/cpp-linter-action@fc065f1b186a95c585df750b8007b0fe2f487800 + id: linter + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + style: file + version: '20' + ignore: build + database: build + verbosity: debug + extra-args: -std=c++14 -Wall + files-changed-only: ${{ github.event_name == 'pull_request' }} + step-summary: true + file-annotations: true + thread-comments: ${{ matrix.os == 'ubuntu-latest' && 'update' || 'false' }} + tidy-review: ${{ matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request' }} + format-review: ${{ matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request' }} + - name: Outputs + shell: bash + run: | + echo "total: ${{ steps.linter.outputs.checks-failed }}" + echo "clang-format: ${{ steps.linter.outputs.clang-format-checks-failed }}" + echo "clang-tidy: ${{ steps.linter.outputs.clang-tidy-checks-failed }}" + command -v clang-tidy-20 clang-format-20 || true + ls -la ~/.local/share/clang-tools 2>/dev/null || true + + baseline: + name: "main ${{ matrix.os }}" + if: github.event_name == 'push' + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest, windows-11-arm] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v7 + with: + persist-credentials: false + - name: Generate compilation database + run: cmake -Bbuild src + - name: Run cpp-linter-action at main (cpp-linter 1.14.1, clang-tools 1.3.0) + uses: cpp-linter/cpp-linter-action@f16b974d2b12ac48190748a973e67d50603e9826 + id: linter + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + style: file + version: '20' + ignore: build + database: build + verbosity: debug + extra-args: -std=c++14 -Wall + files-changed-only: false + step-summary: true + file-annotations: false + thread-comments: false + - name: Outputs + shell: bash + run: | + echo "total: ${{ steps.linter.outputs.checks-failed }}" + echo "clang-format: ${{ steps.linter.outputs.clang-format-checks-failed }}" + echo "clang-tidy: ${{ steps.linter.outputs.clang-tidy-checks-failed }}" + + versions: + # every supported clang version on each OS: clang-tools 2.0.0 installs + # the static binaries (Windows, and wherever the system has no such version) + name: "${{ matrix.ref == 'fc065f1b186a95c585df750b8007b0fe2f487800' && 'candidate' || 'main' }} ${{ matrix.os }} clang ${{ matrix.version }}" + if: github.event_name == 'push' + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + version: ['12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23'] + ref: + - fc065f1b186a95c585df750b8007b0fe2f487800 + - f16b974d2b12ac48190748a973e67d50603e9826 + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v7 + with: + persist-credentials: false + - name: Generate compilation database + run: cmake -Bbuild src + - name: Check out the action + uses: actions/checkout@v7 + with: + repository: cpp-linter/cpp-linter-action + ref: ${{ matrix.ref }} + path: action-under-test + persist-credentials: false + - name: Run cpp-linter-action + uses: ./action-under-test + id: linter + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + style: file + version: ${{ matrix.version }} + ignore: build|action-under-test + database: build + extra-args: -std=c++14 -Wall + files-changed-only: false + step-summary: false + file-annotations: false + thread-comments: false + - name: Outputs + shell: bash + run: | + echo "result: total=${{ steps.linter.outputs.checks-failed }} format=${{ steps.linter.outputs.clang-format-checks-failed }} tidy=${{ steps.linter.outputs.clang-tidy-checks-failed }}" + + auto-fix: + name: "candidate auto-fix" + if: always() && github.event_name == 'pull_request' + # run after the review job so the pushed fix does not change the PR diff mid-review + needs: candidate + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + with: + ref: ${{ github.head_ref }} + - name: Run cpp-linter-action with auto-fix + uses: cpp-linter/cpp-linter-action@fc065f1b186a95c585df750b8007b0fe2f487800 + id: linter + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + style: file + version: '20' + tidy-checks: '-*' + files-changed-only: true + thread-comments: false + step-summary: true + auto-fix: true diff --git a/src/demo.cpp b/src/demo.cpp index 0c1db60..d177457 100644 --- a/src/demo.cpp +++ b/src/demo.cpp @@ -1,7 +1,7 @@ /** This is a very ugly test code (doomed to fail linting) */ #include "demo.hpp" -#include #include +#include // using size_t from cstddef size_t dummyFunc(size_t i) { return i; } @@ -15,3 +15,15 @@ int main() return 0; } + +// added to test cpp-linter-action#501 (temporary) +int addNumbers(int a, int b) +{ + int* unused = NULL; + if (a > b) + return a + b; + return b + a; +} + +// second round (temporary) +int subtract(int x, int y) { return x - y; } From f61e5ee003f9132b996456f08e4c4cdbb87dcbb3 Mon Sep 17 00:00:00 2001 From: Xianpeng Shen <3353385+shenxianpeng@users.noreply.github.com> Date: Sun, 25 Oct 2026 15:43:28 +0000 Subject: [PATCH 2/3] test: round 2, badly formatted code for format review and auto-fix --- .github/workflows/test-action-pr501-r2.yml | 3 +-- src/demo.cpp | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-action-pr501-r2.yml b/.github/workflows/test-action-pr501-r2.yml index 857d0d4..f386e5a 100644 --- a/.github/workflows/test-action-pr501-r2.yml +++ b/.github/workflows/test-action-pr501-r2.yml @@ -3,8 +3,7 @@ name: test action#501 (1.15.1 + clang-tools 2.0.0) on: - push: - branches: [claude/project-thread-nfsfml] + # round 2: pull_request only (the push matrix already ran on 2a0076d) pull_request: branches: [master] diff --git a/src/demo.cpp b/src/demo.cpp index d177457..96b5f35 100644 --- a/src/demo.cpp +++ b/src/demo.cpp @@ -27,3 +27,6 @@ int addNumbers(int a, int b) // second round (temporary) int subtract(int x, int y) { return x - y; } + +// round 2: badly formatted on purpose (temporary) +int multiply( int x,int y ){return x*y;} From 6be4fe1d0e29c5ad0ab54add27c9b40d6e400141 Mon Sep 17 00:00:00 2001 From: shenxianpeng <3353385+shenxianpeng@users.noreply.github.com> Date: Sun, 25 Oct 2026 16:08:34 +0000 Subject: [PATCH 3/3] style: apply clang-format fixes --- src/demo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/demo.cpp b/src/demo.cpp index 96b5f35..4ca436b 100644 --- a/src/demo.cpp +++ b/src/demo.cpp @@ -29,4 +29,4 @@ int addNumbers(int a, int b) int subtract(int x, int y) { return x - y; } // round 2: badly formatted on purpose (temporary) -int multiply( int x,int y ){return x*y;} +int multiply(int x, int y) { return x * y; }