From cdf9d9907859c953bcf83ae2e6ef4602f6beda6e Mon Sep 17 00:00:00 2001 From: kminoda <44218668+kminoda@users.noreply.github.com> Date: Tue, 4 Jun 2024 11:26:10 +0900 Subject: [PATCH] Ci/add cpp check (#39) * ci: add cppcheck Signed-off-by: kminoda * ci: add cppcheck (#32) Signed-off-by: kminoda * apply to fixed file Signed-off-by: kminoda * Ci/add cpp check (#34) * ci: add cppcheck Signed-off-by: kminoda * apply to fixed file Signed-off-by: kminoda --------- Signed-off-by: kminoda * fix Signed-off-by: kminoda * Ci/add cpp check (#35) * ci: add cppcheck Signed-off-by: kminoda * apply to fixed file Signed-off-by: kminoda --------- Signed-off-by: kminoda * add rev-list Signed-off-by: kminoda * fix Signed-off-by: kminoda --------- Signed-off-by: kminoda --- .github/workflows/cpp-check.yaml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 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..ddff7e001abde --- /dev/null +++ b/.github/workflows/cpp-check.yaml @@ -0,0 +1,31 @@ +name: cppcheck + +on: + pull_request: + +jobs: + cppcheck: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v1 + + - name: Install Cppcheck + run: sudo apt-get install -y cppcheck + + - name: Get changed files + id: changed-files + run: | + 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 + + - 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