56 lines
2.1 KiB
YAML
56 lines
2.1 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 clang-tidy
|
|
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
|
|
echo "Building, output redirected to file due to verbrosity this may take 10-15 mins to complete..."
|
|
build-wrapper-linux-x86-64 --out-dir bw-output make -j 2>&1 > output.txt
|
|
|
|
echo "Outputting last 200 lines of the build..."
|
|
tail -200 output.txt
|
|
|
|
make unit_coverage
|
|
|
|
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/unit_coverage.xml
|
|
-Dsonar.cxx.clangtidy.reportPath=./build-release/output.txt
|
|
env:
|
|
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}
|