The following is a quick recipe to run SonarCloud using GitHub actions.
name: nightly
on:
[push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v1
- name: Set up Java 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Build with Maven
run: mvn -B -DskipTests=true -f pom.xml clean install
- name: Analyze with SonarCloud
run: |
mvn --no-transfer-progress -B install verify site \
sonar:sonar -Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }} \
-Dsonar.organization=piranhacloud -Dsonar.host.url=https://sonarcloud.io \
-Dsonar.login=${{ secrets.SONAR_LOGIN }}
And then set SONAR_PROJECT_KEY and SONAR_LOGIN as a secrets in your GitHub repository.
Posted June 21st, 2021