Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
d7c919a
chore: add aggregate test coverage collection for showcase and gax
mpeddada1 Mar 2, 2023
135022c
add profile to collect test coverage
mpeddada1 Mar 2, 2023
d2be02f
add fmt-maven-plugin
mpeddada1 Mar 2, 2023
22cda89
add maven compiler version property
mpeddada1 Mar 2, 2023
cd0de15
skip fmt
mpeddada1 Mar 2, 2023
cddb9f2
add version to fmt plugin
mpeddada1 Mar 2, 2023
c116da1
add jar plugin to showcase
mpeddada1 Mar 2, 2023
208cfff
add jar plugin to gapic-showcase
mpeddada1 Mar 2, 2023
02ef0cb
empty commit to rerun builds
mpeddada1 Mar 2, 2023
7f720b8
empty commit
mpeddada1 Mar 3, 2023
68557fe
fix syntax in dep declaration
mpeddada1 Mar 3, 2023
57ddf93
remove spaces
mpeddada1 Mar 3, 2023
fcc5257
add README for coverage-report module
mpeddada1 Mar 6, 2023
45a0987
replace monorepo with repsitory in README
mpeddada1 Mar 6, 2023
47cf349
add profile to specify modules
mpeddada1 Mar 10, 2023
e61d6ea
chore: add sonarcloud reporting for showcase test coverage
mpeddada1 Mar 13, 2023
83f085d
Merge branch 'main' into sonar-coverage
mpeddada1 Mar 13, 2023
d4ba320
fix yaml syntax
mpeddada1 Mar 13, 2023
b856e7f
Merge branch 'sonar-coverage' of github.com:googleapis/gapic-generato…
mpeddada1 Mar 13, 2023
f574ec8
fix spacing
mpeddada1 Mar 13, 2023
61bb283
comment out previous step
mpeddada1 Mar 13, 2023
6c54fbe
avoid calling clean in mvn command
mpeddada1 Mar 13, 2023
644edc8
modify syntax:
mpeddada1 Mar 13, 2023
afcf7b1
omit yaml formatting
mpeddada1 Mar 13, 2023
cff1fa4
install and run showcase server
mpeddada1 Mar 13, 2023
b9db44f
set SHOWCASE VERSION env variable
mpeddada1 Mar 13, 2023
75a51ec
use forked repo for verification
mpeddada1 Mar 13, 2023
6972c9f
undo change
mpeddada1 Mar 13, 2023
7aab6ca
uncomment previous build step and temporarily address syntax error
mpeddada1 Mar 14, 2023
34869ff
omit mvn clean
mpeddada1 Mar 14, 2023
0d342c8
add mvn clean install
mpeddada1 Mar 14, 2023
5aa2013
call mvn install
mpeddada1 Mar 14, 2023
36d1633
remove mvn clean install
mpeddada1 Mar 14, 2023
6f7ead4
comment out unit test job
mpeddada1 Mar 14, 2023
63cec27
update SNAPSHOT versions
mpeddada1 Mar 14, 2023
efc6ecc
add clean
mpeddada1 Mar 14, 2023
9d676c0
add unit test step
mpeddada1 Mar 14, 2023
03fd1b9
fix syntax
mpeddada1 Mar 14, 2023
74fbf20
fix syntax
mpeddada1 Mar 14, 2023
7e4202a
rebase with main
mpeddada1 Mar 16, 2023
6264511
clean up pom.xml
mpeddada1 Mar 16, 2023
5a662a1
add api-common coverage
mpeddada1 Mar 21, 2023
1ab860b
fix pom syntax
mpeddada1 Mar 21, 2023
bcd8299
update screenshots in README
mpeddada1 Mar 21, 2023
27afb2e
fix renovate version comments
mpeddada1 Mar 21, 2023
4b60a61
Merge branch 'sonar-coverage' of github.com:googleapis/gapic-generato…
mpeddada1 Mar 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/sonar.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name: SonarCloud Build
env:
Copy link
Contributor

