Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions .github/actions/clang-tidy-native/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
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'
required: false
default: '3rdparty'
clang_tidy_version:
description: 'Clang-tidy version to use'
required: false
default: '20'
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 }}
CHANGED_FILES=$(git diff --name-only \
origin/${{ github.event.pull_request.base.ref }}...HEAD \
-- '*.cpp' '*.hpp' '*.c' '*.h' | grep -v '^${{ inputs.exclude }}/' || true)
echo "changed_files<<EOF" >> $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..."
if clang-tidy-${{ inputs.clang_tidy_version }} "$file" \
-p ${{ inputs.build_dir }} --format-style=file 2>&1 | \
tee -a "$COMMENTS_FILE"; then
ISSUES=$(grep -c "warning:\|error:" "$COMMENTS_FILE" || echo "0")
TOTAL_ISSUES=$((TOTAL_ISSUES + ISSUES))
else
echo "::error::Failed to analyze $file"
TOTAL_ISSUES=$((TOTAL_ISSUES + 1))
fi
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
83 changes: 58 additions & 25 deletions .github/workflows/static-analysis-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,46 @@ concurrency:
jobs:
clang-tidy:
runs-on: ubuntu-24.04
container:
image: ghcr.io/learning-process/ppc-ubuntu:latest
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ runner.os }}-clang
- uses: ZedThree/clang-tidy-review@v0.21.0
create-symlink: true
max-size: 1G

- name: CMake configure
run: >
cmake -S . -B build -G Ninja
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
-D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
env:
CC: clang-20
CXX: clang++-20

- name: Build project
run: |
cmake --build build --parallel
env:
CC: clang-20
CXX: clang++-20

- name: Run clang-tidy
uses: ./.github/actions/clang-tidy-native
id: review
with:
build_dir: build
apt_packages: openmpi-bin,openmpi-common,libopenmpi-dev,ninja-build,libomp-19-dev,valgrind
cmake_command: >
cmake -S . -B build -G Ninja
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
-D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
exclude: 3rdparty
clang_tidy_checks: ""
split_workflow: true
clang_tidy_version: "19"
lgtm_comment_body: ""
env:
CC: clang-19
CXX: clang++-19
clang_tidy_version: "20"
- if: steps.review.outputs.total_comments > 0
run: |
echo "clang-tidy run has failed. See previous 'Run clang-tidy' stage logs"
Expand All @@ -54,28 +69,46 @@ jobs:
needs:
- clang-tidy
runs-on: ubuntu-24.04
container:
image: ghcr.io/learning-process/ppc-ubuntu:latest
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ runner.os }}-gcc
- uses: ZedThree/clang-tidy-review@v0.21.0
create-symlink: true
max-size: 1G

- name: CMake configure
run: >
cmake -S . -B build -G Ninja
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
-D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
env:
CC: gcc-14
CXX: g++-14

- name: Build project
run: |
cmake --build build --parallel
env:
CC: gcc-14
CXX: g++-14

- name: Run clang-tidy
uses: ./.github/actions/clang-tidy-native
id: review
with:
build_dir: build
apt_packages: openmpi-bin,openmpi-common,libopenmpi-dev,ninja-build,libomp-19-dev,valgrind
cmake_command: >
cmake -S . -B build -G Ninja
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
-D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
exclude: 3rdparty
clang_tidy_checks: ""
split_workflow: true
clang_tidy_version: "19"
lgtm_comment_body: ""
clang_tidy_version: "20"
- if: steps.review.outputs.total_comments > 0
run: |
echo "clang-tidy run has failed. See previous 'Run clang-tidy' stage logs"
Expand Down
8 changes: 2 additions & 6 deletions modules/task/include/task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@

#include <omp.h>

#include <algorithm>
#include <array>
#include <chrono>
#include <cstdint>
#include <cstdlib>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <memory>
Expand All @@ -18,7 +15,6 @@
#include <string>
#include <util/include/util.hpp>
#include <utility>
#include <vector>

namespace ppc::task {

Expand Down Expand Up @@ -259,8 +255,8 @@ class Task {
virtual bool PostProcessingImpl() = 0;

private:
InType input_;
OutType output_;
InType input_{};
OutType output_{};
StateOfTesting state_of_testing_ = kFunc;
TypeOfTask type_of_task_ = kUnknown;
StatusOfTask status_of_task_ = kEnabled;
Expand Down
Loading