Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#217: JaCoCo Report workflow is not checking server module coverage #218

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 26 additions & 12 deletions .github/workflows/jacoco_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ on:
env:
scalaLong: 2.13.11
scalaShort: "2.13"
overall: 60.0
changed: 80.0
coverage-overall: 60.0
coverage-changed-files: 80.0
check-overall-coverages: true

jobs:
build-test-and-measure:
Expand Down Expand Up @@ -66,8 +67,8 @@ jobs:
with:
paths: ${{ github.workspace }}/model/target/jvm-${{ env.scalaShort }}/jacoco/report/jacoco.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: ${{ env.overall }}
min-coverage-changed-files: ${{ env.changed }}
min-coverage-overall: ${{ env.coverage-overall }}
min-coverage-changed-files: ${{ env.coverage-changed-files }}
title: JaCoCo model module code coverage report - scala ${{ env.scalaLong }}
update-comment: true
- name: Add coverage to PR (agent)
Expand All @@ -77,8 +78,8 @@ jobs:
with:
paths: ${{ github.workspace }}/agent/target/spark3-jvm-${{ env.scalaShort }}/jacoco/report/jacoco.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: ${{ env.overall }}
min-coverage-changed-files: ${{ env.changed }}
min-coverage-overall: ${{ env.coverage-overall }}
min-coverage-changed-files: ${{ env.coverage-changed-files }}
title: JaCoCo agent module code coverage report - scala ${{ env.scalaLong }}
update-comment: true
- name: Add coverage to PR (server)
Expand All @@ -88,8 +89,8 @@ jobs:
with:
paths: ${{ github.workspace }}/server/target/jvm-${{ env.scalaShort }}/jacoco/report/jacoco.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: ${{env.overall }}
min-coverage-changed-files: ${{ env.changed }}
min-coverage-overall: ${{env.coverage-overall }}
min-coverage-changed-files: ${{ env.coverage-changed-files }}
title: JaCoCo server module code coverage report - scala ${{ env.scalaLong }}
update-comment: true
- name: Get the Coverage info
Expand All @@ -101,16 +102,29 @@ jobs:
echo "Changed Files coverage ${{ steps.jacoco-model.outputs.coverage-changed-files }}"
echo "Total server module coverage ${{ steps.jacoco-server.outputs.coverage-overall }}"
echo "Changed Files coverage ${{ steps.jacoco-server.outputs.coverage-changed-files }}"
- name: Fail PR if changed files coverage is less than ${{ env.changed }}%
- name: Fail PR if changed files coverage is less than ${{ env.coverage-changed-files }}%
if: steps.jacocorun.outcome == 'success'
uses: actions/github-script@v6
with:
script: |
const coverageCheckFailed =
Number('${{ steps.jacoco-agent.outputs.coverage-changed-files }}') < Number('${{ env.changed }}') ||
Number('${{ steps.jacoco-model.outputs.coverage-changed-files }}') < Number('${{ env.changed }}');
Number('${{ steps.jacoco-agent.outputs.coverage-changed-files }}') < Number('${{ env.coverage-changed-files }}') ||
Number('${{ steps.jacoco-server.outputs.coverage-changed-files }}') < Number('${{ env.coverage-changed-files }}') ||
Number('${{ steps.jacoco-model.outputs.coverage-changed-files }}') < Number('${{ env.coverage-changed-files }}');
if (coverageCheckFailed) {
core.setFailed('Changed files coverage is less than ${{ env.changed }}%!');
core.setFailed('Changed files coverage is less than ${{ env.coverage-changed-files }}%!');
}
- name: Fail PR if overall files coverage is less than ${{ env.coverage-overall }}%
if: ${{ (steps.jacocorun.outcome == 'success') && (env.check-overall-coverages == 'true') }}
uses: actions/github-script@v6
with:
script: |
const coverageCheckFailed =
Number('${{ steps.jacoco-agent.outputs.coverage-overall }}') < Number('${{ env.coverage-overall }}') ||
Number('${{ steps.jacoco-server.outputs.coverage-overall }}') < Number('${{ env.coverage-overall }}') ||
Number('${{ steps.jacoco-model.outputs.coverage-overall }}') < Number('${{ env.coverage-overall }}');
if (coverageCheckFailed) {
core.setFailed('Overall coverage is less than ${{ env.coverage-overall }}%!');
}
- name: Edit JaCoCo comments on build failure
if: steps.jacocorun.outcome != 'success'
Expand Down
Loading