Skip to content

Commit c8588fd

Browse files
committed
Update README and CI configuration to enhance test coverage reporting and improve workflow efficiency
1 parent f72c511 commit c8588fd

3 files changed

Lines changed: 46 additions & 29 deletions

File tree

Lines changed: 43 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,62 @@
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
13
on:
24
push:
3-
branches:
4-
- main
5-
- master
5+
branches: [main, master]
66
pull_request:
7-
branches:
8-
- main
9-
- master
107

11-
name: test-coverage
8+
name: test-coverage.yaml
9+
10+
permissions: read-all
1211

1312
jobs:
1413
test-coverage:
15-
runs-on: macOS-latest
14+
runs-on: ubuntu-latest
1615
env:
1716
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
17+
1818
steps:
19-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v4
2020

21-
- uses: r-lib/actions/setup-r@v1
21+
- uses: r-lib/actions/setup-r@v2
22+
with:
23+
use-public-rspm: true
2224

23-
- uses: r-lib/actions/setup-pandoc@v1
25+
- uses: r-lib/actions/setup-r-dependencies@v2
26+
with:
27+
extra-packages: any::covr, any::xml2
28+
needs: coverage
2429

25-
- name: Query dependencies
30+
- name: Test coverage
2631
run: |
27-
install.packages('remotes')
28-
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
29-
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
32+
cov <- covr::package_coverage(
33+
quiet = FALSE,
34+
clean = FALSE,
35+
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
36+
)
37+
print(cov)
38+
covr::to_cobertura(cov)
3039
shell: Rscript {0}
3140

32-
- name: Cache R packages
33-
uses: actions/cache@v2
41+
- uses: codecov/codecov-action@v5
3442
with:
35-
path: ${{ env.R_LIBS_USER }}
36-
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
37-
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
38-
39-
- name: Install dependencies
43+
# Fail if error if not on PR, or if on PR and token is given
44+
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
45+
files: ./cobertura.xml
46+
plugins: noop
47+
disable_search: true
48+
token: ${{ secrets.CODECOV_TOKEN }}
49+
50+
- name: Show testthat output
51+
if: always()
4052
run: |
41-
install.packages(c("remotes"))
42-
remotes::install_deps(dependencies = TRUE)
43-
remotes::install_cran("covr")
44-
shell: Rscript {0}
53+
## --------------------------------------------------------------------
54+
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
55+
shell: bash
4556

46-
- name: Test coverage
47-
run: covr::codecov()
48-
shell: Rscript {0}
57+
- name: Upload test results
58+
if: failure()
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: coverage-test-failures
62+
path: ${{ runner.temp }}/package

README.Rmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ knitr::opts_chunk$set(
2020
[![Codecov test coverage](https://codecov.io/gh/kvasilopoulos/ivx/branch/master/graph/badge.svg)](https://codecov.io/gh/kvasilopoulos/ivx?branch=master)
2121

2222
[![R-CMD-check](https://github.com/kvasilopoulos/ivx/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/kvasilopoulos/ivx/actions/workflows/R-CMD-check.yaml)
23+
[![Codecov test coverage](https://codecov.io/gh/kvasilopoulos/ivx/graph/badge.svg)](https://app.codecov.io/gh/kvasilopoulos/ivx)
2324
<!-- badges: end -->
2425

2526

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ status](https://github.com/kvasilopoulos/ivx/workflows/R-CMD-check/badge.svg)](h
1414
coverage](https://codecov.io/gh/kvasilopoulos/ivx/branch/master/graph/badge.svg)](https://codecov.io/gh/kvasilopoulos/ivx?branch=master)
1515

1616
[![R-CMD-check](https://github.com/kvasilopoulos/ivx/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/kvasilopoulos/ivx/actions/workflows/R-CMD-check.yaml)
17+
[![Codecov test
18+
coverage](https://codecov.io/gh/kvasilopoulos/ivx/graph/badge.svg)](https://app.codecov.io/gh/kvasilopoulos/ivx)
1719
<!-- badges: end -->
1820

1921
Drawing statistical inference on the coefficients of a short- or

0 commit comments

Comments
 (0)