Skip to content

Commit 38ba0fd

Browse files
Codecov
1 parent ce12a4a commit 38ba0fd

3 files changed

Lines changed: 62 additions & 0 deletions

File tree

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
^.*\.Rproj$
22
^\.Rproj\.user$
3+
^\.github$

.github/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.html
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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, master]
6+
pull_request:
7+
8+
name: test-coverage.yaml
9+
10+
permissions: read-all
11+
12+
jobs:
13+
test-coverage:
14+
runs-on: ubuntu-latest
15+
env:
16+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
17+
18+
steps:
19+
- uses: actions/checkout@v6
20+
21+
- uses: r-lib/actions/setup-r@v2
22+
23+
- uses: r-lib/actions/setup-r-dependencies@v2
24+
with:
25+
extra-packages: any::covr, any::xml2
26+
needs: coverage
27+
28+
- name: Test coverage
29+
run: |
30+
cov <- covr::package_coverage(
31+
quiet = FALSE,
32+
clean = FALSE,
33+
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
34+
)
35+
print(cov)
36+
covr::to_cobertura(cov)
37+
shell: Rscript {0}
38+
39+
- uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6
40+
with:
41+
# Fail if error if not on PR, or if on PR and token is given
42+
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
43+
files: ./cobertura.xml
44+
plugins: noop
45+
disable_search: true
46+
token: ${{ secrets.CODECOV_TOKEN }}
47+
48+
- name: Show testthat output
49+
if: always()
50+
run: |
51+
## --------------------------------------------------------------------
52+
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
53+
shell: bash
54+
55+
- name: Upload test results
56+
if: failure()
57+
uses: actions/upload-artifact@v7
58+
with:
59+
name: coverage-test-failures
60+
path: ${{ runner.temp }}/package

0 commit comments

Comments
 (0)