Skip to content

[pull] master from symless:master #13

[pull] master from symless:master

[pull] master from symless:master #13

name: "SonarCloud Analysis"
on:
push:
branches: [master]
pull_request:
branches: [master]
concurrency:
group: "${{ github.workflow }}-${{ github.ref || github.run_id }}"
cancel-in-progress: true
jobs:
sonarcloud-analysis:
if: ${{ vars.SONAR_SCANNER_ENABLED }}
runs-on: ubuntu-latest
timeout-minutes: 20
env:
SONAR_SCANNER_VERSION: 6.1.0.4477
SONAR_SCANNER_OPTS: -server
SONAR_SCANNER_URL_BASE: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: ./scripts/install_deps.py
- name: Install gcovr
run: pip install gcovr
- name: Install SonarScanner
run: |
export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux-x64
curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip \
$SONAR_SCANNER_URL_BASE/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux-x64.zip
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
- name: Install build-wrapper
run: |
curl --create-dirs -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
- name: Build
run: |
export PATH=$HOME/.sonar/build-wrapper-linux-x86:$PATH
mkdir -p build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON ..
build-wrapper-linux-x86-64 --out-dir bw-output make -j
- name: Make coverage
run: |
cd build
make coverage
- name: Run SonarScanner
run: |
export PATH=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux-x64/bin:$PATH
cd build
sonar-scanner \
-Dsonar.organization=symless \
-Dsonar.projectKey=symless_synergy-core \
-Dsonar.sources=. \
-Dsonar.projectBaseDir=../ \
-Dsonar.exclusions=ext/**,build/** \
-Dsonar.cfamily.build-wrapper-output=bw-output \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.coverageReportPaths=build/coverage.xml \
-Dsonar.cfamily.threads=2
env:
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}