Skip to content

Commit

Permalink
🎉 Added sonarcloud scan
Browse files Browse the repository at this point in the history
  • Loading branch information
AnotherFoxGuy committed Aug 5, 2024
1 parent 9782255 commit ba17e0b
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: SonarCloud scan
on:
push:
branches:
- master
- sonarcloud
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: sonarcloud scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install sonar-scanner and build-wrapper
uses: sonarsource/sonarcloud-github-c-cpp@v2
id: sonarscan

- name: Cache conan
uses: actions/cache@v4
with:
key: conan-ubuntu-${{ hashFiles('conanfile.py') }}
path: ~/.conan2/

- name: Install dependencies
run: |
curl "https://raw.githubusercontent.com/AnotherFoxGuy/ci-scripts/main/install-conan.sh" | sudo bash
sudo apt-get update
wget -nv https://cdn.anotherfoxguy.com/sonar-scanner/ror -O run-sonar-scanner
sudo chmod 777 run-sonar-scanner
- name: Configure
run: |
conan profile detect --force
echo "tools.system.package_manager:mode = install" > ~/.conan2/global.conf
echo "tools.system.package_manager:sudo = True" >> ~/.conan2/global.conf
conan remote add ror-conan https://git.anotherfoxguy.com/api/packages/rorbot/conan -f
conan install . -s build_type=Release -b missing -pr:b=default
conan cache clean "*" -sbd
cmake --preset conan-release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
shell: bash

- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_SCANNER_EXE: ${{ steps.sonarscan.outputs.sonar-scanner-binary }}
run: ./run-sonar-scanner
14 changes: 14 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
sonar.host.url=https://sonarcloud.io
sonar.projectKey=rigs-of-rods
sonar.organization=anotherfoxguy-github

# This is the name and version displayed in the SonarCloud UI.
sonar.projectName=rigs-of-rods
sonar.projectVersion=2022.12

# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
sonar.sources=source

# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8
sonar.cfamily.compile-commands=compile_commands.json

0 comments on commit ba17e0b

Please sign in to comment.