Skip to content

Commit

Permalink
ci(sonarcloud): upload coverage report to sonarcloud
Browse files Browse the repository at this point in the history
  • Loading branch information
elersong committed Jul 23, 2024
1 parent f9abf1a commit 366ffb3
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ on:
branches:
- master
pull_request:
branches:
- master
types: [opened, synchronize, reopened]

jobs:
sonarcloud-code-quality:
Expand All @@ -17,12 +16,28 @@ jobs:
with:
fetch-depth: 0 # Disabling shallow clone to improve relevancy of reporting

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
run: npm install

- name: Run tests and generate coverage report
run: npm test -- --coverage

- name: Check if lcov.info exists
run: ls -la coverage/

- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@v2.3.0 # Use the latest version from the marketplace
uses: sonarsource/sonarcloud-github-action@master
with:
args: >
-Dsonar.organization=elersong
-Dsonar.projectKey=elersong_fireorm24
-Dsonar.coverage.exclusions=**/*.spec.*,src/test/**
-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 366ffb3

Please sign in to comment.