Skip to content

Commit

Permalink
Merge pull request #18 from NipunaMadhushan/main
Browse files Browse the repository at this point in the history
Add code coverage report
  • Loading branch information
keizer619 authored Sep 27, 2024
2 parents 01ee02a + d2df9ee commit 708e70e
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/pull_request_ubuntu_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI - Pull request - Ubuntu

on:
pull_request:

jobs:
build-handler:
name: Build Transaction Counting Handler
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Build with Maven
working-directory: ./counter
run: mvn package --file pom.xml
- name: Upload test coverage to Codecov
uses: codecov/codecov-action@v4

build-service:
name: Build Transaction Counting Service
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Ballerina
uses: ballerina-platform/setup-ballerina@v1
with:
version: '2201.8.0'
- name: Build Ballerina service
working-directory: ./service
run: bal build
59 changes: 59 additions & 0 deletions counter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,65 @@
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</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>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<argLine>${argLine}</argLine>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.2</version>
</plugin>
</plugins>
</build>

Expand Down

0 comments on commit 708e70e

Please sign in to comment.