-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* get cppcheck suppressions file Signed-off-by: ISP akm <[email protected]> * change NOLINT->cppcheck-suppress Signed-off-by: ISP akm <[email protected]> * NOLINT->cppcheck-suppress Signed-off-by: ISP akm <[email protected]> * add cppcheck-all-files and remove clang-tidy-differential Signed-off-by: ISP akm <[email protected]> * add NOLINT Signed-off-by: ISP akm <[email protected]> * move suppression comments Signed-off-by: ISP akm <[email protected]> * move suppression comments Signed-off-by: ISP akm <[email protected]> * move suppression comments Signed-off-by: ISP akm <[email protected]> * move suppression comments Signed-off-by: ISP akm <[email protected]> * move suppression comments Signed-off-by: ISP akm <[email protected]> * move suppression comments Signed-off-by: ISP akm <[email protected]> * Update cppcheck-differential.yaml * Update trace_node.cpp * temporary change Signed-off-by: ISP akm <[email protected]> * change .cppcheck-suppressions download timing Signed-off-by: ISP akm <[email protected]> * add LF to build-and-test-differential.yaml Signed-off-by: ISP akm <[email protected]> * ci(pre-commit): autofix * modify cppcheck-differential Signed-off-by: ISP akm <[email protected]> * formatting cppcheck-differential Signed-off-by: ISP akm <[email protected]> * modify cppcheck-differential Signed-off-by: ISP akm <[email protected]> * add install snapd Signed-off-by: ISP akm <[email protected]> * fix workflow version Signed-off-by: ISP akm <[email protected]> * cppcheck is installed via apt-get Signed-off-by: ISP akm <[email protected]> * remove snapd and ros2 container Signed-off-by: ISP akm <[email protected]> * fix files variable setting Signed-off-by: ISP akm <[email protected]> * fix files variable setting Signed-off-by: ISP akm <[email protected]> * restore clang-tidy-differential Signed-off-by: ISP akm <[email protected]> --------- Signed-off-by: ISP akm <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
0bf777d
commit 8358563
Showing
7 changed files
with
161 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: cppcheck-all-files | ||
|
||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
cppcheck-all-files: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y wget | ||
# cppcheck from apt does not yet support --check-level args, and thus install from snap | ||
- name: Install Cppcheck from snap | ||
run: | | ||
sudo snap install cppcheck | ||
# Download the cppcheck suppression file | ||
- name: Download cppcheck suppression file | ||
run: | | ||
wget https://raw.githubusercontent.com/autowarefoundation/autoware.universe/main/.cppcheck_suppressions -O .cppcheck_suppressions | ||
- name: Get all C++ files | ||
id: all-files | ||
run: | | ||
find . -type f \( -name "*.cpp" -o -name "*.hpp" \) > all_files.txt | ||
cat all_files.txt | ||
- name: Run Cppcheck on all files | ||
continue-on-error: true | ||
id: cppcheck | ||
run: | | ||
files=$(cat all_files.txt) | ||
if [ -n "$files" ]; then | ||
echo "Running Cppcheck on all files: $files" | ||
cppcheck --inline-suppr --enable=all --inconclusive --check-level=exhaustive --error-exitcode=1 --suppressions-list=.cppcheck_suppressions $files 2> cppcheck-report.txt | ||
else | ||
echo "No C++ files found." | ||
touch cppcheck-report.txt | ||
fi | ||
shell: bash | ||
|
||
- name: Show cppcheck-report result | ||
run: | | ||
cat cppcheck-report.txt | ||
- name: Upload Cppcheck report | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: cppcheck-report | ||
path: cppcheck-report.txt | ||
|
||
- name: Fail the job if Cppcheck failed | ||
if: ${{ steps.cppcheck.outcome == 'failure' }} | ||
run: exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
name: cppcheck-differential | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
cppcheck-differential: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y wget | ||
# cppcheck from apt does not yet support --check-level args, and thus install from snap | ||
- name: Install Cppcheck from snap | ||
run: | | ||
sudo snap install cppcheck | ||
# Download the cppcheck suppression file | ||
- name: Download cppcheck suppression file | ||
run: | | ||
wget https://raw.githubusercontent.com/autowarefoundation/autoware.universe/main/.cppcheck_suppressions -O .cppcheck_suppressions | ||
- name: Remove exec_depend | ||
uses: autowarefoundation/autoware-github-actions/remove-exec-depend@v1 | ||
|
||
- name: Get modified packages | ||
id: get-modified-packages | ||
uses: autowarefoundation/autoware-github-actions/get-modified-packages@v1 | ||
|
||
# Display the modified packages | ||
- name: Show modified packages | ||
run: | | ||
echo "Modified packages:" | ||
echo "${{ steps.get-modified-packages.outputs.modified_packages }}" | ||
- name: Get modified files | ||
id: get-modified-files | ||
uses: tj-actions/changed-files@v44 | ||
with: | ||
files: | | ||
**/*.cpp | ||
**/*.hpp | ||
# Display the modified files | ||
- name: Show modified files | ||
run: | | ||
echo "Modified files:" | ||
echo "${{ steps.get-modified-files.outputs.all_changed_files }}" | ||
- name: Run Cppcheck on changed files | ||
continue-on-error: true | ||
id: cppcheck | ||
run: | | ||
files=$(echo ${{ steps.get-modified-files.outputs.all_changed_files }}) | ||
if [ -n "$files" ]; then | ||
echo "Running Cppcheck on changed files: $files" | ||
cppcheck --inline-suppr --enable=all --inconclusive --check-level=exhaustive --error-exitcode=1 --suppressions-list=.cppcheck_suppressions $files 2> cppcheck-report.txt | ||
else | ||
echo "No C++ files changed." | ||
touch cppcheck-report.txt | ||
fi | ||
shell: bash | ||
|
||
- name: Show cppcheck-report result | ||
run: | | ||
cat cppcheck-report.txt | ||
- name: Upload Cppcheck report | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: cppcheck-report | ||
path: cppcheck-report.txt | ||
|
||
- name: Fail the job if Cppcheck failed | ||
if: steps.cppcheck.outcome == 'failure' | ||
run: exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters