-
Notifications
You must be signed in to change notification settings - Fork 1
SonarCloud
Jonathan Austin edited this page Feb 13, 2019
·
8 revisions
- Log into SonarCloud with your GitHub account
- Create a new organization for your team under Account -> Organisations. The
key
of the organization will be used in thetravis.yml
. - Install SonarCloud GitHub Application on your GitHub Organization.
- Give SonarCloud access to the repos you want analysed.
Note - SonarCloud currently does not trigger analyses automatically. It's up to you to launch them inside your existing CI scripts. Installing the application on your organization just removes the need to configure a user token on SonarCloud for the pull request decoration. Automatic analysis is coming.
- It is very easy to integrate GitHub and Travis-ci by installing the Travis-ci GitHub Application. Follow the instructions at Travis-ci Tutorial.
- Log into SonarCloud with GitHub account
- Create a new project under Administration -> Projects Management. The
key
of the project will be used in the repo'stravis.yml
. - Define the
sonarcloud addon
in the repo'stravis.yml
(example below)
addons:
sonarcloud:
organization: "sonarcloud_organization_key" # the key of the org you created
token:
secure: ********* # encrypted value of your access token
script:
# The following command line builds the project, runs the tests with coverage and then execute the SonarCloud analysis
- mvn package sonar:sonar -Dsonar.projectKey="sonarcloud_project_key"
- Create SonarCloud access token for the project under Account -> Security.
- Encrypt access token via Travis CLI (sample commands below). Travis encrypts the token for a specific repo. This is done by running the encryption command in the repo's project directory.
- Copy encrypted text into travis.yml
gem install travis
## As using travis-ci.com we need to login first
travis login --pro
## Change into your project repo directory
cd project
## Encrypt the access token you generated
travis encrypt --com <access-token>