-
Notifications
You must be signed in to change notification settings - Fork 5
98 lines (85 loc) · 2.68 KB
/
test-coverage.yaml
File metadata and controls
98 lines (85 loc) · 2.68 KB
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
89
90
91
92
93
94
95
96
97
98
name: test-coverage
on:
push:
branches: ['**']
pull_request:
branches: [develop]
types: [opened, reopened, synchronize, ready_for_review]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: write
checks: write
statuses: read
pull-requests: write
jobs:
test-coverage:
# Skip draft PRs; run on non-PR triggers and non-draft PR events
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
EQ_API_KEY: ${{ secrets.EQ_API_KEY }}
steps:
- uses: actions/checkout@v6
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
any::covr
any::xml2
- name: Capture Environment Info
run: |
Rscript -e '
env_vars <- Sys.getenv()
pkg_versions <- installed.packages()[, c("Package", "Version")]
sys_info <- Sys.info()
save(env_vars, pkg_versions, sys_info, file = "ci_env_info.RData")
'
- name: Upload Environment Info
uses: actions/upload-artifact@v4
with:
name: ci_env_info
path: ci_env_info.RData
- name: Test coverage
shell: Rscript {0}
run: |
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
print(cov)
covr::to_cobertura(cov, file = "cobertura.xml")
- name: Show testthat output
if: always()
run: |
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
if-no-files-found: ignore
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: ./cobertura.xml
- name: Comment coverage
uses: 5monkeys/cobertura-action@master
with:
report_name: coverage-report
path: ./cobertura.xml
minimum_coverage: 10
only_changed_files: false
show_missing: true
link_missing_lines: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}