-
Notifications
You must be signed in to change notification settings - Fork 37
62 lines (51 loc) · 1.8 KB
/
coverage.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Report coverage
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v1
with:
java-version: '8'
- name: Build with Maven
run: mvn -B verify --file pom.xml
- name: Merge coverage
run: mvn jacoco:merge@merge-id -pl starts-core
- name: Report
run: mvn jacoco:report@report-id -pl starts-core
- name: Generate JaCoCo Badge
id: jacoco
uses: cicirello/jacoco-badge-generator@v2
with:
jacoco-csv-file: starts-core/target/site/jacoco-merged/jacoco.csv
generate-branches-badge: true
- name: Log coverage percentage
run: |
echo "coverage = ${{ steps.jacoco.outputs.coverage }}"
echo "branch coverage = ${{ steps.jacoco.outputs.branches }}"
- name: Commit and push the badge (if it changed)
uses: EndBug/add-and-commit@v7
if: ${{ github.event_name == 'push' }}
with:
default_author: github_actions
message: 'commit badge'
add: '*.svg'
# Getting: RequestError [HttpError]: Resource not accessible by integration
# - name: Add comment to PR
# uses: actions/github-script@v4
# if: ${{ github.event_name == 'pull_request' }}
# with:
# github-token: ${{secrets.GITHUB_TOKEN}}
# script: |
# github.issues.createComment({
# issue_number: context.issue.number,
# owner: context.repo.owner,
# repo: context.repo.repo,
# body: 'Statement coverage = ${{ steps.jacoco.outputs.coverage }}\n\nBranch coverage = ${{ steps.jacoco.outputs.branches }}'
# })