Feature/spike jacoco numbers #98
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: CI check JaCoCo code-coverage | |
on: | |
pull_request: | |
branches: [ master ] | |
jobs: | |
test: | |
name: CI check JaCoCo code-coverage | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Scala | |
uses: olafurpg/setup-scala@v10 | |
with: | |
java-version: "[email protected]" | |
- name: Build and run tests | |
run: sbt jacoco | |
- name: Add coverage to PR | |
id: jacoco | |
uses: madrapps/[email protected] | |
with: | |
paths: > | |
${{ github.workspace }}/testApi/target/scala-2.13/jacoco/report/jacoco.xml | |
token: ${{ secrets.GITHUB_TOKEN }} | |
min-coverage-overall: 0.0 | |
min-coverage-changed-files: 80.0 | |
title: JaCoCo code coverage report - ScAPI | |
update-comment: true | |
debug-mode: true | |
- name: Get the Coverage info | |
run: | | |
echo "Total coverage ${{ steps.jacoco.outputs.coverage-overall }}" | |
echo "Changed Files coverage ${{ steps.jacoco.outputs.coverage-changed-files }}" | |
- name: Fail PR if changed files coverage is less than 80% | |
if: ${{ steps.jacoco.outputs.coverage-changed-files < 80.0 }} | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
core.setFailed('Changed files coverage is less than 80%!') |