From 0b9da6de5bb8e9c9361db36338b3f639c5ec90cb Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Fri, 5 Jun 2026 00:03:17 +0200 Subject: [PATCH 1/2] [CI] Switch to use separate clang-tidy action --- .github/actions/clang-tidy-native/action.yml | 114 ------------------- .github/workflows/static-analysis-pr.yml | 4 +- 2 files changed, 2 insertions(+), 116 deletions(-) delete mode 100644 .github/actions/clang-tidy-native/action.yml diff --git a/.github/actions/clang-tidy-native/action.yml b/.github/actions/clang-tidy-native/action.yml deleted file mode 100644 index 37a6ef8b..00000000 --- a/.github/actions/clang-tidy-native/action.yml +++ /dev/null @@ -1,114 +0,0 @@ -name: 'Native Clang-Tidy Analysis' -description: 'Run clang-tidy analysis without Docker' -inputs: - build_dir: - description: 'Build directory for CMake' - required: false - default: 'build' - exclude: - description: 'Directories to exclude from analysis (space-separated)' - required: false - default: '3rdparty' - clang_tidy_version: - description: 'Clang-tidy version to use' - required: false - default: '22' -outputs: - total_comments: - description: 'Total number of clang-tidy issues found' - value: ${{ steps.analyze.outputs.total_comments }} -runs: - using: 'composite' - steps: - - name: Verify clang-tidy installation - shell: bash - run: | - clang-tidy-${{ inputs.clang_tidy_version }} --version - - - name: Get changed files - id: changed-files - shell: bash - run: | - git config --global --add safe.directory $GITHUB_WORKSPACE - git fetch origin ${{ github.event.pull_request.base.ref }} - - # Check if .clang-tidy files were changed - CLANG_TIDY_CHANGED=$(git diff --name-only \ - origin/${{ github.event.pull_request.base.ref }}...HEAD \ - -- '**/.clang-tidy' || true) - - if [ -n "$CLANG_TIDY_CHANGED" ]; then - echo "::notice::.clang-tidy configuration changed, analyzing all source files" - # Find all source files in the repository (excluding specified directories) - CHANGED_FILES=$(find . -name "*.cpp" -o -name "*.hpp" -o -name "*.c" -o -name "*.h") - # Filter out excluded directories - for exclude_dir in ${{ inputs.exclude }}; do - CHANGED_FILES=$(echo "$CHANGED_FILES" | grep -v "^./${exclude_dir}/" || true) - done - else - # Only analyze changed source files - CHANGED_FILES=$(git diff --name-only \ - origin/${{ github.event.pull_request.base.ref }}...HEAD \ - -- '*.cpp' '*.hpp' '*.c' '*.h') - # Filter out excluded directories - for exclude_dir in ${{ inputs.exclude }}; do - CHANGED_FILES=$(echo "$CHANGED_FILES" | grep -v "^${exclude_dir}/" || true) - done - fi - - echo "changed_files<> $GITHUB_OUTPUT - echo "$CHANGED_FILES" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - - if [ -z "$CHANGED_FILES" ]; then - echo "has_changes=false" >> $GITHUB_OUTPUT - else - echo "has_changes=true" >> $GITHUB_OUTPUT - fi - - - name: Run clang-tidy analysis - id: analyze - shell: bash - if: steps.changed-files.outputs.has_changes == 'true' - run: | - COMMENTS_FILE=$(mktemp) - TOTAL_ISSUES=0 - - while IFS= read -r file; do - if [ -n "$file" ] && [ -f "$file" ]; then - echo "Analyzing $file..." - FILE_OUTPUT=$(mktemp) - if clang-tidy-${{ inputs.clang_tidy_version }} "$file" \ - -p ${{ inputs.build_dir }} --format-style=file 2>&1 | \ - tee "$FILE_OUTPUT"; then - ISSUES=$(grep -c "warning:\|error:" "$FILE_OUTPUT" 2>/dev/null || echo "0") - ISSUES=$(echo "$ISSUES" | tr -d '[:space:]') - TOTAL_ISSUES=$((TOTAL_ISSUES + ${ISSUES:-0})) - cat "$FILE_OUTPUT" >> "$COMMENTS_FILE" - else - echo "::error::Failed to analyze $file" - TOTAL_ISSUES=$((TOTAL_ISSUES + 1)) - fi - rm -f "$FILE_OUTPUT" - fi - done <<< "${{ steps.changed-files.outputs.changed_files }}" - - echo "total_comments=$TOTAL_ISSUES" >> $GITHUB_OUTPUT - - if [ -f "$COMMENTS_FILE" ] && [ -s "$COMMENTS_FILE" ]; then - echo "::group::Clang-tidy Analysis Results" - cat "$COMMENTS_FILE" - echo "::endgroup::" - fi - - if [ "$TOTAL_ISSUES" -gt 0 ]; then - echo "::error::Found $TOTAL_ISSUES clang-tidy issues" - else - echo "No clang-tidy issues found" - fi - - - name: Set output for no changes - shell: bash - if: steps.changed-files.outputs.has_changes == 'false' - run: | - echo "total_comments=0" >> $GITHUB_OUTPUT diff --git a/.github/workflows/static-analysis-pr.yml b/.github/workflows/static-analysis-pr.yml index 3e788ec8..1cb30b5c 100644 --- a/.github/workflows/static-analysis-pr.yml +++ b/.github/workflows/static-analysis-pr.yml @@ -85,7 +85,7 @@ jobs: - name: Show ccache stats run: ccache --show-stats - name: Run clang-tidy - uses: ./.github/actions/clang-tidy-native + uses: aobolensk/clang-tidy-action@5455ffb02832ca62e2d56935a99d93ea01e1ac60 id: review with: exclude: "3rdparty build" @@ -136,7 +136,7 @@ jobs: - name: Show ccache stats run: ccache --show-stats - name: Run clang-tidy - uses: ./.github/actions/clang-tidy-native + uses: aobolensk/clang-tidy-action@5455ffb02832ca62e2d56935a99d93ea01e1ac60 id: review with: exclude: "3rdparty build docs_venv .git .pytest_cache .ruff_cache xml" From ac17599bc53c0fe259d8aa0e1f7a92d76f494343 Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Fri, 5 Jun 2026 05:00:00 +0200 Subject: [PATCH 2/2] use release tag --- .github/workflows/static-analysis-pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/static-analysis-pr.yml b/.github/workflows/static-analysis-pr.yml index 1cb30b5c..d9e83709 100644 --- a/.github/workflows/static-analysis-pr.yml +++ b/.github/workflows/static-analysis-pr.yml @@ -85,7 +85,7 @@ jobs: - name: Show ccache stats run: ccache --show-stats - name: Run clang-tidy - uses: aobolensk/clang-tidy-action@5455ffb02832ca62e2d56935a99d93ea01e1ac60 + uses: aobolensk/clang-tidy-action@v1 id: review with: exclude: "3rdparty build" @@ -136,7 +136,7 @@ jobs: - name: Show ccache stats run: ccache --show-stats - name: Run clang-tidy - uses: aobolensk/clang-tidy-action@5455ffb02832ca62e2d56935a99d93ea01e1ac60 + uses: aobolensk/clang-tidy-action@v1 id: review with: exclude: "3rdparty build docs_venv .git .pytest_cache .ruff_cache xml"