From fc83403b6f15cbef4be5a3e10282b9971d8ca53d Mon Sep 17 00:00:00 2001 From: Laurynas Biveinis Date: Wed, 28 Jul 2021 07:10:59 +0300 Subject: [PATCH] Try sonarcloud.io --- .github/workflows/sonarcloud.yml | 50 ++++++++++++++++++++++++++++++++ sonar-project.properties | 4 +++ 2 files changed, 54 insertions(+) create mode 100644 .github/workflows/sonarcloud.yml create mode 100644 sonar-project.properties diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml new file mode 100644 index 00000000..1750bf57 --- /dev/null +++ b/.github/workflows/sonarcloud.yml @@ -0,0 +1,50 @@ +name: sonarcloud + +on: [push] + +jobs: + sonarcloud: + name: SonarCloud + runs-on: ubuntu-latest + steps: + - name: Cache SonarCloud packages + uses: actions/cache@v1 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + + - name: Download and set up sonar-scanner + env: + SONAR_SCANNER_VERSION: 4.6.1.2450 # Find the latest version in the "Linux" link on this page: + # https://sonarcloud.io/documentation/analysis/scan/sonarscanner/ + SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.1.2450-linux.zip + run: | + mkdir -p $HOME/.sonar + curl -sSLo $HOME/.sonar/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }} + unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ + echo "$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH + + - uses: actions/checkout@v2 + with: + submodules: true + fetch-depth: 0 # Shallow clones should be disabled for a better + # relevancy of analysis + + - name: Setup dependencies + run: | + sudo add-apt-repository -y 'ppa:mhier/libboost-latest' + sudo apt-get update + sudo apt-get install -y boost1.74 + + - name: Produce Compilation Database + shell: bash + run: | + cmake . -DCMAKE_BUILD_TYPE=Debug + + - name: SonarCloud Scan + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: | + sonar-scanner diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000..6f3aadf1 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,4 @@ +sonar.projectKey=laurynas-biveinis_unodb +sonar.organization=laurynas-biveinis +sonar.cfamily.compile-commands=compile_commands.json +sonar.cfamily.threads=3