I’m using github actions, and it seems like SonarCloud can’t find the unit tests’ coverage report and so the coverage info is not displayed.
I’m running the tests and generating the LCOV report before sonarcloud step.
I have checked the CI logs and this is what I got:
INFO: No LCOV files were found using coverage/lcov.info
WARN: No coverage information will be saved because all LCOV files cannot be found.
This is a part of sonar properties file:
sonar.projectKey={key}
sonar.organization={org}
sonar.javascript.lcov.reportPaths=coverage/lcov.info
and this is the github action workflow:
name: Code Quality
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
on:
pull_request:
push:
branches:
- main
jobs:
test:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install npm packages
run: yarn --frozen-lockfile
- name: Run linters
run: yarn lint
unit-test:
name: unit-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install npm packages
run: yarn --frozen-lockfile
- name: Run unit tests
run: yarn test
- name: Archive code coverage results
uses: actions/upload-artifact@v2
with:
name: code-coverage-report
path: coverage/lcov.info
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
needs: unit-test
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Download code coverage results
uses: actions/download-artifact@v2
with:
name: code-coverage-report
path: coverage/lcov.info
- name: check on report
run: cd coverage && ls
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
I have also added a step to check on the report and it’s there.
Can you please advise?