From 1f1cb579ef4f8bd8b86358a5a5dbbbbb463a1867 Mon Sep 17 00:00:00 2001 From: ben12 Date: Sun, 22 Dec 2024 13:16:53 +0100 Subject: [PATCH] Report tests result to sonarqube --- .github/workflows/CI.yml | 14 +++++++++++--- sonar-project.properties | 11 +++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 sonar-project.properties diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 89734f4..1eb6ed9 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -7,6 +7,10 @@ on: branches: [master] schedule: - cron: 0 0 * * 0 +permissions: + contents: read + actions: read + checks: write jobs: lint: @@ -73,16 +77,20 @@ jobs: - name: Install ESLint ${{ matrix.eslint }} and TypeScript-ESLint ${{ matrix.typescript-eslint }} run: npm install --force --no-save eslint@${{ matrix.eslint }} @typescript-eslint/eslint-plugin@${{ matrix.typescript-eslint }} - name: Test - run: npm run -s test:ci:${{ matrix.eslint }} -- --reporter json --reporter-options output=reports/tests.json + run: npm run -s test:ci:${{ matrix.eslint }} -- --reporter xunit --reporter-options output=reports/tests.xml - name: Test Report uses: dorny/test-reporter@v1 if: success() || failure() with: name: Tests Results (${{ matrix.eslint }}, ${{ matrix.node }}, ${{ matrix.os }}) - path: reports/tests.json - reporter: mocha-json + path: reports/tests.xml + reporter: swift-xunit - name: Send Coverage uses: codecov/codecov-action@v3 with: token: "${{ secrets.CODECOV_TOKEN }}" directory: ./coverage/ + - name: SonarQube Scan + uses: SonarSource/sonarqube-scan-action@v4 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..170e139 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,11 @@ +sonar.projectKey=ben12_eslint-plugin-dprint +sonar.projectName=ESLint Plugin Dprint +sonar.token=${SONAR_TOKEN} + +sonar.tests=test +sonar.exclusions=node_modules/**, dist/**, reports/**, coverage/** + +sonar.javascript.lcov.reportPaths=coverage/lcov.info +sonar.cs.xunit.reportsPaths=reports/tests.xml + +sonar.cpd.exclusions=test/**/* \ No newline at end of file