From 658c4062020e87b9eb812f28aab4dbf1c40eec93 Mon Sep 17 00:00:00 2001 From: NipunaMadhushan Date: Fri, 27 Sep 2024 17:40:36 +0530 Subject: [PATCH 1/2] Add code coverage report --- .../workflows/pull_request_ubuntu_build.yml | 35 +++++++++++ counter/pom.xml | 59 +++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 .github/workflows/pull_request_ubuntu_build.yml diff --git a/.github/workflows/pull_request_ubuntu_build.yml b/.github/workflows/pull_request_ubuntu_build.yml new file mode 100644 index 0000000..c2a12a2 --- /dev/null +++ b/.github/workflows/pull_request_ubuntu_build.yml @@ -0,0 +1,35 @@ +name: Release Transaction Counting Handler +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 diff --git a/counter/pom.xml b/counter/pom.xml index b3f63f3..b002412 100644 --- a/counter/pom.xml +++ b/counter/pom.xml @@ -141,6 +141,65 @@ true + + org.jacoco + jacoco-maven-plugin + 0.8.4 + + + default-prepare-agent-by-coverage-enforcer + + prepare-agent + + + argLine + + + + default-report-by-coverage-enforcer + + report + + + ${project.build.directory}/jacoco.exec + + + + default-check-by-coverage-enforcer + + check + + + ${project.build.directory}/jacoco.exec + + + + BUNDLE + + + + LINE + COVEREDRATIO + 0.0 + + + + + + + + + + maven-surefire-plugin + 2.22.2 + + ${argLine} + + + + maven-failsafe-plugin + 2.22.2 + From d2df9eed70b8e08a9ece665596ac6315e9b604c8 Mon Sep 17 00:00:00 2001 From: NipunaMadhushan Date: Fri, 27 Sep 2024 17:42:16 +0530 Subject: [PATCH 2/2] Update PR build workflow --- .github/workflows/pull_request_ubuntu_build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull_request_ubuntu_build.yml b/.github/workflows/pull_request_ubuntu_build.yml index c2a12a2..de4a2c6 100644 --- a/.github/workflows/pull_request_ubuntu_build.yml +++ b/.github/workflows/pull_request_ubuntu_build.yml @@ -1,4 +1,5 @@ -name: Release Transaction Counting Handler +name: CI - Pull request - Ubuntu + on: pull_request: