Hi,
I’m having problems configuring SonarQube Cloud
for LCOV code coverage in my GitHub actions pipeline
Context
- ALM: GitHub
- CI: GitHub actions
- Scanner command used: SonarSource/sonarqube-scan-action@v5
- Languages of the repository: Typescript
- Repo: GitHub - hivemq/hivemq-edge: HiveMQ Edge is an MQTT gateway that enables interoperability between OT devices and IT systems. It translates diverse protocols into MQTT for streamlined communication and helps organize data into a unified namespace, making managing and streaming data across your infrastructure easier.
- It’s a “monorepo”, with the relevant project at hivemq-edge/hivemq-edge-frontend at master · hivemq/hivemq-edge · GitHub
- Current PR: chore(32824): Update SonarQube Cloud by vanch3d · Pull Request #960 · hivemq/hivemq-edge · GitHub
- SonarCloud project: private, free account
Steps
- I’m running a github workflow to create LCOV files out of my tests (
Vitest
andCypress
) - The LCOV outputs are stored as artefacts in the workflow (they exist, I can download them)
- In the
SonarQube
job:- I’m loading the LCOV documents (verified by running a
ls -R
step) - I’m running the
sonarqube-scan-action
action, as described in the project settings (projectBaseDir
added to reflect “monorepo” style)
- I’m loading the LCOV documents (verified by running a
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v5
with:
projectBaseDir: hivemq-edge-frontend
args: >
-Dsonar.verbose=true
-Dsonar.javascript.lcov.reportPaths=**/*.info
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- The
sonaqube
project and thereportPaths
are properly defined in the monorepo
# Maybe these should be done dynamically in the github action
sonar.javascript.lcov.reportPaths=\
./coverage-combined/lcov-cypress-Components/lcov.info, \
./coverage-combined/lcov-cypress-E2E/lcov.info, \
./coverage-combined/lcov-cypress-Extensions/lcov.info, \
./coverage-combined/lcov-cypress-Modules/lcov.info, \
./coverage-combined/lcov-cypress-Workspace/lcov.info, \
./coverage-combined/lcov-vitest/lcov.info
- The step executes properly (I can see the branch appearing in the
SonarQube
workspace) - However, the log clearly highlights that the LCOV files are NOT FOUND:
0:32:50.385 INFO SonarScanner CLI 7.1.0.4889
10:32:50.387 INFO Java 17.0.13 Eclipse Adoptium (64-bit)
10:32:50.387 INFO Linux 6.11.0-1013-azure amd64
10:32:50.395 DEBUG Scanner max available memory: 3 GB
10:32:50.419 DEBUG uname -m returned 'x86_64'
10:32:50.421 DEBUG Using JVM default truststore: /home/runner/work/_temp/sonar-scanner-cli-7.1.0.4889-Linux-X64/jre/lib/security/cacerts
10:32:50.423 DEBUG Create: /home/runner/.sonar/cache
10:32:50.423 INFO User cache: /home/runner/.sonar/cache
10:32:50.424 DEBUG Create: /home/runner/.sonar/cache/_tmp
...
10:33:21.028 DEBUG 'Generic Coverage Report' skipped because of missing configuration requirements.
Accessed configuration:
- sonar.genericcoverage.reportPath: <empty>
- sonar.genericcoverage.itReportPaths: <empty>
- sonar.typescript.tslint.reportPaths: <empty>
- sonar.coverageReportPaths: <empty>
- sonar.javascript.lcov.reportPaths: ./coverage-combined/lcov-cypress-Components/lcov.info, ./coverage-combined/lcov-cypress-E2E/lcov.info, ./coverage-combined/lcov-cypress-Extensions/lcov.info, ./coverage-combined/lcov-cypress-Modules/lcov.info, ./coverage-combined/lcov-cypress-Workspace/lcov.info, ./coverage-combined/lcov-vitest/lcov.info
- sonar.genericcoverage.reportPaths: <empty>
- sonar.genericcoverage.overallReportPaths: <empty>
- sonar.css.stylelint.reportPaths: <empty>
- sonar.externalIssuesReportPaths: <empty>
...
10:34:00.888 INFO Sensor JavaScript/TypeScript Coverage [javascript]
10:34:00.889 DEBUG Property sonar.javascript.lcov.reportPaths is used.
10:34:00.889 DEBUG Using './coverage-combined/lcov-cypress-Workspace/lcov.info' to resolve LCOV files
10:34:00.934 INFO No LCOV files were found using ./coverage-combined/lcov-cypress-Workspace/lcov.info
10:34:00.934 DEBUG Using './coverage-combined/lcov-cypress-Components/lcov.info' to resolve LCOV files
10:34:00.968 INFO No LCOV files were found using ./coverage-combined/lcov-cypress-Components/lcov.info
10:34:00.968 DEBUG Using './coverage-combined/lcov-cypress-Extensions/lcov.info' to resolve LCOV files
10:34:00.996 INFO No LCOV files were found using ./coverage-combined/lcov-cypress-Extensions/lcov.info
10:34:00.996 DEBUG Using './coverage-combined/lcov-cypress-Modules/lcov.info' to resolve LCOV files
10:34:01.025 INFO No LCOV files were found using ./coverage-combined/lcov-cypress-Modules/lcov.info
10:34:01.025 DEBUG Using './coverage-combined/lcov-cypress-E2E/lcov.info' to resolve LCOV files
10:34:01.054 INFO No LCOV files were found using ./coverage-combined/lcov-cypress-E2E/lcov.info
10:34:01.054 DEBUG Using './coverage-combined/lcov-vitest/lcov.info' to resolve LCOV files
10:34:01.083 INFO No LCOV files were found using ./coverage-combined/lcov-vitest/lcov.info
10:34:01.083 WARN No coverage information will be saved because all LCOV files cannot be found.
10:34:01.084 INFO Sensor JavaScript/TypeScript Coverage [javascript] (done) | time=195ms
Potential workaround
- I’ve tried adding the
reportPaths
configuration directly into the job, with theargs
; no success - I’ve tried different variations of the paths in the
reportPaths
; no success - The LCOV directory has been created (empty) in the repo; no success
Questions
- Is the fact that I’m using a free account impacting on the code coverage?
- Is the fact that I’m running a PR impacting, since the free account only supports
master
? - Is the fact that the LCOV are created on-the-fly in the pipeline (rather than being committed with the code) impacting ?