Skip to content

Commit

Permalink
Try sonarcloud.io
Browse files Browse the repository at this point in the history
  • Loading branch information
laurynas-biveinis committed Jul 28, 2021
1 parent cbb9eda commit fc83403
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .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
4 changes: 4 additions & 0 deletions 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

0 comments on commit fc83403

Please sign in to comment.