Skip to content

Commit 7bbec06

Browse files
committed
2 parents 1f9bb76 + e5ccec0 commit 7bbec06

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+754
-359
lines changed

.clang-tidy

Lines changed: 68 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
Checks: >
22
bugprone-*,
3-
clang-diagnostic-*,
3+
cert-dcl50-cpp,
4+
cert-dcl58-cpp,
5+
cert-env33-c,
6+
cert-err34-c,
7+
cert-err52-cpp,
8+
cert-err60-cpp,
9+
cert-flp30-c,
10+
cert-mem57-cpp,
11+
cert-msc50-cpp,
12+
cert-msc51-cpp,
13+
cert-oop57-cpp,
14+
cert-oop58-cpp,
415
concurrency-*,
516
cppcoreguidelines-*,
17+
google-*,
618
llvm-include-order,
719
llvm-namespace-comment,
820
misc-*,
@@ -25,67 +37,68 @@ Checks: >
2537
-misc-non-private-member-variables-in-classes,
2638
-modernize-avoid-c-arrays,
2739
-modernize-use-trailing-return-type,
40+
-portability-avoid-pragma-once,
2841
-portability-template-virtual-member-function,
2942
-readability-magic-numbers
3043
3144
WarningsAsErrors: "*"
3245
HeaderFilterRegex: '.*/(modules|tasks)/.*'
3346

