Skip to content

Commit

Permalink
CI: Add SonarCloud back
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikekson committed Aug 29, 2023
1 parent f5e39c8 commit 30dd6b0
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Build

on:
push:
Expand All @@ -10,6 +10,7 @@ on:

jobs:
build:
name: Build
runs-on: ubuntu-20.04

env:
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: SonarCloud

on:
push:
branches:
- '*'
pull_request:
branches:
- master

jobs:
build:
name: SonarCloud
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install SonarCloud tools
uses: SonarSource/sonarcloud-github-c-cpp@v2

- name: Install dependencies
run: ./.github/workflows/deps/linux.sh

- name: Configure build
run: |
mkdir build
cd build
cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-G Ninja \
..
- name: Build
run: |
cd build
cmake --build .
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner -X
16 changes: 4 additions & 12 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
sonar.projectKey=xmoto_xmoto
sonar.organization=xmoto
sonar.cfamily.threads=2
sonar.cfamily.cache.enabled=false

# This is the name and version displayed in the SonarCloud UI.
#sonar.projectName=xmoto
#sonar.projectVersion=1.0

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

# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8
sonar.projectName=X-Moto
sonar.sources=src
sonar.cfamily.compile-commands=build/compile_commands.json
sonar.sourceEncoding=UTF-8

0 comments on commit 30dd6b0

Please sign in to comment.