I see that you shared only a part of your Github Action yml file. Are you actually running the tests and generating the coverage report file prior to running the SonarCloud step ?
@Gregoire_Aubert I get the same error message and yes, I’m running tests and generating lcov report before sonarcloud step. This used to work perfectly last week, and without any change in the workflow files or sonarcloud settings, we get that message.
Do you know exactly when it stopped working correctly ? You probably can find the information by checking the coverage in the activity page of your project.
I’ll try to find out if we deployed anything related to this on that day and see if there is a bug on our side.
You script seems correct. You should check if the files paths generated inside the lcov files are correct compared to where the analysis is run. Sometime coverage tools generate absolute path which are then not usable by the analyzer.
Same problem here with a node application. Sometimes coverage and duplication verification works. I run the tests and the folder coverage is generated with the file lcov.info.
github actions:
name: CI-Sonarcloud
on:
pull_request:
branches:
- master
jobs:
check-application:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Install dependencies
run: npm install
- name: Run tests
run: npm test
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
For anyone still having this problem in GitHub actions, the key thing is where you are running your tests vs where you are running your sonar scan in the GitHub workflow. If they are in different jobs in the workflow, you have to save the lcov.info as an artifact so that it is available to the sonarscan job. Or, a much easier solution, run your tests and the sonarscan in the same job. That is what I did and it solved this problem.
Faced same problem. I tried from my laptop and the coverage showed up. Then I re-ran the github action and it pushed coverage too. Strange that it didn’t push first time!