Template for a good new topic, formatted with Markdown:
- ALM used: GitHub
- CI system used: GitHub Actions
- Scanner command used when applicable:
Run ${GITHUB_ACTION_PATH}/scripts/run-sonar-scanner-cli.sh
${GITHUB_ACTION_PATH}/scripts/run-sonar-scanner-cli.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
SONAR_TOKEN: ***
INPUT_PROJECTBASEDIR:
SONAR_SCANNER_JRE: /home/runner/work/_temp/sonar-scanner-cli-7.1.0.4889-Linux-X64/jre
- Languages of the repository: Swift
- Only if the SonarCloud project is public, the URL: Example project
- Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
09:22:48.311 INFO Scanner configuration file: /home/runner/work/_temp/sonar-scanner-cli-7.1.0.4889-Linux-X64/conf/sonar-scanner.properties
09:22:48.315 INFO Project root configuration file: /home/runner/work/dojo.smelly-mars-rover/dojo.smelly-mars-rover/sonar-project.properties
09:22:48.330 INFO SonarScanner CLI 7.1.0.4889
09:22:48.332 INFO Java 17.0.13 Eclipse Adoptium (64-bit)
09:22:48.332 INFO Linux 6.11.0-1012-azure amd64
09:22:48.363 INFO User cache: /home/runner/.sonar/cache
09:22:49.004 INFO Communicating with SonarQube Cloud
09:22:49.005 INFO JRE provisioning: os[linux], arch[x86_64]
09:22:52.463 INFO Starting SonarScanner Engine...
09:22:52.464 INFO Java 17.0.11 Eclipse Adoptium (64-bit)
09:22:53.261 INFO Load global settings
09:22:53.982 INFO Load global settings (done) | time=724ms
09:22:53.986 INFO Server id: 1BD809FA-AWHW8ct9-T_TB3XqouNu
09:22:54.170 INFO Loading required plugins
09:22:54.170 INFO Load plugins index
09:22:54.365 INFO Load plugins index (done) | time=195ms
09:22:54.365 INFO Load/download plugins
09:22:55.047 INFO Load/download plugins (done) | time=682ms
09:22:55.387 INFO Found an active CI vendor: 'Github Actions'
09:22:55.393 INFO Load project settings for component key: 'jbehrens94_dojo.smelly-mars-rover'
09:22:55.873 INFO Load project settings for component key: 'jbehrens94_dojo.smelly-mars-rover' (done) | time=481ms
09:22:55.878 INFO Process project properties
09:22:55.885 INFO Project key: jbehrens94_dojo.smelly-mars-rover
09:22:55.885 INFO Base dir: /home/runner/work/dojo.smelly-mars-rover/dojo.smelly-mars-rover
09:22:55.885 INFO Working dir: /home/runner/work/dojo.smelly-mars-rover/dojo.smelly-mars-rover/.scannerwork
09:22:55.890 INFO Load project branches
09:22:56.157 INFO Load project branches (done) | time=267ms
09:22:56.159 INFO Check ALM binding of project 'jbehrens94_dojo.smelly-mars-rover'
09:22:56.276 INFO Detected project binding: BOUND
09:22:56.276 INFO Check ALM binding of project 'jbehrens94_dojo.smelly-mars-rover' (done) | time=116ms
09:22:56.277 INFO Load project pull requests
09:22:56.442 INFO Load project pull requests (done) | time=165ms
09:22:56.444 INFO Load branch configuration
09:22:56.445 INFO Github event: push
09:22:56.447 INFO Auto-configuring branch main
09:22:56.448 INFO Load branch configuration (done) | time=4ms
09:22:56.455 INFO Load quality profiles
09:22:56.866 INFO Load quality profiles (done) | time=411ms
09:22:56.871 INFO Load active rules
09:23:06.249 INFO Load active rules (done) | time=9378ms
09:23:06.447 INFO Organization key: jbehrens94
09:23:06.448 INFO Branch name: main, type: long-lived
09:23:06.461 INFO Preprocessing files...
09:23:06.534 INFO 1 language detected in 3 preprocessed files
09:23:06.534 INFO 0 files ignored because of inclusion/exclusion patterns
09:23:06.534 INFO 0 files ignored because of scm ignore settings
09:23:06.590 INFO Loading plugins for detected languages
09:23:06.591 INFO Load/download plugins
09:23:06.623 INFO Load/download plugins (done) | time=33ms
09:23:06.660 INFO Load project repositories
09:23:06.889 INFO Load project repositories (done) | time=230ms
09:23:06.892 INFO Indexing files...
09:23:06.892 INFO Project configuration:
09:23:06.893 INFO Excluded sources: **/build-wrapper-dump.json
09:23:06.899 INFO 3 files indexed
09:23:06.902 INFO Quality profile for swift: Sonar way
09:23:06.902 INFO ------------- Run sensors on module MarsRover
09:23:06.922 INFO Load metrics repository
09:23:07.069 INFO Load metrics repository (done) | time=147ms
09:23:07.073 INFO Sensor cache enabled
09:23:07.206 INFO Load sensor cache
09:23:07.983 INFO Load sensor cache (404) | time=777ms
09:23:08.272 INFO Sensor JaCoCo XML Report Importer [jacoco]
09:23:08.272 INFO 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
09:23:08.272 INFO No report imported, no coverage information will be imported by JaCoCo XML Report Importer
09:23:08.273 INFO Sensor JaCoCo XML Report Importer [jacoco] (done) | time=2ms
09:23:08.273 INFO Sensor Java Config Sensor [iac]
09:23:08.295 INFO 0 source files to be analyzed
09:23:08.306 INFO 0/0 source files have been analyzed
09:23:08.307 INFO Sensor Java Config Sensor [iac] (done) | time=34ms
09:23:08.307 INFO Sensor Swift Code Quality and Security [swift]
09:23:08.312 INFO 2 source files to be analyzed
09:23:09.102 INFO 2/2 source files have been analyzed
09:23:09.103 INFO Sensor Swift Code Quality and Security [swift] (done) | time=796ms
09:23:09.103 INFO Sensor IaC Docker Sensor [iac]
09:23:09.168 INFO 0 source files to be analyzed
09:23:09.169 INFO 0/0 source files have been analyzed
09:23:09.170 INFO Sensor IaC Docker Sensor [iac] (done) | time=64ms
09:23:09.171 INFO Sensor Generic Coverage Report
09:23:09.172 INFO Parsing /home/runner/work/dojo.smelly-mars-rover/dojo.smelly-mars-rover/coverage.xml
09:23:09.199 INFO Imported coverage data for 0 files
09:23:09.201 INFO Coverage data ignored for 2 unknown files, including:
/Users/runner/work/dojo.smelly-mars-rover/dojo.smelly-mars-rover/Sources/MarsRoverKit/MarsRoverKit.swift
/Users/runner/work/dojo.smelly-mars-rover/dojo.smelly-mars-rover/Tests/MarsRoverTests/MarsRoverTests.swift
09:23:09.201 INFO Sensor Generic Coverage Report (done) | time=31ms
09:23:09.201 INFO Sensor EnterpriseTextAndSecretsSensor [textenterprise]
09:23:09.202 INFO Available processors: 4
09:23:09.202 INFO Using 4 threads for analysis.
09:23:09.667 INFO Using git CLI to retrieve untracked files
09:23:09.770 INFO Analyzing language associated files and files included via "sonar.text.inclusions" that are tracked by git
09:23:09.779 INFO 3 source files to be analyzed
09:23:09.830 INFO 3/3 source files have been analyzed
09:23:09.831 INFO Sensor EnterpriseTextAndSecretsSensor [textenterprise] (done) | time=630ms
09:23:09.832 INFO ------------- Run sensors on project
09:23:09.937 INFO Sensor Zero Coverage Sensor
09:23:09.941 INFO Sensor Zero Coverage Sensor (done) | time=5ms
09:23:09.948 INFO CPD Executor 1 file had no CPD blocks
09:23:09.948 INFO CPD Executor Calculating CPD for 1 file
09:23:09.952 INFO CPD Executor CPD calculation finished (done) | time=5ms
09:23:13.296 INFO Analysis report generated in 3341ms, dir size=288 KB
09:23:13.316 INFO Analysis report compressed in 20ms, zip size=60 KB
09:23:13.728 INFO Analysis report uploaded in 412ms
09:23:13.729 INFO ANALYSIS SUCCESSFUL, you can find the results at: https://sonarcloud.io/dashboard?id=jbehrens94_dojo.smelly-mars-rover&branch=main
09:23:13.729 INFO Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
09:23:13.729 INFO More about the report processing at https://sonarcloud.io/api/ce/task?id=AZaGAeY72bPTfLnOPvl7
09:23:13.732 INFO Analysis total time: 18.519 s
09:23:13.733 INFO SonarScanner Engine completed successfully
09:23:14.067 INFO EXECUTION SUCCESS
09:23:14.068 INFO Total time: 25.759s
Question
If I have a local clone of the repository I mentioned above, and I run sonar-scanner
locally after generating coverage.xml, it will push 82.9% of coverage to Sonarcloud. However, if I run it from my pipeline on GitHub Actions, it will revert back to 0.0%.
The error that strikes me is:
09:23:09.172 INFO Parsing /home/runner/work/dojo.smelly-mars-rover/dojo.smelly-mars-rover/coverage.xml
09:23:09.199 INFO Imported coverage data for 0 files
09:23:09.201 INFO Coverage data ignored for 2 unknown files, including:
/Users/runner/work/dojo.smelly-mars-rover/dojo.smelly-mars-rover/Sources/MarsRoverKit/MarsRoverKit.swift
/Users/runner/work/dojo.smelly-mars-rover/dojo.smelly-mars-rover/Tests/MarsRoverTests/MarsRoverTests.swift
Which means that the coverage.xml file doesn’t seem to match what Sonarcloud wants. However, locally, I get this log:
11:24:50.523 INFO Parsing /Users/jbehrens/Developer/Dojo.smelly-mars-rover/coverage.xml
11:24:50.548 INFO Imported coverage data for 2 files
What could be going on?