SonarCloud coverage and actions/cache@v3 on Github actions

I recently added actions/cache@v3 into our GitHub Actions. Upon the initial run, everything functioned correctly, and SonarCloud successfully reported code coverage. However, after the second run—when the caching mechanism was activated—SonarCloud displayed a message stating: “Coverage A few extra steps are needed for SonarCloud to analyze your code coverage.” Upon reviewing the logs, I found the following messages related to the coverage reports:

INFO: Merging coverage reports from sonar.javascript.lcov.reportPaths and sonar.typescript.lcov.reportPaths.
INFO: No LCOV files were found using packages/**/coverage/lcov.info
INFO: No LCOV files were found using apps/**/coverage/lcov.info
WARN: No coverage information will be saved because all LCOV files cannot be found.

Could anyone provide some guidance on how to ensure that SonarCloud can locate and analyze the code coverage accurately even when caching is used?

You should find out where the coverage folder is generated after running the coverage command, then add a similar path to the config section for SonarCloud.

1 Like

Thank you for your suggestion! To clarify, the initial setup appears to be correct, as the coverage reports are generated and detected by SonarCloud successfully on the first run. The issue arises on subsequent runs, after enabling GitHub Actions’ caching with actions/cache@v3.Is there a recommended practice for caching coverage reports that might help SonarCloud consistently locate and analyze them across multiple runs?