GithubAction, SonarScanner on is not detecting lcov report

On GitHub Actions, the scanner is not detecting the lcov report.

I’m using SonarCloud and your official Github Action SonarSource/sonarcloud-github-action@master on the last version.

I’m generating the lcov report for test coverage, and the scanner is indicating the report doesn’t exist, even though I check if the file is on the right spot and its content is right.

Run ls -l coverage/packages/ngx-deploy-npm
total 8
drwxr-xr-x 5 runner docker 4096 Jan 29 23:56 lcov-report
-rw-r--r-- 1 runner docker 3538 Jan 29 23:56
Run cat coverage/packages/ngx-deploy-npm/

Scanner Error:

INFO: Sensor JavaScript/TypeScript Coverage [javascript]
INFO: No LCOV files were found using coverage/packages/ngx-deploy-npm/
WARN: No coverage information will be saved because all LCOV files cannot be found.

Here is the full output

steps to reproduce
On GitHub actions, using SonarSource/sonarcloud-github-action@master

  • Inidcate on to find the lcov report on coverage/packages/ngx-deploy-npm/
  • Generate the lcov report
  • Verify if the file coverage/packages/ngx-deploy-npm/ exits
  • Launch the sonnar scanner using
    • - name: SonarCloud Scan
        uses: SonarSource/sonarcloud-github-action@master
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
          SONAR_TOKEN: ${{ secrets.SONARQUBE_SCANNER }}
          args: >
            -Dsonar.pullrequest.key=${{ github.env.PR_NUMBER }}
  • See the error indicating the lcov report doesn’t exist

I tested my configuration locally with dockerized server and scanner, and everything is running as expected.

I see no potential workaround.

Hey there.

Thanks for reaching out and linking to your project.

I have the feeling that you have really over-complicated your file by adding the concept of modules (which are, in most cases, an internal implementation detail that almost never need to be configured manually).

As a result, the coverage file cannot be found relative to the base of the module you’ve configured the coverage file for.

My suggestion is to cut back significantly in your configuration

  • remove sonar.modules and all module specific configuration
  • remove sonar.test.inclusions and instead…
    • set sonar.sources to the packages directory
    • set sonar.tests to the e2e directory that contains all your tests).
  • configure your coverage report once, not tied to any module

Besides your basic project identifiers (key, organization, name), this is really all you really need: