Skip to content
name: On pull request push, perform a build with test reports shown and coverage evaluated (and compared with main)
on:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: 11
cache: 'maven'
- name: Build with Maven
run: mvn -B test --file pom.xml -Pcoverage -Daadarchi.github.token="$TOKEN_FOR_GITHUB" -Daadarchi.gitlab.token="$TOKEN_FOR_GITLAB"
env:
TOKEN_FOR_GITHUB: ${{ secrets.TOKEN_FOR_GITHUB }}
TOKEN_FOR_GITLAB: ${{ secrets.TOKEN_FOR_GITLAB }}
# Seen on https://stackoverflow.com/a/70405596/15619
- name: Detect all jacoco.xml files
uses: mathiasvr/command-output@v1
id: list-reports
with:
run: find . -iname jacoco.xml
- name: Add coverage to PR
id: jacoco
uses: madrapps/jacoco-report@v1.3
with:
paths: ${{ steps.list-reports.outputs.stdout }}
token: "${{ secrets.GITHUB_TOKEN }}"
min-coverage-overall: 10
min-coverage-changed-files: 50
title: Current coverage (as computed by Jacoco)
update-comment: true