3447
CheckOptions:
35-
- key: readability-identifier-naming.ClassCase
36-
value: CamelCase
37-
- key: readability-identifier-naming.ClassMemberCase
38-
value: lower_case
39-
- key: readability-identifier-naming.ConstexprVariableCase
40-
value: CamelCase
41-
- key: readability-identifier-naming.ConstexprVariablePrefix
42-
value: k
43-
- key: readability-identifier-naming.EnumCase
44-
value: CamelCase
45-
- key: readability-identifier-naming.EnumConstantCase
46-
value: CamelCase
47-
- key: readability-identifier-naming.EnumConstantPrefix
48-
value: k
49-
- key: readability-identifier-naming.FunctionCase
50-
value: CamelCase
51-
- key: readability-identifier-naming.GlobalConstantCase
52-
value: CamelCase
53-
- key: readability-identifier-naming.GlobalConstantPrefix
54-
value: k
55-
- key: readability-identifier-naming.StaticConstantCase
56-
value: CamelCase
57-
- key: readability-identifier-naming.StaticConstantPrefix
58-
value: k
59-
- key: readability-identifier-naming.StaticVariableCase
60-
value: lower_case
61-
- key: readability-identifier-naming.MacroDefinitionCase
62-
value: UPPER_CASE
63-
- key: readability-identifier-naming.MacroDefinitionIgnoredRegexp
64-
value: '^[A-Z]+(_[A-Z]+)*_$'
65-
- key: readability-identifier-naming.MemberCase
66-
value: lower_case
67-
- key: readability-identifier-naming.PrivateMemberSuffix
68-
value: _
69-
- key: readability-identifier-naming.PublicMemberSuffix
70-
value: ''
71-
- key: readability-identifier-naming.NamespaceCase
72-
value: lower_case
73-
- key: readability-identifier-naming.ParameterCase
74-
value: lower_case
75-
- key: readability-identifier-naming.TypeAliasCase
76-
value: CamelCase
77-
- key: readability-identifier-naming.TypedefCase
78-
value: CamelCase
79-
- key: readability-identifier-naming.VariableCase
80-
value: lower_case
81-
- key: readability-identifier-naming.IgnoreMainLikeFunctions
82-
value: 1
48+
- key: readability-identifier-naming.ClassCase
49+
value: CamelCase
50+
- key: readability-identifier-naming.ClassMemberCase
51+
value: lower_case
52+
- key: readability-identifier-naming.ConstexprVariableCase
53+
value: CamelCase
54+
- key: readability-identifier-naming.ConstexprVariablePrefix
55+
value: k
56+
- key: readability-identifier-naming.EnumCase
57+
value: CamelCase
58+
- key: readability-identifier-naming.EnumConstantCase
59+
value: CamelCase
60+
- key: readability-identifier-naming.EnumConstantPrefix
61+
value: k
62+
- key: readability-identifier-naming.FunctionCase
63+
value: CamelCase
64+
- key: readability-identifier-naming.GlobalConstantCase
65+
value: CamelCase
66+
- key: readability-identifier-naming.GlobalConstantPrefix
67+
value: k
68+
- key: readability-identifier-naming.StaticConstantCase
69+
value: CamelCase
70+
- key: readability-identifier-naming.StaticConstantPrefix
71+
value: k
72+
- key: readability-identifier-naming.StaticVariableCase
73+
value: lower_case
74+
- key: readability-identifier-naming.MacroDefinitionCase
75+
value: UPPER_CASE
76+
- key: readability-identifier-naming.MacroDefinitionIgnoredRegexp
77+
value: '^[A-Z]+(_[A-Z]+)*_$'
78+
- key: readability-identifier-naming.MemberCase
79+
value: lower_case
80+
- key: readability-identifier-naming.PrivateMemberSuffix
81+
value: _
82+
- key: readability-identifier-naming.PublicMemberSuffix
83+
value: ''
84+
- key: readability-identifier-naming.NamespaceCase
85+
value: lower_case
86+
- key: readability-identifier-naming.ParameterCase
87+
value: lower_case
88+
- key: readability-identifier-naming.TypeAliasCase
89+
value: CamelCase
90+
- key: readability-identifier-naming.TypedefCase
91+
value: CamelCase
92+
- key: readability-identifier-naming.VariableCase
93+
value: lower_case
94+
- key: readability-identifier-naming.IgnoreMainLikeFunctions
95+
value: 1
8396
# Functions with scores beyond 15 are typically flagged as potentially problematic (empirically)
84-
- key: readability-function-cognitive-complexity.Threshold
85-
value: 15 # default: 25
86-
- key: readability-identifier-length.MinimumVariableNameLength
87-
value: 1
88-
- key: readability-identifier-length.MinimumParameterNameLength
89-
value: 1
97+
- key: readability-function-cognitive-complexity.Threshold
98+
value: 15 # default: 25
99+
- key: readability-identifier-length.MinimumVariableNameLength
100+
value: 1
101+
- key: readability-identifier-length.MinimumParameterNameLength
102+
value: 1
90103
- key: misc-include-cleaner.IgnoreHeaders
91104
value: '(__chrono/.*|stdlib\.h|3rdparty/.*)'

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Parallel Programming Course",
3-
"image": "ghcr.io/learning-process/ppc-ubuntu:latest",
3+
"image": "ghcr.io/learning-process/ppc-ubuntu:1.1",
44
"customizations": {
55
"vscode": {
66
"extensions": [
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: 'Native Clang-Tidy Analysis'
2+
description: 'Run clang-tidy analysis without Docker'
3+
inputs:
4+
build_dir:
5+
description: 'Build directory for CMake'
6+
required: false
7+
default: 'build'
8+
exclude:
9+
description: 'Directories to exclude from analysis (space-separated)'
10+
required: false
11+
default: '3rdparty'
12+
clang_tidy_version:
13+
description: 'Clang-tidy version to use'
14+
required: false
15+
default: '21'
16+
outputs:
17+
total_comments:
18+
description: 'Total number of clang-tidy issues found'
19+
value: ${{ steps.analyze.outputs.total_comments }}
20+
runs:
21+
using: 'composite'
22+
steps:
23+
- name: Verify clang-tidy installation
24+
shell: bash
25+
run: |
26+
clang-tidy-${{ inputs.clang_tidy_version }} --version
27+
28+
- name: Get changed files
29+
id: changed-files
30+
shell: bash
31+
run: |
32+
git config --global --add safe.directory $GITHUB_WORKSPACE
33+
git fetch origin ${{ github.event.pull_request.base.ref }}
34+
35+
# Check if .clang-tidy files were changed
36+
CLANG_TIDY_CHANGED=$(git diff --name-only \
37+
origin/${{ github.event.pull_request.base.ref }}...HEAD \
38+
-- '**/.clang-tidy' || true)
39+
40+
if [ -n "$CLANG_TIDY_CHANGED" ]; then
41+
echo "::notice::.clang-tidy configuration changed, analyzing all source files"
42+
# Find all source files in the repository (excluding specified directories)
43+
CHANGED_FILES=$(find . -name "*.cpp" -o -name "*.hpp" -o -name "*.c" -o -name "*.h")
44+
# Filter out excluded directories
45+
for exclude_dir in ${{ inputs.exclude }}; do
46+
CHANGED_FILES=$(echo "$CHANGED_FILES" | grep -v "^./${exclude_dir}/" || true)
47+
done
48+
else
49+
# Only analyze changed source files
50+
CHANGED_FILES=$(git diff --name-only \
51+
origin/${{ github.event.pull_request.base.ref }}...HEAD \
52+
-- '*.cpp' '*.hpp' '*.c' '*.h')
53+
# Filter out excluded directories
54+
for exclude_dir in ${{ inputs.exclude }}; do
55+
CHANGED_FILES=$(echo "$CHANGED_FILES" | grep -v "^${exclude_dir}/" || true)
56+
done
57+
fi
58+
59+
echo "changed_files<<EOF" >> $GITHUB_OUTPUT
60+
echo "$CHANGED_FILES" >> $GITHUB_OUTPUT
61+
echo "EOF" >> $GITHUB_OUTPUT
62+
63+
if [ -z "$CHANGED_FILES" ]; then
64+
echo "has_changes=false" >> $GITHUB_OUTPUT
65+
else
66+
echo "has_changes=true" >> $GITHUB_OUTPUT
67+
fi
68+
69+
- name: Run clang-tidy analysis
70+
id: analyze
71+
shell: bash
72+
if: steps.changed-files.outputs.has_changes == 'true'
73+
run: |
74+
COMMENTS_FILE=$(mktemp)
75+
TOTAL_ISSUES=0
76+
77+
while IFS= read -r file; do
78+
if [ -n "$file" ] && [ -f "$file" ]; then
79+
echo "Analyzing $file..."
80+
FILE_OUTPUT=$(mktemp)
81+
if clang-tidy-${{ inputs.clang_tidy_version }} "$file" \
82+
-p ${{ inputs.build_dir }} --format-style=file 2>&1 | \
83+
tee "$FILE_OUTPUT"; then
84+
ISSUES=$(grep -c "warning:\|error:" "$FILE_OUTPUT" 2>/dev/null || echo "0")
85+
ISSUES=$(echo "$ISSUES" | tr -d '[:space:]')
86+
TOTAL_ISSUES=$((TOTAL_ISSUES + ${ISSUES:-0}))
87+
cat "$FILE_OUTPUT" >> "$COMMENTS_FILE"
88+
else
89+
echo "::error::Failed to analyze $file"
90+
TOTAL_ISSUES=$((TOTAL_ISSUES + 1))
91+
fi
92+
rm -f "$FILE_OUTPUT"
93+
fi
94+
done <<< "${{ steps.changed-files.outputs.changed_files }}"
95+
96+
echo "total_comments=$TOTAL_ISSUES" >> $GITHUB_OUTPUT
97+
98+
if [ -f "$COMMENTS_FILE" ] && [ -s "$COMMENTS_FILE" ]; then
99+
echo "::group::Clang-tidy Analysis Results"
100+
cat "$COMMENTS_FILE"
101+
echo "::endgroup::"
102+
fi
103+
104+
if [ "$TOTAL_ISSUES" -gt 0 ]; then
105+
echo "::error::Found $TOTAL_ISSUES clang-tidy issues"
106+
else
107+
echo "No clang-tidy issues found"
108+
fi
109+
110+
- name: Set output for no changes
111+
shell: bash
112+
if: steps.changed-files.outputs.has_changes == 'false'
113+
run: |
114+
echo "total_comments=0" >> $GITHUB_OUTPUT

.github/workflows/codeql.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- cpp
2121
- python
2222
steps:
23-
- uses: actions/checkout@v4
23+
- uses: actions/checkout@v5
2424
with:
2525
submodules: recursive
2626
- name: Setup environment
@@ -42,17 +42,19 @@ jobs:
4242
if: matrix.language == 'cpp'
4343
run: >
4444
cmake -S . -B build -G Ninja
45-
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
4645
-D CMAKE_BUILD_TYPE=RELEASE
4746
env:
4847
CC: gcc-14
4948
CXX: g++-14
5049
- name: Build project
5150
if: matrix.language == 'cpp'
5251
run: |
53-
cmake --build build --parallel
52+
cmake --build build --parallel -- --quiet
5453
env:
5554
CC: gcc-14
5655
CXX: g++-14
56+
- name: Show ccache stats
57+
if: matrix.language == 'cpp'
58+
run: ccache --show-stats
5759
- name: Perform CodeQL Analysis
5860
uses: github/codeql-action/analyze@v3

.github/workflows/docker.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ jobs:
1919
build-and-push:
2020
name: Build & Push Docker Image
2121
runs-on: ubuntu-latest
22+
if: github.repository == 'learning-process/parallel_programming_course'
2223

2324
steps:
2425
- name: Check out code
25-
uses: actions/checkout@v4
26+
uses: actions/checkout@v5
2627

2728
- name: Set up QEMU
2829
uses: docker/setup-qemu-action@v3
@@ -47,4 +48,4 @@ jobs:
4748
file: ./docker/ubuntu.Dockerfile
4849
platforms: linux/amd64,linux/arm64
4950
push: ${{ github.ref == 'refs/heads/master' }}
50-
tags: ghcr.io/learning-process/ppc-ubuntu:latest
51+
tags: ghcr.io/learning-process/ppc-ubuntu:1.1

.github/workflows/labeler.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,8 @@ jobs:
1111
issues: write
1212
pull-requests: write
1313
steps:
14-
- name: Check out repository
15-
uses: actions/checkout@v4
16-
with:
17-
fetch-depth: 0
1814
- name: Apply labels based on changed files
19-
uses: actions/labeler@v5
15+
uses: actions/labeler@v6
2016
with:
2117
repo-token: "${{ secrets.GITHUB_TOKEN }}"
2218
configuration-path: ".github/labeler.yml"

0 commit comments

Comments
 (0)