Skip to content

[pre-commit.ci] pre-commit autoupdate (#166) #809

[pre-commit.ci] pre-commit autoupdate (#166)

[pre-commit.ci] pre-commit autoupdate (#166) #809

---
# Configuration script for github continuous integration service
name: SonarScanner
on:
push:
branches: [master]
paths-ignore:
- "*.md"
- "*.cff"
- "env/csv/*.csv"
- "env/maze/*.txt"
- "cfg/*.json"
- "python/*.py"
- "python/notebooks/*.ipynb"
pull_request:
branches: [master]
paths-ignore:
- "*.md"
- "*.cff"
- "env/csv/*.csv"
- "env/maze/*.txt"
- "cfg/*.json"
- "python/*.py"
- "python/notebooks/*.ipynb"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
CC: gcc-9
CXX: g++-9
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Configure and Build
working-directory: build
run: |
sudo apt install lcov gcovr
cmake .. -DCMAKE_BUILD_TYPE=Debug -DXCSF_PYLIB=OFF -DENABLE_TESTS=ON -DPARALLEL=ON -DUSE_GCOV=ON
wget -q https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
unzip -q build-wrapper-linux-x86.zip
cp ./build-wrapper-linux-x86/libinterceptor-x86_64.so ./build-wrapper-linux-x86/libinterceptor-haswell.so
./build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output make clean all
- name: Generate coverage report
run: |
lcov --directory . --capture --output-file lcov.info
lcov --remove lcov.info '/usr/*' '*/extlib/*' '*/lib/*' '*/test/*' --output-file coverage.info
lcov --list coverage.info;
gcovr -r ./ -x > report.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Setup SonarQube
uses: warchant/setup-sonar-scanner@v8
- name: Sonarqube coverage
run: |
gcovr --sonarqube > coverage.xml
- name: Run sonarqube
run: sonar-scanner
-Dsonar.host.url=https://sonarcloud.io/
-Dsonar.token=${{ secrets.SONAR_TOKEN }}
-Dsonar.projectKey=xcsf-dev_xcsf
-Dsonar.organization=xcsf-dev
-Dsonar.projectVersion=1.0
-Dsonar.projectBaseDir=./
-Dsonar.cfamily.build-wrapper-output=build/bw-output
-Dsonar.cfamily.analysisCache.mode=server
-Dsonar.cfamily.threads=1
-Dsonar.coverage.exclusions="python/**,test/**,lib/**,doc/**"
-Dsonar.exclusions="python/**,test/**,lib/**,doc/**"
-Dsonar.sourceEncoding=UTF-8
-Dsonar.coverageReportPaths=coverage.xml
-Dsonar.python.version=3.11
...