deskflow/.github/workflows/job-sonarcloud.yml
2020-08-24 14:36:38 +01:00

54 lines
1.9 KiB
YAML

name: SonarCloud Static Analisis
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
container: symless/synergy-core:debian10
steps:
- uses: actions/checkout@v2
- name: Run Sonar
run: |
apt-get update
apt-get install -y gcovr
export SONAR_SCANNER_VERSION=4.4.0.2170
export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
export PATH=$SONAR_SCANNER_HOME/bin:$PATH
export SONAR_SCANNER_OPTS="-server"
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/
export PATH=$HOME/.sonar/build-wrapper-linux-x86:$PATH
mkdir build-release
cd build-release
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_COVERAGE=ON
. ./version
build-wrapper-linux-x86-64 --out-dir bw-output make -j
make unit_coverage
make integ_coverage
make clangtidy
sonar-scanner \
-Dsonar.organization=symless \
-Dsonar.projectKey=symless_synergy-core \
-Dsonar.sources=. \
-Dsonar.projectBaseDir=../ \
-Dsonar.exclusions=./ext/**,**/build-release/** \
-Dsonar.cfamily.build-wrapper-output=bw-output \
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.cxx.coverage.reportPath=./build-release/integ_coverage.xml
-Dsonar.cxx.clangtidy.reportPath=./build-release/clang-tidy.txt
env:
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}