@blakeli0 blakeli0 Mar 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have showcase version here and in ci-maven.yaml as well, I'm not very familiar with Github actions, is it possible to configure a shared SHOWCASE_VERSION?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is! According to the docs, shared variables can be created by doing Settings > secrets and variables > Actions > Manage environments. However, I'm not able to see the Settings tab for this repo so I think it requires some special permissions?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are going to have hermetic builds, the version needs to be stored in source.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thank you. Managing the variables in Settings may not be the best solution in that case. I'm inclined to keep the duplicate showcase_versions until an alternate solution becomes available in favor of making the builds self-contained and maintaining visibility into the showcase version we are testing against. Open to hearing more thoughts on this though.

SHOWCASE_VERSION: 0.25.0
on:
push:
branches:
Expand Down Expand Up @@ -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

15 changes: 7 additions & 8 deletions coverage-report/README.md
Original file line number Diff line number Diff line change
@@ -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)
![Screenshot 2023-03-21 at 12 26 26 PM](https://user-images.githubusercontent.com/66699525/226675461-97a1c4b5-a90f-470d-b0c8-51e63a35a548.png)
11 changes: 8 additions & 3 deletions coverage-report/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,22 @@
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax</artifactId>
<version>2.23.3-SNAPSHOT</version> <!-- {x-version-update:gax:current} -->
<version>2.23.4-SNAPSHOT</version> <!-- {x-version-update:gax:current} -->
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-grpc</artifactId>
<version>2.23.3-SNAPSHOT</version> <!-- {x-version-update:gax:current} -->
<version>2.23.4-SNAPSHOT</version> <!-- {x-version-update:gax-grpc:current} -->
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-httpjson</artifactId>
<version>0.108.3-SNAPSHOT</version> <!-- {x-version-update:gax:current} -->
<version>0.108.4-SNAPSHOT</version> <!-- {x-version-update:gax-httpjson:current} -->
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>api-common</artifactId> <!-- {x-version-update:api-common:current} -->
<version>2.6.4-SNAPSHOT</version>
</dependency>
</dependencies>

Expand Down
1 change: 0 additions & 1 deletion gapic-generator-java-pom-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@
</build>
</profile>
</profiles>

<repositories>
<repository>
<id>google-maven-central-copy</id>
Expand Down
13 changes: 13 additions & 0 deletions gapic-generator-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,19 @@
</plugins>
</build>
</profile>

<!-- Skip gapic-generator-java when analyzing showcase test coverage on SonarCloud -->
<profile>
<id>showcase-sonar-analysis</id>
<activation>
<property>
<name>enableTestCoverage</name>
</property>
</activation>
<properties>
<sonar.skip>true</sonar.skip>
</properties>
</profile>
</profiles>

<build>
Expand Down
15 changes: 15 additions & 0 deletions java-common-protos/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,19 @@
</plugin>
</plugins>
</reporting>

<!-- Skip google-common-protos when analyzing showcase test coverage on SonarCloud -->
<profiles>
<profile>
<id>showcase-sonar-analysis</id>
<activation>
<property>
<name>enableTestCoverage</name>
</property>
</activation>
<properties>
<sonar.skip>true</sonar.skip>
</properties>
</profile>
</profiles>
</project>
15 changes: 15 additions & 0 deletions java-iam/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,19 @@
</plugin>
</plugins>
</reporting>

<!-- Skip java-iam when analyzing showcase test coverage on SonarCloud -->
<profiles>
<profile>
<id>showcase-sonar-analysis</id>
<activation>
<property>
<name>enableTestCoverage</name>
</property>
</activation>
<properties>
<sonar.skip>true</sonar.skip>
</properties>
</profile>
</profiles>
</project>
3 changes: 3 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@
<module>showcase</module>
<module>coverage-report</module>
</modules>
<properties>
<sonar.coverage.jacoco.xmlReportPaths>${maven.multiModuleProjectDirectory}/coverage-report/target/site/jacoco-aggregate/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
</properties>
</profile>
</profiles>

Expand Down