Skip to content
This repository has been archived by the owner on Jul 20, 2020. It is now read-only.

Install the Sonar Scanner CLI in GitHub Actions workflow.

License

Notifications You must be signed in to change notification settings

mathrix-education/sonar-scanner

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

@mathrix-education/sonar-scanner

Workflow status Latest release

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.

Name Type Default value
version 'latest' / string
with-jre true / false false
options string ''
typescript true / false false
unshallow true / false false
scan true / false false
args string ''

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

with-jre

Use the bundled JRE in the Sonar Scanner CLI archive.

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 this 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 -Dsonar.login=${{ secrets.SONAR_TOKEN }}