Skip to content

Commit

Permalink
ci(coverage): generate coverage report for new commit
Browse files Browse the repository at this point in the history
  • Loading branch information
elersong committed Jul 23, 2024
1 parent 93f3254 commit 0749e4b
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,27 @@ jobs:
with:
fetch-depth: 0 # Disabling shallow clone to improve relevancy of reporting

- name: Get Codecov report URL
run: |
response=$(curl -s https://codecov.io/api/v2/github/${{ github.repository }}/commit/${{ github.sha }})
report_url=$(echo $response | jq -r '.commit.uploader.coverage.lcov')
echo "REPORT_URL=$report_url" >> $GITHUB_ENV
- name: Download coverage report from Codecov
run: |
report_url=${{ steps.get_codecov_report_url.outputs.report_url }}
echo "##[debug]Report URL: $report_url"
curl -o coverage-lcov.info -L "$report_url"
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'

- name: Install dependencies
run: npm install

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

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

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

0 comments on commit 0749e4b

Please sign in to comment.