mirror of
https://github.com/optim-enterprises-bv/nDPId.git
synced 2025-10-29 17:32:23 +00:00
Adjusted SonarCloud config and CI
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
59
.github/workflows/sonarcloud.yml
vendored
59
.github/workflows/sonarcloud.yml
vendored
@@ -16,46 +16,51 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
# - uses: actions/checkout@v4
|
- name: Set up Python 3.8 for gcovr
|
||||||
# - name: Set up Python 3.8 for gcovr
|
uses: actions/setup-python@v4
|
||||||
# uses: actions/setup-python@v4
|
with:
|
||||||
# with:
|
python-version: 3.8
|
||||||
# python-version: 3.8
|
- name: install gcovr 5.0
|
||||||
# - name: install gcovr 5.0
|
run: |
|
||||||
# run: |
|
pip install gcovr==5.0 # 5.1 is not supported
|
||||||
# pip install gcovr==5.0 # 5.1 is not supported
|
|
||||||
- name: Install sonar-scanner and build-wrapper
|
- name: Install sonar-scanner and build-wrapper
|
||||||
uses: SonarSource/sonarcloud-github-c-cpp@v2
|
uses: SonarSource/sonarcloud-github-c-cpp@v3.1.0
|
||||||
- name: Install Prerequisites
|
- name: Install Prerequisites
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install autoconf automake cmake libtool pkg-config gettext libjson-c-dev flex bison libpcap-dev zlib1g-dev
|
sudo apt-get install autoconf automake cmake lcov \
|
||||||
|
libtool pkg-config gettext \
|
||||||
|
libjson-c-dev flex bison \
|
||||||
|
libcurl4-openssl-dev libpcap-dev zlib1g-dev
|
||||||
- name: Run build-wrapper
|
- name: Run build-wrapper
|
||||||
run: |
|
run: |
|
||||||
mkdir build
|
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} ./scripts/build-sonarcloud.sh
|
||||||
cmake -S . -B build -DBUILD_NDPI=ON -DDENABLE_ZLIB=ON -DNDPI_WITH_GCRYPT=OFF
|
- name: Run tests
|
||||||
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build/ --config Release
|
run: |
|
||||||
# - name: Run tests
|
for file in $(ls libnDPI/tests/cfgs/*/pcap/*.pcap libnDPI/tests/cfgs/*/pcap/*.pcapng libnDPI/tests/cfgs/*/pcap/*.cap); do \
|
||||||
# run: |
|
echo -n "${file} "; \
|
||||||
# for file in $(ls libnDPI/tests/cfgs/*/pcap/*.pcap libnDPI/tests/cfgs/*/pcap/*.pcapng libnDPI/tests/cfgs/*/pcap/*.cap); do \
|
cd ./build-sonarcloud; \
|
||||||
# echo -n "${file} "; \
|
./nDPId-test "../${file}" >/dev/null 2>/dev/null; \
|
||||||
# ./build/nDPId-test "${file}" >/dev/null 2>/dev/null; \
|
cd ..; \
|
||||||
# echo "[ok]"; \
|
echo "[ok]"; \
|
||||||
# done
|
done
|
||||||
# - name: Collect coverage into one XML report
|
mkdir -p gcov_report
|
||||||
# run: |
|
cd gcov_report
|
||||||
# gcovr --sonarqube > coverage.xml
|
gcov ../build-sonarcloud/CMakeFiles/nDPId-test.dir/nDPId-test.c.o
|
||||||
|
cd ..
|
||||||
- name: Run sonar-scanner
|
- name: Run sonar-scanner
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
sonar-scanner \
|
sonar-scanner \
|
||||||
|
--define sonar.projectName=nDPId \
|
||||||
|
--define sonar.projectVersion=1.7 \
|
||||||
|
--define sonar.sourceEncoding=UTF-8 \
|
||||||
--define sonar.branch.name=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} \
|
--define sonar.branch.name=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} \
|
||||||
--define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" \
|
|
||||||
--define sonar.organization=lnslbrty \
|
--define sonar.organization=lnslbrty \
|
||||||
--define sonar.projectKey=lnslbrty_nDPId \
|
--define sonar.projectKey=lnslbrty_nDPId \
|
||||||
--define sonar.exclusions=dependencies/uthash/src/** \
|
|
||||||
--define sonar.verbose=true \
|
|
||||||
--define sonar.python.version=3.8 \
|
--define sonar.python.version=3.8 \
|
||||||
--define sonar.cfamily.gcov.reportsPath=coverage.xml
|
--define sonar.cfamily.compile-commands=${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json \
|
||||||
|
--define sonar.cfamily.gcov.reportsPath=gcov_report \
|
||||||
|
--define sonar.exclusions=build-sonarcloud/**,libnDPI/**,test/results/**,dependencies/jsmn/**,dependencies/uthash/**,examples/js-rt-analyzer-frontend/**,examples/js-rt-analyzer/**,examples/c-collectd/www/**,examples/py-flow-dashboard/assets/**
|
||||||
|
|||||||
20
scripts/build-sonarcloud.sh
Executable file
20
scripts/build-sonarcloud.sh
Executable file
@@ -0,0 +1,20 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -x
|
||||||
|
|
||||||
|
cd "$(dirname "${0}")/.."
|
||||||
|
|
||||||
|
BUILD_DIR=./build-sonarcloud
|
||||||
|
NUMBER_OF_PROCESSORS=$(nproc --all)
|
||||||
|
mkdir "${BUILD_DIR}"
|
||||||
|
cmake -S . -B "${BUILD_DIR}" \
|
||||||
|
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
||||||
|
-DENABLE_COVERAGE=ON \
|
||||||
|
-DBUILD_NDPI=ON \
|
||||||
|
-DBUILD_EXAMPLES=ON \
|
||||||
|
-DENABLE_CURL=ON \
|
||||||
|
-DENABLE_ZLIB=ON \
|
||||||
|
-DNDPI_WITH_GCRYPT=OFF
|
||||||
|
cmake --build "${BUILD_DIR}" -j ${NUMBER_OF_PROCESSORS} \
|
||||||
|
--config Release
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
sonar.projectKey=lnslbrty_nDPId
|
|
||||||
sonar.organization=lnslbrty
|
|
||||||
|
|
||||||
sonar.projectName=nDPId
|
|
||||||
sonar.projectVersion=1.5
|
|
||||||
|
|
||||||
sonar.sourceEncoding=UTF-8
|
|
||||||
sonar.sources=*.c,*.h,dependencies/nDPIsrvd.h,dependencies/nDPIsrvd.py,examples/c-*/**,examples/cxx-*/**,examples/py-*/**
|
|
||||||
sonar.exclusions = dependencies/jsmn/** dependencies/uthash/** examples/js-rt-analyzer-frontend/** examples/js-rt-analyzer/** examples/c-collectd/www/** examples/py-flow-dashboard/assets/**
|
|
||||||
Reference in New Issue
Block a user