This repository has been archived by the owner on Jul 4, 2024. It is now read-only.
Simplify compile options and use comprehensive edition logic #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |