-
Notifications
You must be signed in to change notification settings - Fork 8
88 lines (78 loc) · 2.65 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Coverage
on:
push:
branches:
- develop
- main
paths:
- .github/workflows/coverage.yml
- cmake/**
- include/**
- tests/**
- CMakeLists.txt
- Makefile
# to grant pull-requests write permission to fork repos as well
pull_request_target:
paths:
- .github/workflows/coverage.yml
- cmake/**
- include/**
- tests/**
- CMakeLists.txt
- Makefile
workflow_dispatch:
jobs:
coverage:
timeout-minutes: 10
runs-on: ubuntu-22.04
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{github.head_ref}}
submodules: recursive
- name: Install lcov
run: |
sudo apt-get update
sudo apt-get install -y lcov
lcov -v
- name: Generate coverage
run: make html-coverage
- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{secrets.GITHUB_TOKEN}}
file: ${{github.workspace}}/build_coverage/coverage/fkYAML.info
format: lcov
- name: Decide the artifact name
id: create_zip
if: github.event_name == 'pull_request_target'
env:
PR_NUMBER: ${{github.event.number}}
run: |
echo "artifact name: fkYAML_coverage.pr${{env.PR_NUMBER}}"
echo "artifact_name=fkYAML_coverage.pr${{env.PR_NUMBER}}" >> $GITHUB_OUTPUT
- name: Upload coverage as an artifact
id: upload_artifact_step
if: steps.create_zip.conclusion == 'success'
uses: actions/upload-artifact@v4
with:
name: ${{steps.create_zip.outputs.artifact_name}}
path: |
${{github.workspace}}/build_coverage/coverage/*
${{github.workspace}}/build_coverage/html/**
overwrite: true
- name: Notify the artifact URL
if: steps.upload_artifact_step.conclusion == 'success'
uses: thollander/actions-comment-pull-request@v2
with:
message: |
## :octocat: Upload Coverage Event Notification
Coverage data has been uploaded for the commit [${{github.event.pull_request.head.sha}}](https://github.com/${{github.repository}}/commit/${{github.event.pull_request.head.sha}}).
You can download the artifact which contains the same file uploaded to the Coveralls and its HTML version.
| Name | ${{steps.create_zip.outputs.artifact_name}}.zip |
|:-----|:-----------------------------------------------------|
| ID | ${{steps.upload_artifact_step.outputs.artifact-id}} |
| URL | ${{steps.upload_artifact_step.outputs.artifact-url}} |
comment_tag: notification