SonarQube GitHub Actions can't find lcov.info and test-report.xml, but works locally

Hi folks,

I’m trying to run SonarQube (sonarcloud.io) as part of our GitHub Actions workflow, and I’m facing an issue. SonarQube complains about coverage/lcov.info and test-report.xml not being present, but I’m pretty sure they both are. My problem might be a path issue though.

When running sonar-scanner locally, everything works fine. When pushing to GitHub.com, the pipeline starts, parses sonar-project.properties as expected, but fails since it can’t find test-report.xml and coverage/lcov.info.

Analysis parameters (apart of project key, github organization and host url)

sonar.sources=.
sonar.tests=.
sonar.eslint.eslintconfigpath=node_modules/eslintrc.json
sonar.inclusions=**/*.js
sonar.exclusions=node_modules/*,schemas/*,**/*.spec.js,public/js/details-element-polyfill.js
sonar.test.inclusions=**/*.spec.js
sonar.test.exclusions=schemas/*
sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.testExecutionReportPaths=test-report.xml

Error message on GitHub Actions

> 2019-10-21T14:55:49.1941073Z INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
2019-10-21T14:55:49.1951771Z INFO: Project root configuration file: /github/workspace/sonar-project.properties

2019-10-21T14:55:49.2319386Z INFO: SonarQube Scanner 3.3.0.1492

2019-10-21T14:55:49.2330980Z INFO: Java 11.0.5 Oracle Corporation (64-bit)

2019-10-21T14:55:49.2332440Z INFO: Linux 5.0.0-1020-azure amd64

2019-10-21T14:55:49.5670544Z INFO: User cache: /root/.sonar/cache

2019-10-21T14:55:52.9685868Z INFO: SonarQube server 8.0.0

2019-10-21T14:55:52.9690594Z INFO: Default locale: "en", source code encoding: "UTF-8" (analysis is platform dependent)

2019-10-21T14:55:53.3251127Z INFO: Load global settings

2019-10-21T14:55:54.2235214Z INFO: Load global settings (done) | time=899ms

2019-10-21T14:55:54.2289420Z INFO: Server id: 74E9293D-AWHW8ct9-T_TB3XqouNu

2019-10-21T14:55:54.2315036Z INFO: User cache: /root/.sonar/cache

2019-10-21T14:55:54.2351427Z INFO: Load/download plugins

2019-10-21T14:55:54.2353911Z INFO: Load plugins index

2019-10-21T14:55:54.4421975Z INFO: Load plugins index (done) | time=207ms

2019-10-21T14:56:17.3698415Z INFO: Load/download plugins (done) | time=23135ms

2019-10-21T14:56:17.7024176Z INFO: Loaded core extensions: developer-scanner

2019-10-21T14:56:18.3394413Z INFO: Process project properties

2019-10-21T14:56:18.3464556Z INFO: Execute project builders

2019-10-21T14:56:18.3502128Z INFO: Execute project builders (done) | time=3ms

2019-10-21T14:56:18.3527257Z INFO: Project key: my_github_org_my-repository-name

2019-10-21T14:56:18.3532688Z INFO: Base dir: /github/workspace

2019-10-21T14:56:18.3537945Z INFO: Working dir: /github/workspace/.scannerwork

2019-10-21T14:56:18.3579986Z INFO: Load project settings for component key: 'my_github_org_my-repository-name'

2019-10-21T14:56:18.5593736Z INFO: Load project settings for component key: 'my_github_org_my-repository-name' (done) | time=201ms

2019-10-21T14:56:18.6326353Z INFO: Load project branches

2019-10-21T14:56:18.8904853Z INFO: Load project branches (done) | time=258ms

2019-10-21T14:56:18.8928968Z INFO: Load projects for organization 'my_github_org'

2019-10-21T14:56:19.4773043Z INFO: Load projects for organization 'my_github_org' (done) | time=581ms

2019-10-21T14:56:19.4773708Z INFO: Load project pull requests

2019-10-21T14:56:19.6438115Z INFO: Load project pull requests (done) | time=169ms

2019-10-21T14:56:19.6464622Z INFO: Load branch configuration

2019-10-21T14:56:19.6479561Z INFO: Github event: push

2019-10-21T14:56:19.8800787Z INFO: Detected GitHub Actions

2019-10-21T14:56:19.8808075Z INFO: Auto-configuring branch sonarqube-github-action

2019-10-21T14:56:19.8817121Z INFO: Load branch configuration (done) | time=236ms

2019-10-21T14:56:19.9052209Z INFO: Load quality profiles

2019-10-21T14:56:20.1252577Z INFO: Load quality profiles (done) | time=220ms

2019-10-21T14:56:20.1338644Z INFO: Detected Github Actions

2019-10-21T14:56:20.1418824Z INFO: Load active rules

2019-10-21T14:56:24.8380636Z INFO: Load active rules (done) | time=4696ms

2019-10-21T14:56:24.8685500Z INFO: Organization key: my_github_org

2019-10-21T14:56:24.8697323Z INFO: Branch name: sonarqube-github-action, type: short living

2019-10-21T14:56:24.8947888Z INFO: SCM collecting changed files in the branch

2019-10-21T14:56:25.1038946Z INFO: SCM collecting changed files in the branch (done) | time=209ms

2019-10-21T14:56:25.1355277Z INFO: Indexing files...

2019-10-21T14:56:25.1360772Z INFO: Project configuration:

2019-10-21T14:56:25.1367748Z INFO: Included sources: **/*.js

