Skip to content

CppCheck action

CppCheck action #1605

Workflow file for this run

name: CppCheck action
on:
schedule:
- cron: "10 16 * * *"
push:
branches:
- develop
- 3.0
- main
pull_request:
branches:
- develop
- 3.0
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Step that prints name of pull request's base branch
run: |
echo "Pull request's base branch is: ${BASE_BRANCH}"
echo "Pull request's branch is: ${GITHUB_REF##*/}"
echo "Pull request's head ref is: ${GITHUB_HEAD_REF}"
env:
BASE_BRANCH: ${{ github.base_ref }}
if: github.event_name == 'pull_request'
- uses: actions/checkout@v3
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
- name: Get changed files
id: changed-files
uses: tj-actions/[email protected]
- name: List all changed files
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "$file was changed"
done
- name: Get specific changed files
id: changed-files-specific
uses: tj-actions/[email protected]
with:
files: |
src/*
inc/*
- name: Run step if any of the listed files above change
if: steps.changed-files-specific.outputs.any_changed == 'true'
run: |
echo "One or more files listed above has changed."
- name: Install packages for build taos-tools
if: |
(steps.changed-files-specific.outputs.any_changed == 'true'
&& github.event_name == 'pull_request')
|| github.event_name == 'push'
|| github.event_name == 'schedule'
run: |
sudo apt update -y > /dev/null
sudo apt install -y cppcheck
- name: Run cppcheck
if: |
(steps.changed-files-specific.outputs.any_changed == 'true'
&& github.event_name == 'pull_request')
|| github.event_name == 'push'
|| github.event_name == 'schedule'
run: |
for f in `find src inc -type f -name "*.[c,h]" ! -path "src/benchUtilDs.c"`; do cppcheck $f || exit $?; done