Hi guys.
My team and I are using SonarCloud with GitHub Actions and so far everything has been working fine. However, we are now facing an issue where the sonar is not reading coverage information.
There were no changes in the workflow, but it started to happen. Locally we can see coverage by HTML report and it is working as expected.
Here is our workflow code:
name: Test push
on: push
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x]
mongodb-version: [4.0]
steps:
- uses: actions/checkout@v2
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.3.0
with:
mongodb-version: ${{ matrix.mongodb-version }}
- name: Install packages
run: npm ci
- name: Build typescript
run: npm run build
- name: Test
run: npm run test:coverage
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
projectBaseDir: "/home/runner/work/estudaqui-cloudcode/estudaqui-cloudcode/"
args: >
-Dsonar.sources="src/cloud"
-Dsonar.exclusions="**/*.constants.ts"
-Dsonar.tests="test/"
-Dsonar.test.inclusions="**/*.spec.ts"
-Dsonar.typescript.lcov.reportPaths="coverage/lcov.info"
-Dsonar.coverage.exclusions="**/node_modules/**/*"
-Dsonar.organization=estudaqui
-Dsonar.projectKey=developerestudaqui_estudaqui-cloudcode
- name: Dispatch deploy production
if: ${{ github.ref == 'refs/heads/master' }}
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
repository: ${{ github.repository }}
event-type: deploy-production
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
The npm run test: coverage executes the command nyc --reporter = lcov npm run test and put informations in coverage/lcov.info.
Thanks for any help!