Update kotlin monorepo to v2.1.0 #250
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test coverage | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "**" ] | |
env: | |
coverage-required-overall: 75.0 | |
coverage-required-changed: 80.0 | |
jobs: | |
report-coverage: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4.2.2 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4.5.0 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
cache: maven | |
- name: Test with Maven | |
run: mvn -B -U test jacoco:report | |
- name: Add coverage to PR | |
id: jacoco | |
uses: madrapps/jacoco-report@v1.7.1 | |
with: | |
paths: | | |
${{ github.workspace }}/**/target/site/jacoco/jacoco.xml | |
token: ${{ secrets.GITHUB_TOKEN }} | |
min-coverage-overall: ${{ env.coverage-required-overall }} | |
min-coverage-changed-files: ${{ env.coverage-required-changed }} | |
continue-on-error: false | |
update-comment: true | |
title: "Test coverage report" | |
pass-emoji: ":green_circle:" | |
- run: echo 'Coverage overall ${{ steps.jacoco.outputs.coverage-overall }} of ${{ env.coverage-required-overall }}%' | |
- run: echo 'Coverage on changed code ${{ steps.jacoco.outputs.coverage-changed-files }} of ${{ env.coverage-required-changed }}%' | |
- name: Fail if overall coverage is less than ${{ env.coverage-required-overall }}% | |
if: ${{ fromJSON(steps.jacoco.outputs.coverage-overall) < fromJSON(env.coverage-required-overall) }} | |
uses: actions/github-script@v7.0.1 | |
with: | |
script: | | |
core.setFailed('Overall coverage is less than ${{ env.coverage-required-overall }}%! Current value: ${{ steps.jacoco.outputs.coverage-overall }}') | |
- name: Fail PR if coverage of changed code is less than ${{ env.coverage-required-changed }}% | |
if: ${{ github.event_name == 'pull_request' && fromJSON(steps.jacoco.outputs.coverage-changed-files) < fromJSON(env.coverage-required-changed) }} | |
uses: actions/github-script@v7.0.1 | |
with: | |
script: | | |
core.setFailed('Coverage of changed code is less than ${{ env.coverage-required-changed }}%! Current value: ${{ steps.jacoco.outputs.coverage-changed-files }}') |