Skip to content

Commit

Permalink
Add Jacoco Code Coverage support (#1725)
Browse files Browse the repository at this point in the history
* Add jacoco prepare-agent phase for codecov

* add jacoco code coverage support

* Add profile to toggle skipping integration tests

* remove jacoco skip flag

* Revert "Add profile to toggle skipping integration tests"

This reverts commit 278f4b0.

---------

Co-authored-by: Anshul Singh <anshul.singh@anshuls-macbook-pro-1.wyvern-sun.ts.net>
  • Loading branch information
anshul98ks123 and Anshul Singh authored Dec 17, 2024
1 parent a7ee363 commit 19c8d62
Show file tree
Hide file tree
Showing 2 changed files with 163 additions and 2 deletions.
139 changes: 139 additions & 0 deletions jacoco-code-coverage/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2024 StarTree Inc
Licensed under the StarTree Community License (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.startree.ai/legal/startree-community-license
Unless required by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OF ANY KIND,
either express or implied.
See the License for the specific language governing permissions and limitations under
the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>ai.startree.thirdeye</groupId>
<artifactId>thirdeye</artifactId>
<version>1.398.0-SNAPSHOT</version>
</parent>

<artifactId>jacoco-code-coverage</artifactId>

<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>ai.startree.thirdeye</groupId>
<artifactId>thirdeye-core</artifactId>
</dependency>
<dependency>
<groupId>ai.startree.thirdeye</groupId>
<artifactId>thirdeye-dataframe</artifactId>
</dependency>
<dependency>
<groupId>ai.startree.thirdeye</groupId>
<artifactId>thirdeye-detectionpipeline</artifactId>
</dependency>
<dependency>
<groupId>ai.startree.thirdeye</groupId>
<artifactId>thirdeye-notification</artifactId>
</dependency>
<dependency>
<groupId>ai.startree.thirdeye</groupId>
<artifactId>thirdeye-persistence</artifactId>
</dependency>
<dependency>
<groupId>ai.startree.thirdeye</groupId>
<artifactId>thirdeye-scheduler</artifactId>
</dependency>
<dependency>
<groupId>ai.startree.thirdeye</groupId>
<artifactId>thirdeye-server</artifactId>
</dependency>
<dependency>
<groupId>ai.startree.thirdeye</groupId>
<artifactId>thirdeye-spi</artifactId>
</dependency>
<dependency>
<groupId>ai.startree.thirdeye</groupId>
<artifactId>thirdeye-worker</artifactId>
</dependency>

<dependency>
<groupId>ai.startree.thirdeye</groupId>
<artifactId>thirdeye-integration-tests</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>ai.startree.thirdeye.plugins</groupId>
<artifactId>thirdeye-pinot</artifactId>
</dependency>
<dependency>
<groupId>ai.startree.thirdeye.plugins</groupId>
<artifactId>thirdeye-detectors</artifactId>
</dependency>
<dependency>
<groupId>ai.startree.thirdeye.plugins</groupId>
<artifactId>thirdeye-oauth</artifactId>
</dependency>
<dependency>
<groupId>ai.startree.thirdeye.plugins</groupId>
<artifactId>thirdeye-notification-email</artifactId>
</dependency>
<dependency>
<groupId>ai.startree.thirdeye.plugins</groupId>
<artifactId>thirdeye-contributors-simple</artifactId>
</dependency>
<dependency>
<groupId>ai.startree.thirdeye.plugins</groupId>
<artifactId>thirdeye-bootstrap-open-core</artifactId>
</dependency>
<dependency>
<groupId>ai.startree.thirdeye.plugins</groupId>
<artifactId>thirdeye-enumerators</artifactId>
</dependency>
<dependency>
<groupId>ai.startree.thirdeye.plugins</groupId>
<artifactId>thirdeye-postprocessors</artifactId>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>report-aggregate</goal>
</goals>
<configuration>
<dataFileIncludes>
<dataFileInclude>**/jacoco.exec</dataFileInclude>
</dataFileIncludes>
<outputDirectory>${project.reporting.outputDirectory}/jacoco-aggregate
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
26 changes: 24 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<module>pinot-test-container</module>
<module>thirdeye-integration-tests</module>
<module>thirdeye-benchmarks</module>
<module>jacoco-code-coverage</module>
</modules>

<properties>
Expand Down Expand Up @@ -173,6 +174,23 @@
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<!-- Sets a property to be re-used in the maven-surefire-plugin JVM argument line -->
<propertyName>surefireArgLine</propertyName>
<destFile>${project.build.directory}/jacoco.exec</destFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
Expand Down Expand Up @@ -263,14 +281,18 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<argLine>
-javaagent:"${settings.localRepository}"/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.time=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED
</argLine>
-javaagent:"${settings.localRepository}"/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar ${surefireArgLine} --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.time=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED </argLine>
<threadCount>1</threadCount>
<systemPropertyVariables>
<!-- using a single configuration file for test logging
Expand Down

0 comments on commit 19c8d62

Please sign in to comment.