Skip to content

Commit

Permalink
Merge pull request #414 from wso2/codecov-workflow
Browse files Browse the repository at this point in the history
Generate code coverage reports for build workflows
  • Loading branch information
keizer619 authored Sep 12, 2024
2 parents 88bf213 + 918f69c commit 9b5ec0f
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/pull_request_ubuntu_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@ jobs:
cache: maven
- name: Build with Maven
run: mvn clean install
- name: Upload test coverage to Codecov
uses: codecov/codecov-action@v4.0.1
with:
flags: unit_tests
token: ${{ secrets.CODECOV_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,16 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.4</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<inherited>false</inherited>
<version>2.22.2</version>
<configuration>

<argLine>-Xms512m -Xmx1024m</argLine>
<argLine>${argLine}</argLine>
<disableXmlReport>false</disableXmlReport>
<parallel>false</parallel>
<systemProperties>
Expand Down
56 changes: 56 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,62 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.4</version>
<executions>
<execution>
<id>default-prepare-agent-by-coverage-enforcer</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>argLine</propertyName>
</configuration>
</execution>
<execution>
<id>default-report-by-coverage-enforcer</id>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${project.build.directory}/jacoco.exec</dataFile>
</configuration>
</execution>
<execution>
<id>default-check-by-coverage-enforcer</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<dataFile>${project.build.directory}/jacoco.exec</dataFile>
<rules>
<!-- implementation is needed only for Maven 2 -->
<rule implementation="org.jacoco.maven.RuleConfiguration">
<element>BUNDLE</element>
<limits>
<!-- implementation is needed only for Maven 2 -->
<limit implementation="org.jacoco.report.check.Limit">
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>0.0</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<argLine>@{argline} -Xms512m -Xmx1024m</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
Expand Down

0 comments on commit 9b5ec0f

Please sign in to comment.