forked from pangaea-data-publisher/fuji
-
Notifications
You must be signed in to change notification settings - Fork 4
78 lines (74 loc) · 2.85 KB
/
reports.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Reports
on:
workflow_run:
workflows: [CI]
types:
- completed
permissions: {}
jobs:
# Ref: https://github.com/EnricoMi/publish-unit-test-result-action#support-fork-repositories-and-dependabot-branches
test-results:
runs-on: ubuntu-22.04
if: github.event.workflow_run.conclusion != 'skipped'
permissions:
checks: write
# required to create pull request comments
pull-requests: write
# required by download step to access artifacts API
actions: read
steps:
- name: Download and Extract Artifacts
uses: dawidd6/action-download-artifact@09f2f74827fd3a8607589e5ad7f9398816f540fe # v3.1.4
with:
run_id: ${{ github.event.workflow_run.id }}
path: artifacts
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@30eadd5010312f995f0d3b3cff7fe2984f69409e # v2.16.1
with:
comment_title: ':clipboard: Pytest Results'
commit: ${{ github.event.workflow_run.head_sha }}
event_file: artifacts/event-file/event.json
event_name: ${{ github.event.workflow_run.event }}
files: artifacts/test-results/pytest-junit.xml
coverage-results:
runs-on: ubuntu-22.04
if: github.event.workflow_run.conclusion != 'skipped'
permissions:
# required to create pull request comments
pull-requests: write
# required by download step to access artifacts API
actions: read
steps:
- name: Download and Extract Artifacts
uses: dawidd6/action-download-artifact@09f2f74827fd3a8607589e5ad7f9398816f540fe # v3.1.4
with:
run_id: ${{ github.event.workflow_run.id }}
path: artifacts
# Ref: https://github.com/irongut/CodeCoverageSummary#usage
- name: Generate Code Coverage Report
uses: irongut/CodeCoverageSummary@51cc3a756ddcd398d447c044c02cb6aa83fdae95 # v1.3.0
with:
filename: artifacts/coverage-results/pytest-cobertura.xml
badge: true
format: markdown
hide_complexity: true
output: both
- name: Add header to code coverage report
run: |
sed -i '1s/^/## :clipboard: Code Coverage\n/' code-coverage-results.md
- name: Write to Job Summary
run: |
cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
- name: Get Pull Request number
run: |
echo "number=$(jq .pull_request.number artifacts/event-file/event.json)" >> $GITHUB_OUTPUT
id: get-pr-number
# Ref: https://github.com/marocchino/sticky-pull-request-comment#inputs
- name: Add Code Coverage PR Comment
if: ${{ steps.get-pr-number.outputs.number }} != null
uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2.9.0
with:
recreate: true
number: ${{ steps.get-pr-number.outputs.number }}
path: code-coverage-results.md
# TODO: Coverage badge