-
Notifications
You must be signed in to change notification settings - Fork 18
65 lines (61 loc) · 2.23 KB
/
coverage-report-workflow.yaml
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
63
64
65
name: Code coverage Reporter
# This gets called when ./coverage-report-pull-request.yaml has completed. See that file
# for why this is split into two.
on:
workflow_run:
workflows: [ "Code coverage Builder" ]
types:
- completed
jobs:
build:
permissions:
contents: read
pull-requests: write
name: Run code coverage analysis and reporting
runs-on: ubuntu-latest
steps:
- name: Download artifacts
# It would have been nice to be able to use actions/download-artifact@v2
# for this, but as the artifacts are uploaded by another workflow it does
# not seem possible - so we need to do this stuff instead
uses: actions/[email protected]
with:
script: |
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
console.log(artifacts);
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "input-artifacts"
})[0];
var download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/input.zip', Buffer.from(download.data));
- name: Set needed env vars in outputs
id: prepare
run: |
unzip -u input.zip
echo current directory contents
ls -al
- uses: actions/setup-java@v4
name: Setup Java
with:
distribution: temurin
java-version: 11
cache: maven
- name: Add coverage to PR
id: jacoco
uses: madrapps/[email protected]
with:
paths: ${{ github.workspace }}/api/target/site/jacoco/jacoco.xml,${{ github.workspace }}/runtime/target/site/jacoco/jacoco.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 50
min-coverage-changed-files: 75
debug-mode: true