diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 6486823672..c596e08d91 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -23,3 +23,8 @@ To run GitHub workflow, a few environment variables needs to add in GitHub secre Docker hub password/token with push permission **** + + SONAR_TOKEN + SonarCloud token + **** + diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml new file mode 100644 index 0000000000..751b9053f2 --- /dev/null +++ b/.github/workflows/sonar.yml @@ -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 }} + \ No newline at end of file diff --git a/frontend/sonar-project.properties b/frontend/sonar-project.properties new file mode 100644 index 0000000000..a70ba95421 --- /dev/null +++ b/frontend/sonar-project.properties @@ -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 \ No newline at end of file