update github workflow sonar.yml #115
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: Sonar | |
on: | |
push: | |
branches: | |
- master | |
- sonar | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
env: | |
SONAR_SCANNER_VERSION: 4.4.0.2170 | |
SONAR_SERVER_URL: "https://sonarcloud.io" | |
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Install sonar-scanner and build-wrapper | |
uses: sonarsource/sonarcloud-github-c-cpp@v2 | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get install libflac-dev libflac++-dev libpulse-dev | |
- name: Configure build | |
run: "cmake -B build -Wno-dev" | |
- name: Run build-wrapper | |
run: build-wrapper-linux-x86-64 --out-dir sonar-build-output cmake --build build | |
- name: Run Sonar scanner | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
sonar-scanner -Dsonar.cfamily.build-wrapper-output=sonar-build-output -Dsonar.login=$SONAR_TOKEN |