-
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.
add cppcheck-all-files and remove clang-tidy-differential
Signed-off-by: ISP akm <[email protected]>
- Loading branch information
Showing
2 changed files
with
70 additions
and
36 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
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,69 @@ | ||
name: cppcheck-all-files | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
cppcheck-full: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y build-essential cmake git libpcre3-dev wget | ||
# cppcheck from apt does not yet support --check-level args, and thus install from source | ||
- name: Install Cppcheck from source | ||
run: | | ||
mkdir /tmp/cppcheck | ||
git clone https://github.com/danmar/cppcheck.git /tmp/cppcheck | ||
cd /tmp/cppcheck | ||
git checkout 2.14.1 | ||
mkdir build | ||
cd build | ||
cmake .. | ||
make -j $(nproc) | ||
sudo make install | ||
# 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 |