From 9952a02a1090aa6f4f5fff1721451f948d8cf011 Mon Sep 17 00:00:00 2001 From: Christian Koop Date: Wed, 28 Aug 2024 20:12:29 +0200 Subject: [PATCH] ci: Run SonarCloud static code analysis in tests workflow --- .github/workflows/tests.yml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index da719a5..edc23b0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: Tests +name: Tests + SonarCloud on: push: @@ -12,10 +12,12 @@ on: jobs: tests: - name: Tests + name: Tests + SonarCloud runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Install system packages needed for headless gl run: >- @@ -39,3 +41,19 @@ jobs: run: npm ci - name: Run the tests run: xvfb-run npm run test:ci + + - name: Run SonarCloud analysis + uses: SonarSource/sonarcloud-github-action@master + with: + args: > + -Dsonar.organization=spraxdev + -Dsonar.projectKey=SpraxDev_Api.Sprax2013.de + -Dsonar.sourceEncoding=UTF-8 + -Dsonar.typescript.tsconfigPaths=tsconfig.json + -Dsonar.javascript.lcov.reportPaths=./coverage/lcov.info + -Dsonar.sources=src/ + -Dsonar.tests=tests/ + -Dsonar.test.inclusions=tests/**/*.test.ts + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}