Skip to content

Enhance Testcoverage (#61) #116

Enhance Testcoverage (#61)

Enhance Testcoverage (#61) #116

Workflow file for this run

name: Build
on:
push:
branches:
- main
- master
- develop
pull_request:
branches:
- main
- master
- develop
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Set up JDK 21
uses: actions/[email protected]
with:
java-version: '21'
distribution: 'temurin'
cache: 'gradle'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Upload test results
uses: actions/[email protected]
if: always()
with:
name: test-results
path: build/reports/tests/test/
retention-days: 7
- name: Add coverage to PR
id: jacoco
uses: madrapps/[email protected]
with:
paths: ${{ github.workspace }}/build/customJacocoReportDir/test/jacocoTestReport.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 85
min-coverage-changed-files: 75
title: Code Coverage
update-comment: true
- name: Fail PR if overall coverage is less than 85%
if: ${{ steps.jacoco.outputs.coverage-overall < 85.0 }}
uses: actions/github-script@v8
with:
script: |
core.setFailed('Overall coverage is less than 85%!')
- name: Upload build artifacts
uses: actions/[email protected]
with:
name: build-artifacts
path: build/libs/*.jar
retention-days: 7