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.
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.
All operating systems provided by GitHub Actions are supported. The supported operating systems matrix is the following:
Operating system | Status |
---|---|
ubuntu-latest |
|
macos-latest |
|
windows-latest |
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 |
'' |
The version
is required since it is used to download Sonar Scanner.
You can find the available versions on the official Sonar Scanner
repository
Use the bundled JRE in the Sonar Scanner CLI archive.
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.
Install TypeScript during the setup. Useful only if you want to analyse TypeScript code.
Run the sonar-scanner
command immediately after the setup.
Additional flags to append to the sonar-scanner
command. It will be
ignored if scan
is set to false
.
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 }}