From 7233c38567d0666592283eb2a0647cf31a7e9464 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Tue, 26 Apr 2022 14:43:23 +0530 Subject: [PATCH] .github: enable PR sonar integration Signed-off-by: Rohit Yadav --- .github/workflows/coverage-check.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/coverage-check.yml b/.github/workflows/coverage-check.yml index fc53ae14081..8667583aa05 100644 --- a/.github/workflows/coverage-check.yml +++ b/.github/workflows/coverage-check.yml @@ -66,13 +66,31 @@ jobs: java-version: '11' cache: 'maven' + - name: Cache SonarCloud packages + uses: actions/cache@v3 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + + - name: Cache local Maven repository + uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-m2 + - name: Run Build and Tests with Coverage id: coverage if: steps.java-changes.outputs.any_changed == 'true' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: | git clone https://github.com/shapeblue/cloudstack-nonoss.git nonoss cd nonoss && bash -x install-non-oss.sh && cd .. - mvn -P quality -Dsimulator -Dnoredist clean install + mvn -P quality -Dsimulator -Dnoredist clean verify install org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=apachecloudstack echo "COVERAGE<> $GITHUB_ENV for file in ${{ steps.java-changes.outputs.all_changed_files }}; do