diff --git a/.github/workflows/sonar.yaml b/.github/workflows/sonar.yaml index 57f44fbe95..07c4a188e1 100644 --- a/.github/workflows/sonar.yaml +++ b/.github/workflows/sonar.yaml @@ -1,4 +1,6 @@ name: SonarCloud Build +env: + SHOWCASE_VERSION: 0.25.0 on: push: branches: @@ -41,3 +43,39 @@ jobs: -Dsonar.organization=googleapis \ -Dsonar.host.url=https://sonarcloud.io + - name: Install showcase server + run: | + sudo mkdir -p /usr/src/showcase + sudo chown -R ${USER} /usr/src/ + curl --location https://github.com/googleapis/gapic-showcase/releases/download/v${SHOWCASE_VERSION}/gapic-showcase-${SHOWCASE_VERSION}-linux-amd64.tar.gz --output /usr/src/showcase/showcase-${SHOWCASE_VERSION}-linux-amd64.tar.gz + cd /usr/src/showcase/ + tar -xf showcase-* + ./gapic-showcase run & + cd - + - name: Build and analyze Showcase Integration Tests Coverage + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: | + mvn -B clean verify -Dcheckstyle.skip \ + -DskipUnitTests \ + -Penable-integration-tests \ + -DenableTestCoverage \ + org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \ + -Dsonar.projectKey=googleapis_gapic-generator-java_integration_tests \ + -Dsonar.organization=googleapis \ + -Dsonar.host.url=https://sonarcloud.io \ + -Dsonar.projectName=java_showcase_integration_tests + - name: Build and analyze Showcase Unit Tests Coverage + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: | + mvn -B clean test -Dcheckstyle.skip \ + -DenableTestCoverage \ + org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \ + -Dsonar.projectKey=googleapis_gapic-generator-java_unit_tests \ + -Dsonar.organization=googleapis \ + -Dsonar.host.url=https://sonarcloud.io \ + -Dsonar.projectName=java_showcase_unit_tests + diff --git a/coverage-report/README.md b/coverage-report/README.md index 9326c426a2..efd70b29b8 100644 --- a/coverage-report/README.md +++ b/coverage-report/README.md @@ -1,23 +1,22 @@ ## Coverage Report -This module gathers aggregated jacoco test coverage metrics across the `gax-java` and `showcase` modules. The purpose of -the metrics is to provide insights into how much of GAX code is being exercised by showcase and GAX tests and where -(unit tests versus integration tests). They will also provide information on any change in coverage observed -as showcase tests continue to be added to the repository. +This module gathers aggregated jacoco test coverage metrics across the `api-common`, `gax-java` and `showcase` modules. The purpose of +the metrics is to provide insights into how much of api-common and GAX code is being exercised by showcase, GAX and api-common tests and where +(unit tests versus integration tests). They will also assist with tracking any changes in coverage as showcase tests continue to be added to the repository. ### Unit Test Coverage -In order to view aggregate unit test coverage of GAX in both `gax-java` and `showcase`: +In order to view aggregate unit test coverage of api-common and GAX in `api-common`, `gax-java` and `showcase`: 1. At the root of the repository, run `mvn clean test -DenableTestCoverage`. 2. The metrics can be found at `gapic-generator-java/coverage-report/target/site/jacoco-aggregate/index.html` -![Screenshot 2023-03-03 at 6 32 50 PM](https://user-images.githubusercontent.com/66699525/222854612-787b4dde-f9a3-469a-8227-8f46dc0a4a20.png) +![Screenshot 2023-03-21 at 12 25 41 PM](https://user-images.githubusercontent.com/66699525/226675190-5225e778-99d4-44d0-8177-29d48d1c35ee.png) ### Integration Test Coverage -In order to view aggregate integration test coverage of GAX in both `gax-java` and `showcase`: +In order to view aggregate integration test coverage of api-common and GAX in `api-common`, `gax-java` and `showcase`: 1. At the root of the repository, run `mvn clean verify -DskipUnitTests -DenableTestCoverage -Penable-integration-tests`. 2. The metrics can be found at `gapic-generator-java/coverage-report/target/site/jacoco-aggregate/index.html` -![Screenshot 2023-03-03 at 6 36 26 PM](https://user-images.githubusercontent.com/66699525/222854973-f8a96f01-abc1-4e6b-9ab8-99b5e50dec6a.png) \ No newline at end of file +![Screenshot 2023-03-21 at 12 26 26 PM](https://user-images.githubusercontent.com/66699525/226675461-97a1c4b5-a90f-470d-b0c8-51e63a35a548.png) diff --git a/coverage-report/pom.xml b/coverage-report/pom.xml index 7851a2aa7f..758cc38c8f 100644 --- a/coverage-report/pom.xml +++ b/coverage-report/pom.xml @@ -32,17 +32,22 @@ com.google.api gax - 2.23.3-SNAPSHOT + 2.23.4-SNAPSHOT com.google.api gax-grpc - 2.23.3-SNAPSHOT + 2.23.4-SNAPSHOT com.google.api gax-httpjson - 0.108.3-SNAPSHOT + 0.108.4-SNAPSHOT + + + com.google.api + api-common + 2.6.4-SNAPSHOT diff --git a/gapic-generator-java-pom-parent/pom.xml b/gapic-generator-java-pom-parent/pom.xml index 1c7a9ce31d..a21ade9749 100644 --- a/gapic-generator-java-pom-parent/pom.xml +++ b/gapic-generator-java-pom-parent/pom.xml @@ -177,7 +177,6 @@ - google-maven-central-copy diff --git a/gapic-generator-java/pom.xml b/gapic-generator-java/pom.xml index 1369a3a310..be17f1fdd3 100644 --- a/gapic-generator-java/pom.xml +++ b/gapic-generator-java/pom.xml @@ -76,6 +76,19 @@ + + + + showcase-sonar-analysis + + + enableTestCoverage + + + + true + + diff --git a/java-common-protos/pom.xml b/java-common-protos/pom.xml index 4b4a8661db..e9af505a23 100644 --- a/java-common-protos/pom.xml +++ b/java-common-protos/pom.xml @@ -174,4 +174,19 @@ + + + + + showcase-sonar-analysis + + + enableTestCoverage + + + + true + + + diff --git a/java-iam/pom.xml b/java-iam/pom.xml index 4d43b05cb9..db3b24f19c 100644 --- a/java-iam/pom.xml +++ b/java-iam/pom.xml @@ -218,4 +218,19 @@ + + + + + showcase-sonar-analysis + + + enableTestCoverage + + + + true + + + diff --git a/pom.xml b/pom.xml index 8cf21209d2..8d0f6cd2fa 100644 --- a/pom.xml +++ b/pom.xml @@ -89,6 +89,9 @@ showcase coverage-report + + ${maven.multiModuleProjectDirectory}/coverage-report/target/site/jacoco-aggregate/jacoco.xml +