From 5af08ec7af136e9ed0e481d8633d3e5e9acd8a85 Mon Sep 17 00:00:00 2001 From: kminoda <44218668+kminoda@users.noreply.github.com> Date: Tue, 4 Jun 2024 10:08:57 +0900 Subject: [PATCH 1/8] ci: add cppcheck (#32) Signed-off-by: kminoda --- .github/workflows/cpp-check.yaml | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/cpp-check.yaml diff --git a/.github/workflows/cpp-check.yaml b/.github/workflows/cpp-check.yaml new file mode 100644 index 0000000000000..4864e3baebf3c --- /dev/null +++ b/.github/workflows/cpp-check.yaml @@ -0,0 +1,41 @@ +name: cppcheck + +on: + pull_request: + +jobs: + cppcheck: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install Cppcheck + run: sudo apt-get install -y cppcheck + + - name: Run Cppcheck + run: cppcheck --enable=warning,style,performance --error-exitcode=1 . + + - name: Upload Cppcheck Report + if: failure() + uses: actions/upload-artifact@v2 + with: + name: cppcheck-report + path: cppcheck-report.xml + + - name: Post results as comment + if: failure() + uses: actions/github-script@v6 + with: + script: | + const fs = require('fs'); + const path = 'cppcheck-report.xml'; + const report = fs.readFileSync(path, { encoding: 'utf8' }); + const comment = `Cppcheck Analysis:\n\n\`\`\`xml\n${report}\n\`\`\``; + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: comment + }); \ No newline at end of file From 8e4b0a1898519904d3f98937eedb8b546a10af18 Mon Sep 17 00:00:00 2001 From: kminoda <44218668+kminoda@users.noreply.github.com> Date: Tue, 4 Jun 2024 10:15:22 +0900 Subject: [PATCH 2/8] Ci/add cpp check (#34) * ci: add cppcheck Signed-off-by: kminoda * apply to fixed file Signed-off-by: kminoda --------- Signed-off-by: kminoda --- .github/workflows/cpp-check.yaml | 38 ++++++++++++-------------------- 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/.github/workflows/cpp-check.yaml b/.github/workflows/cpp-check.yaml index 4864e3baebf3c..49b1ed2c60231 100644 --- a/.github/workflows/cpp-check.yaml +++ b/.github/workflows/cpp-check.yaml @@ -14,28 +14,18 @@ jobs: - name: Install Cppcheck run: sudo apt-get install -y cppcheck - - name: Run Cppcheck - run: cppcheck --enable=warning,style,performance --error-exitcode=1 . + - name: Get changed files + id: changed-files + run: | + git fetch origin ${{ github.base_ref }} --depth=1 + git diff --name-only ${{ github.base_ref }} ${{ github.head_ref }} > changed_files.txt + cat changed_files.txt - - name: Upload Cppcheck Report - if: failure() - uses: actions/upload-artifact@v2 - with: - name: cppcheck-report - path: cppcheck-report.xml - - - name: Post results as comment - if: failure() - uses: actions/github-script@v6 - with: - script: | - const fs = require('fs'); - const path = 'cppcheck-report.xml'; - const report = fs.readFileSync(path, { encoding: 'utf8' }); - const comment = `Cppcheck Analysis:\n\n\`\`\`xml\n${report}\n\`\`\``; - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: comment - }); \ No newline at end of file + - name: Run Cppcheck on changed files + run: | + files=$(cat changed_files.txt | grep '\.cpp$\|\.h$' | tr '\n' ' ') + if [ -n "$files" ]; then + cppcheck --enable=warning,style,performance --error-exitcode=1 $files + else + echo "No C++ files changed." + shell: bash From ab6ea2ad70c6b206c9e9ac7d0a997d043770865d Mon Sep 17 00:00:00 2001 From: kminoda <44218668+kminoda@users.noreply.github.com> Date: Tue, 4 Jun 2024 10:22:53 +0900 Subject: [PATCH 3/8] Ci/add cpp check (#35) * ci: add cppcheck Signed-off-by: kminoda * apply to fixed file Signed-off-by: kminoda --------- Signed-off-by: kminoda From 89d0b69e94f1363f4f67256d9f48af9a5f3b727b Mon Sep 17 00:00:00 2001 From: kminoda <44218668+kminoda@users.noreply.github.com> Date: Tue, 4 Jun 2024 10:24:04 +0900 Subject: [PATCH 4/8] Ci/add cpp check (#36) * ci: add cppcheck Signed-off-by: kminoda * apply to fixed file Signed-off-by: kminoda * fix Signed-off-by: kminoda --------- Signed-off-by: kminoda --- .github/workflows/cpp-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cpp-check.yaml b/.github/workflows/cpp-check.yaml index 49b1ed2c60231..e8b9167a55895 100644 --- a/.github/workflows/cpp-check.yaml +++ b/.github/workflows/cpp-check.yaml @@ -18,7 +18,7 @@ jobs: id: changed-files run: | git fetch origin ${{ github.base_ref }} --depth=1 - git diff --name-only ${{ github.base_ref }} ${{ github.head_ref }} > changed_files.txt + git diff --name-only origin/${{ github.base_ref }} ${{ github.head_ref }} > changed_files.txt cat changed_files.txt - name: Run Cppcheck on changed files From 67e29dcd2e3bd59349ed0b41a6fcf427c7b7fc60 Mon Sep 17 00:00:00 2001 From: kminoda Date: Tue, 4 Jun 2024 11:16:55 +0900 Subject: [PATCH 5/8] fix hoge Signed-off-by: kminoda --- perception/lidar_centerpoint/lib/centerpoint_trt.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/perception/lidar_centerpoint/lib/centerpoint_trt.cpp b/perception/lidar_centerpoint/lib/centerpoint_trt.cpp index 2804e172b73fa..b5dd181c179f5 100644 --- a/perception/lidar_centerpoint/lib/centerpoint_trt.cpp +++ b/perception/lidar_centerpoint/lib/centerpoint_trt.cpp @@ -86,6 +86,9 @@ void CenterPointTRT::initPtr() // host points_.resize(CAPACITY_POINT * config_.point_feature_size_); + int hoge = 2; + void(hoge); + // device voxels_d_ = cuda::make_unique(voxels_size_); coordinates_d_ = cuda::make_unique(coordinates_size_); From 935b3418d6a62cdaac2dcf4f1602ca011e85ba53 Mon Sep 17 00:00:00 2001 From: kminoda <44218668+kminoda@users.noreply.github.com> Date: Tue, 4 Jun 2024 11:22:02 +0900 Subject: [PATCH 6/8] Ci/add cpp check (#38) * ci: add cppcheck Signed-off-by: kminoda * apply to fixed file Signed-off-by: kminoda * fix Signed-off-by: kminoda * add rev-list Signed-off-by: kminoda --------- Signed-off-by: kminoda --- .github/workflows/cpp-check.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cpp-check.yaml b/.github/workflows/cpp-check.yaml index e8b9167a55895..0edbfd9fc5e74 100644 --- a/.github/workflows/cpp-check.yaml +++ b/.github/workflows/cpp-check.yaml @@ -17,6 +17,7 @@ jobs: - name: Get changed files id: changed-files run: | + git rev-list --count origin/main..$(git branch --show-current) git fetch origin ${{ github.base_ref }} --depth=1 git diff --name-only origin/${{ github.base_ref }} ${{ github.head_ref }} > changed_files.txt cat changed_files.txt From 6dfaa0f3db0d6a634d3a4da1057637a38064a82f Mon Sep 17 00:00:00 2001 From: kminoda Date: Tue, 4 Jun 2024 11:37:15 +0900 Subject: [PATCH 7/8] fix Signed-off-by: kminoda --- .github/workflows/cpp-check.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cpp-check.yaml b/.github/workflows/cpp-check.yaml index ddff7e001abde..1b8de597812d6 100644 --- a/.github/workflows/cpp-check.yaml +++ b/.github/workflows/cpp-check.yaml @@ -17,6 +17,7 @@ jobs: - name: Get changed files id: changed-files run: | + echo ${{ github.base_ref }} ${{ github.head_ref }} git fetch origin ${{ github.base_ref }} --depth=1 git diff --name-only origin/${{ github.base_ref }} ${{ github.head_ref }} > changed_files.txt cat changed_files.txt From d00a16f2b46e105cbbd7dc58edc716f2a7dfdaad Mon Sep 17 00:00:00 2001 From: kminoda Date: Tue, 4 Jun 2024 11:44:00 +0900 Subject: [PATCH 8/8] fix Signed-off-by: kminoda --- .github/workflows/cpp-check.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cpp-check.yaml b/.github/workflows/cpp-check.yaml index 1b8de597812d6..e6c6df61fa1f1 100644 --- a/.github/workflows/cpp-check.yaml +++ b/.github/workflows/cpp-check.yaml @@ -9,7 +9,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v1 + uses: actions/checkout@v2 - name: Install Cppcheck run: sudo apt-get install -y cppcheck @@ -19,6 +19,7 @@ jobs: run: | echo ${{ github.base_ref }} ${{ github.head_ref }} git fetch origin ${{ github.base_ref }} --depth=1 + git fetch origin ${{ github.head_ref }} --depth=1 git diff --name-only origin/${{ github.base_ref }} ${{ github.head_ref }} > changed_files.txt cat changed_files.txt