2019-10-21T14:56:25.1372965Z INFO: Excluded sources: node_modules/*, schemas/*, **/*.spec.js, public/js/details-element-polyfill.js, **/*.spec.js

2019-10-21T14:56:25.1378099Z INFO: Included tests: **/*.spec.js

2019-10-21T14:56:25.1382075Z INFO: Excluded tests: schemas/*

2019-10-21T14:56:25.3682047Z INFO: 31 files indexed

2019-10-21T14:56:25.3691448Z INFO: 0 files ignored because of inclusion/exclusion patterns

2019-10-21T14:56:25.3696647Z INFO: 0 files ignored because of scm ignore settings

2019-10-21T14:56:25.3706827Z INFO: Quality profile for js: Sonar way

2019-10-21T14:56:25.3712846Z INFO: ------------- Run sensors on module my_github_org_my-repository-name

2019-10-21T14:56:25.5195126Z INFO: Load metrics repository

2019-10-21T14:56:25.6910942Z INFO: Load metrics repository (done) | time=168ms

2019-10-21T14:56:26.7364433Z WARNING: An illegal reflective access operation has occurred

2019-10-21T14:56:26.7367642Z WARNING: Illegal reflective access by net.sf.cglib.core.ReflectUtils$1 (file:/root/.sonar/cache/a89f1943fc75b65becd9fb4ecab8d913/sonar-tsql-plugin.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)

2019-10-21T14:56:26.7370673Z WARNING: Please consider reporting this to the maintainers of net.sf.cglib.core.ReflectUtils$1

2019-10-21T14:56:26.7371341Z WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations

2019-10-21T14:56:26.7371609Z WARNING: All illegal access operations will be denied in a future release

2019-10-21T14:56:28.6250014Z INFO: Sensor JavaXmlSensor [java]

2019-10-21T14:56:28.6260524Z INFO: Sensor JavaXmlSensor [java] (done) | time=1ms

2019-10-21T14:56:28.6260963Z INFO: Sensor HTML [web]

2019-10-21T14:56:28.6294704Z INFO: Sensor HTML [web] (done) | time=4ms

2019-10-21T14:56:28.6294921Z INFO: Sensor JaCoCo XML Report Importer [jacoco]

2019-10-21T14:56:28.6322165Z INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=2ms

2019-10-21T14:56:28.6323112Z INFO: Sensor ESLint-based JavaScript analysis [javascript]

2019-10-21T14:56:31.1314743Z INFO: 20 source files to be analyzed

2019-10-21T14:56:31.9847771Z INFO: Sensor ESLint-based JavaScript analysis [javascript] (done) | time=3353ms

2019-10-21T14:56:31.9848072Z INFO: Sensor SonarJS Coverage [javascript]

2019-10-21T14:56:31.9862639Z INFO: 20/20 source files have been analyzed

2019-10-21T14:56:31.9868594Z WARN: No coverage information will be saved because LCOV file cannot be found.

2019-10-21T14:56:31.9870514Z WARN: Provided LCOV file path: coverage/lcov.info. Seek file with path: /github/workspace/coverage/lcov.info

2019-10-21T14:56:31.9877326Z WARN: No coverage information will be saved because all LCOV files cannot be found.

2019-10-21T14:56:31.9877616Z INFO: Sensor SonarJS Coverage [javascript] (done) | time=3ms

2019-10-21T14:56:31.9877836Z INFO: Sensor SonarJS [javascript]

2019-10-21T14:56:31.9925854Z INFO: 20 source files to be analyzed

2019-10-21T14:56:33.2635516Z INFO: 20/20 source files have been analyzed

2019-10-21T14:56:33.2635810Z INFO: Sensor SonarJS [javascript] (done) | time=1276ms

2019-10-21T14:56:33.2640599Z INFO: Sensor Generic Test Executions Report

2019-10-21T14:56:33.2646296Z INFO: Parsing /github/workspace/test-report.xml

2019-10-21T14:56:33.5151461Z INFO: ------------------------------------------------------------------------

2019-10-21T14:56:33.5151749Z INFO: EXECUTION FAILURE

2019-10-21T14:56:33.5152582Z INFO: ------------------------------------------------------------------------

2019-10-21T14:56:33.5152810Z INFO: Total time: 44.322s

2019-10-21T14:56:33.6053306Z INFO: Final Memory: 28M/94M

2019-10-21T14:56:33.6058472Z ERROR: Error during SonarQube Scanner execution

2019-10-21T14:56:33.6059564Z INFO: ------------------------------------------------------------------------

2019-10-21T14:56:33.6060959Z ERROR: Error during parsing of generic test execution report '/github/workspace/test-report.xml'. Look at the SonarQube documentation to know the expected XML format.

2019-10-21T14:56:33.6061698Z ERROR: Caused by: /github/workspace/test-report.xml (No such file or directory)

2019-10-21T14:56:33.6062124Z ERROR: 

2019-10-21T14:56:33.6062639Z ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

2019-10-21T14:56:34.5684028Z ##[error]Docker run failed with exit code 1

2019-10-21T14:56:34.5787953Z Cleaning up orphan processes

The application is an Express app. Code coverage mode is enabled by default.

Thank you

Welcome to the community!

Why do you think the files are present?

Just for the record, sonarcloud.io is SonarCloud, not “SonarQube”. They are different products of SonarSource :wink: