From 3a546fb21a747a2d596b24a530391b7aedd1ebc7 Mon Sep 17 00:00:00 2001 From: Timur Sadykov Date: Wed, 28 Feb 2024 10:41:01 -0800 Subject: [PATCH] chore: enabling ut coverege check (#1368) * chore: enabling ut coverege check * chore: sonar cloud settings * set current limit --- .github/workflows/sonar.yaml | 45 ++++++++++++++++++++++++++++++++++++ oauth2_http/pom.xml | 27 ++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 .github/workflows/sonar.yaml diff --git a/.github/workflows/sonar.yaml b/.github/workflows/sonar.yaml new file mode 100644 index 000000000..153e51d0f --- /dev/null +++ b/.github/workflows/sonar.yaml @@ -0,0 +1,45 @@ +name: SonarCloud +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened] +jobs: + build: + name: Build + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: temurin + - name: Cache SonarCloud packages + uses: actions/cache@v3 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Cache Maven packages + uses: actions/cache@v3 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + - name: Build and analyze for full test coverage + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: | + mvn -B verify -Dcheckstyle.skip \ + -DenableFullTestCoverage \ + -Dsonar.coverage.jacoco.xmlReportPaths=oauth2_http/target/site/jacoco/jacoco.xml \ + org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \ + -Pcoverage \ + -Dsonar.projectKey=googleapis_google-auth-library-java \ + -Dsonar.organization=googleapis \ + -Dsonar.host.url=https://sonarcloud.io \ No newline at end of file diff --git a/oauth2_http/pom.xml b/oauth2_http/pom.xml index 5b1362ed7..3f677b50e 100644 --- a/oauth2_http/pom.xml +++ b/oauth2_http/pom.xml @@ -183,6 +183,33 @@ sponge_log + + org.jacoco + jacoco-maven-plugin + 0.8.11 + + + jacoco-check + + check + + + + + BUNDLE + + + LINE + COVEREDRATIO + 0.910 + + + + + + + +