Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
upload-cloud

GitHub Action

Scan with Sonar Scanner

0.1.1

Scan with Sonar Scanner

upload-cloud

Scan with Sonar Scanner

Sonar Scanner on Github Actions

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Scan with Sonar Scanner

uses: mathrix-education/sonar-scanner@0.1.1

Learn more about this action in mathrix-education/sonar-scanner

Choose a version

@mathrix-education/sonar-scanner

Install the Sonar Scanner CLI in GitHub Actions workflow.

This project is not supported by Sonar Cloud.

Proudly maintained by Mathieu Bour, Vice-CTO @mathrix-education.

Motivations

If the official SonarSource/sonarcloud-github-action action works perfectly, the fact that it is based on Docker makes it quite slow since you have to build the Docker image before using it. Moreover, the official action is mainly build for Sonar Cloud and using it when hosting your own Sonarqube instance can be quite tricky.

This goal of this action is to provide a fast and reliable way to run Sonar Scanner on every platform by using the provided JDK.

Supported operating systems

All operating systems provided by GitHub Actions are supported. The supported operating systems matrix is the following:

Operating system Status
ubuntu-latest 3.1
macos-latest 3.1
windows-latest 3.1

Usage

Inputs

See action.yml for details.

version

The version is required since it is used to download Sonar Scanner. You can find the available versions on the official Sonar Scanner repository

options

The options input will set the default sonar-project.properties values by writing into the conf/sonar-project.properties file. This input is useful if you do not have a sonar-project.properties file in your project.

typescript (true/false, default false)

Install TypeScript during the setup. Useful only if you want to analyse TypeScript code.

scan (true/false, default false)

Run the sonar-scanner command immediately after the setup.

args

Additional flags to append to the sonar-scanner command. It will be ignored if scan is set to false.

Examples

To analyse the repository, we would add the following code to our workflow:

- uses: mathrix-education/sonar-scanner@master
  with:
    version: 4.2.0.1873 # required
    typescript: true
    scan: true
    args: --debug