Skip to content

Commit

Permalink
* JaCoCo
Browse files Browse the repository at this point in the history
  • Loading branch information
benedeki committed May 24, 2024
1 parent a89a3f8 commit 0651c35
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 137 deletions.
117 changes: 0 additions & 117 deletions .github/workflows/jacoco_check_server.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#

name: JaCoCo report agent and module
name: JaCoCo report

on:
pull_request:
Expand All @@ -28,48 +28,71 @@ env:
changed: 80.0

jobs:
test:
name: Build and test
build-test-and-measure:
name: Build, test and measure
runs-on: ubuntu-latest

services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: atum_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Scala
uses: olafurpg/setup-scala@v14
with:
java-version: "[email protected]"
java-version: "[email protected]"
- name: Prepare testing database
run: sbt flywayMigrate
- name: Build and run tests
continue-on-error: true
id: jacocorun
run: |
sbt "project agent; jacoco"
sbt "project model; jacoco"
# agent module code coverage
- name: Add coverage to PR
run: sbt jacoco
- name: Add coverage to PR (model)
if: steps.jacocorun.outcome == 'success'
id: jacoco-model
uses: madrapps/jacoco-report@${{ env.jaCocoReportVersion }}
with:
name: model-jacoco-report
paths: ${{ github.workspace }}/model/target/jvm-${{ env.scalaShort12 }}/jacoco/report/jacoco.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: ${{ env.overall }}
min-coverage-changed-file: ${{ env.changed }}
title: JaCoCo model module code coverage report - scala ${{ env.scalaLong12 }}
update-comment: true
- name: Add coverage to PR (agent)
if: steps.jacocorun.outcome == 'success'
id: jacoco-agent
uses: madrapps/jacoco-report@v1.6.1
uses: madrapps/jacoco-report@${{ env.jaCocoReportVersion }}
with:
name: agent-jacoco-report
paths: ${{ github.workspace }}/agent/target/jvm-${{ env.scalaShort }}/jacoco/report/jacoco.xml
paths: ${{ github.workspace }}/agent/target/jvm-${{ env.scalaShort12 }}/jacoco/report/jacoco.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: ${{ env.overall }}
min-coverage-changed-file: ${{ env.changed }}
title: JaCoCo agent module code coverage report - scala ${{ env.scalaLong }}
title: JaCoCo agent module code coverage report - scala ${{ env.scalaLong12 }}
update-comment: true
# model module code coverage
- name: Add coverage to PR
- name: Add coverage to PR (server)
if: steps.jacocorun.outcome == 'success'
id: jacoco-model
id: jacoco-server
uses: madrapps/[email protected]
with:
name: model-jacoco-report
paths: ${{ github.workspace }}/model/target/jvm-${{ env.scalaShort }}/jacoco/report/jacoco.xml
paths: ${{ github.workspace }}/server/target/jvm-${{ env.scalaShort }}/jacoco/report/jacoco.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: ${{ env.overall }}
min-coverage-changed-file: ${{ env.changed }}
title: JaCoCo model module code coverage report - scala ${{ env.scalaLong }}
min-coverage-overall: ${{env.overall }}
min-coverage-changed-files: ${{ env.changed }}
title: JaCoCo server module code coverage report - scala ${{ env.scalaLong }}
update-comment: true
- name: Get the Coverage info
if: steps.jacocorun.outcome == 'success'
Expand All @@ -78,6 +101,8 @@ jobs:
echo "Changed Files coverage ${{ steps.jacoco-agent.outputs.coverage-changed-files }}"
echo "Total model module coverage ${{ steps.jacoco-model.outputs.coverage-overall }}"
echo "Changed Files coverage ${{ steps.jacoco-model.outputs.coverage-changed-files }}"
echo "Total sever 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 }}%
if: steps.jacocorun.outcome == 'success'
uses: actions/github-script@v6
Expand Down

0 comments on commit 0651c35

Please sign in to comment.