feat: add Sonar analysis to build pipeline (#324)

This commit is contained in:
Adam Szatyin 2021-10-11 12:56:43 +02:00 committed by GitHub
parent 050da9a2a9
commit 6f4327bfa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 0 deletions

View File

@ -23,3 +23,8 @@ To run GitHub workflow, a few environment variables needs to add in GitHub secre
<td> Docker hub password/token with push permission </td>
<td> **** </td>
</tr>
<tr>
<td> SONAR_TOKEN </td>
<td> <a href="https://sonarcloud.io">SonarCloud</a> token </td>
<td> **** </td>
</tr>

27
.github/workflows/sonar.yml vendored Normal file
View File

@ -0,0 +1,27 @@
name: sonar
on:
pull_request:
branches:
- main
- v*
paths:
- 'frontend/**'
defaults:
run:
working-directory: frontend
jobs:
sonar-analysis:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Sonar analysis
uses: sonarsource/sonarcloud-github-action@master
with:
projectBaseDir: frontend
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

View File

@ -0,0 +1,6 @@
sonar.organization=szatyinadam
sonar.projectKey=szatyinadam_signoz
# relative paths to source directories. More details and properties are described
# in https://sonarcloud.io/documentation/project-administration/narrowing-the-focus/
sonar.sources=./src