Skip to content

Commit

Permalink
ci: add SonarCloud workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks committed Jan 13, 2024
1 parent 6e13067 commit 24c4fad
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: SonarCloud
on:
push:
branches:
- master
pull_request:
types:
- opened
- synchronize
- reopened
jobs:
build:
name: Build and analyze
runs-on: ubuntu-latest
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory
CC: clang-17
CXX: clang++-17
steps:
- name: Check out code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v2.0.2

- name: Run build-wrapper
run: |
cmake -B build -DCMAKE_BUILD_TYPE=MinSizeRel
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
4 changes: 4 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sonar.projectKey=sjinks_tfhttp
sonar.organization=wildwolf
sonar.sources=src
sonar.sourceEncoding=UTF-8

0 comments on commit 24c4fad

Please sign in to comment.