Skip to content

Commit

Permalink
ci(checks): build cppcheck from sources
Browse files Browse the repository at this point in the history
The version of cppcheck available from the package manager tends to be
outdated. In this change we build from sources instead. We cache the
build result for faster execution.
  • Loading branch information
P403n1x87 committed Jun 4, 2023
1 parent 369b825 commit 57f360b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
40 changes: 37 additions & 3 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,50 @@ jobs:
cppcheck:
runs-on: ubuntu-20.04
name: Static code analysis
env:
cppcheck-version: 2.10.3

steps:
- uses: actions/checkout@v2

- name: Install cppcheck
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get -y install libpcre3-dev
- name: Restore cppcheck build
id: cppcheck-build-restore
uses: actions/cache/restore@v3
with:
path: |
${{ github.workspace }}/cppcheck
key: ${{ runner.os }}-cppcheck-${{ env.cppcheck-version }}

- name: Check out cppcheck
uses: actions/checkout@v2
with:
repository: danmar/cppcheck
ref: ${{ env.cppcheck-version }}
path: ${{ github.workspace }}/cppcheck

- name: Compile cppcheck
run: |
sudo apt-get update
sudo apt-get -y install cppcheck
sudo apt-get -y install libpcre3-dev
cd cppcheck
make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck HAVE_RULES=yes CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function"
cd -
- name: Save cppcheck build
id: cppcheck-build-save
uses: actions/cache/save@v3
with:
path: |
${{ github.workspace }}/cppcheck
key: ${{ runner.os }}-cppcheck-${{ env.cppcheck-version }}

- name: Check soure code
run: cppcheck -q -f --error-exitcode=1 --inline-suppr src
run: ${{ github.workspace }}/cppcheck/cppcheck -q -f --error-exitcode=1 --inline-suppr src

codespell:
runs-on: ubuntu-20.04
Expand Down
2 changes: 1 addition & 1 deletion src/mac/py_proc.h
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ _py_proc__get_resident_memory(py_proc_t * self) {
mach_msg_type_number_t count = MACH_TASK_BASIC_INFO_COUNT;

return task_info(
self->proc_ref, MACH_TASK_BASIC_INFO, (task_info_t) &info, &count
self->proc_ref, MACH_TASK_BASIC_INFO, (task_info_t) &info, &count // cppcheck-suppress [uninitvar]
) == KERN_SUCCESS
? info.resident_size
: -1;
Expand Down

0 comments on commit 57f360b

Please sign in to comment.