diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 604185264e49d37919a9de920f17c4fd898ccd37..68e38f17b2db8993fb266fccf4c5055d91066d7c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,6 +23,8 @@ variables: LIBGKFS_LOG_OUTPUT: "${CI_PROJECT_DIR}/logs/gkfs_client.log" GIT_SUBMODULE_STRATEGY: recursive CCACHE_DIR: "$CI_PROJECT_DIR/ccache" +# SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache +# GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task # base image @@ -394,6 +396,46 @@ coverage: - ${COVERAGE_PATH} expire_in: 2 weeks +cppcheck: + stage: report + image: gekkofs/cppcheck:0.9.4-dev + needs: [ 'gkfs:allintegration', 'gkfs:unit'] + script: + - cd ${CI_PROJECT_DIR} + - rm -rf external gkfs + - cppcheck --xml --enable=warning,style,performance --force ${CI_PROJECT_DIR} 2> cppcheck_out.xml + - cppcheck-codequality --input-file cppcheck_out.xml --output-file cppcheck.json + #change paths + after_script: + - perl -pe 's|/builds/gitlab/hpc/gekkofs||g' cppcheck.json > cppcheck2.json + artifacts: + paths: + - cppcheck_out.xml + reports: + codequality: cppcheck2.json + expire_in: 2 weeks + +sonar: + stage: report + image: + name: sonarsource/sonar-scanner-cli:11 + entrypoint: [""] + needs: ['cppcheck'] + rules: + - if: '$CI_MERGE_REQUEST_EVENT_TYPE == "detached"' + when: never + - if: '$CI_MERGE_REQUEST_ID != ""' + when: manual + allow_failure: true + script: + - sonar-scanner -Dsonar.host.url="${SONAR_HOST_URL}" + cache: + policy: pull-push + key: "sonar-cache-$CI_COMMIT_REF_SLUG" + paths: + - "${SONAR_USER_HOME}/cache" + - sonar-scanner/ + ################################################################################ ## Deployment of documentation and reports diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bced7eab0e21d67996b560d1fbe0c4949fa2033..a24c4e0cce68e64953b24046ec0b24a9f8286bbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,18 @@ All notable changes to GekkoFS project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [0.9.4] - 2025-03] +## Unreleased +### New + - Added cppcheck code checking capabilities ([!214](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/214)) + +### Changed + + +### Fixed + + + +## [0.9.4] - 2025-03 ### New - Add RISC-V profile ([!220](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/220)) diff --git a/docker/0.9.4/cppcheck/Dockerfile b/docker/0.9.4/cppcheck/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..e6668abafc1635988eb01dd192609e7527a2cb88 --- /dev/null +++ b/docker/0.9.4/cppcheck/Dockerfile @@ -0,0 +1,20 @@ +FROM debian:bookworm-slim + +LABEL Description="Environment to generate cppcheck reports in GekkoFS" + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + wget \ + git \ + python3 \ + python3-pip \ + python3-setuptools \ + cppcheck && \ + rm -rf /var/lib/apt/lists/* && \ + apt-get clean && \ + apt-get autoclean && \ + git clone https://gitlab.com/ahogen/cppcheck-codequality.git && \ + cd cppcheck-codequality && \ + python3 -m pip install --upgrade pip --break-system-packages && \ + pip3 install . --break-system-packages + diff --git a/docker/0.9.4/cppcheck/Makefile b/docker/0.9.4/cppcheck/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..46fc0633b2b6894159575e662459ebb96b8a04e6 --- /dev/null +++ b/docker/0.9.4/cppcheck/Makefile @@ -0,0 +1,10 @@ +.PHONY: all + +amd64: + docker build --platform amd64 -t gekkofs/cppcheck:0.9.4-dev . + +aarch64: + docker build --platform aarch64 -t gekkofs/cppcheck:0.9.4-dev . + +all: + docker build -t gekkofs/cppcheck:0.9.4-dev . \ No newline at end of file diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000000000000000000000000000000000000..90a755524b332e74838aaa59326af6c70986cb6e --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,4 @@ +sonar.projectKey=hpc_gekkofs_f327dcaa-2f78-4b9a-96b0-079902420c12 +sonar.qualitygate.wait=true +sonar.cxx.file.suffixes=.h,.cpp,.hpp +sonar.cxx.cppcheck.reportPaths=cppcheck_out.xml \ No newline at end of file