Skip to content

Commit 75bffec

Browse files
committed
add covr GH Action
1 parent d72b733 commit 75bffec

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/workflows/test-coverage.yaml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
on:
4+
push:
5+
branches: [main, dev]
6+
pull_request:
7+
branches: [main, dev]
8+
9+
name: test-coverage
10+
11+
permissions: read-all
12+
13+
jobs:
14+
test-coverage:
15+
runs-on: ubuntu-latest
16+
env:
17+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Setup VDAT
23+
uses: mhpob/setup-vdat-action@v1
24+
with:
25+
gitlab-auth: ${{ secrets.GITLAB_TOKEN }}
26+
27+
- uses: r-lib/actions/setup-r@v2
28+
with:
29+
use-public-rspm: true
30+
31+
- uses: r-lib/actions/setup-r-dependencies@v2
32+
with:
33+
extra-packages: any::covr, any::xml2
34+
needs: coverage
35+
36+
- name: Test coverage
37+
run: |
38+
cov <- covr::package_coverage(
39+
quiet = FALSE,
40+
clean = FALSE,
41+
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
42+
)
43+
covr::to_cobertura(cov)
44+
shell: Rscript {0}
45+
46+
- uses: codecov/codecov-action@v4
47+
with:
48+
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
49+
file: ./cobertura.xml
50+
plugin: noop
51+
disable_search: true
52+
token: ${{ secrets.CODECOV_TOKEN }}
53+
54+
- name: Show testthat output
55+
if: always()
56+
run: |
57+
## --------------------------------------------------------------------
58+
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
59+
shell: bash
60+
61+
- name: Upload test results
62+
if: failure()
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: coverage-test-failures
66+
path: ${{ runner.temp }}/package

0 commit comments

Comments
 (0)