Skip to content

Static Analysis using CodeChecker :) #1

Static Analysis using CodeChecker :)

Static Analysis using CodeChecker :) #1

Workflow file for this run

# JULEA - Flexible storage framework
# Copyright (C) 2026 Jan Frase
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
name: static-analysis.yml
on: [push, pull_request]
defaults:
run:
shell: bash
jobs:
# This job is responsible for running Codechecker.
code-checker:
name: Code checker
runs-on: ubuntu-24.04
timeout-minutes: 60
env:
JULEA_SPACK_DIR: /julea-dependencies
steps:
# First, checkout julea.
- name: Checkout
uses: actions/checkout@v6
with:
persist-credentials: false
show-progress: false
# Get the dependencies.
- name: Install dependencies
run: |
sudo apt update
sudo apt --yes --no-install-recommends install meson ninja-build pkgconf libglib2.0-dev libbson-dev libfabric-dev libgdbm-dev liblmdb-dev libsqlite3-dev libleveldb-dev libmongoc-dev libmariadb-dev librocksdb-dev libfuse3-dev libopen-trace-format-dev librados-dev
# Then, generate compile_commands.json.
- name: Generate compile_commands.json
env:
CC: clang
run: |
. scripts/environment.sh
meson setup bld
# Install CodeChecker, gcc and cppcheck.
- name: Install CodeChecker
run: |
pip install codechecker
sudo apt install --yes --no-install-recommends cppcheck gcc
- name: Install Infer
run: |
VERSION=1.3.0; \
curl -sSL "https://github.com/facebook/infer/releases/download/v$VERSION/infer-linux-x86_64-v$VERSION.tar.xz" \
| sudo tar -C /opt -xJ && \
sudo ln -s "/opt/infer-linux-x86_64-v$VERSION/bin/infer" /usr/local/bin/infer
# Run the analysis.
- name: Run CodeChecker
# Since we already have ~100 warnings, i have disabled the sensitive checks for now.
# Should we ever run out of warnings, feel free to enable them again :D
run: CodeChecker analyze ./bld/compile_commands.json -o results --ctu #--enable sensitive
# Parse the results and generate an HTML report.
- name: Generate HTML report
run: |
# The parse command returns with exit code 2 if it finds any bugs.
# Thus, we ignore the exit code with "|| true", to avoid failing the workflow.
CodeChecker parse --export html --output ./reports_html ./results || true
# Lastly, upload the results to the CI.
- name: Upload results
uses: actions/upload-artifact@v7.0.1
with:
name: "CodeChecker Bug Reports"
path: ./reports_html