Skip to content

Commit cad9ec7

Browse files
authored
Merge pull request #439 from stan-dev/new-test-coverage-GHA
Swap to r-lib based covr GHA and use OIDC
2 parents 499987a + 5cd3212 commit cad9ec7

5 files changed

Lines changed: 96 additions & 69 deletions

File tree

.Rbuildignore

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
^.*\.Rproj$
2-
^\.Rproj\.user$
3-
^archive$
4-
^man-roxygen$
5-
^\.travis\.yml$
6-
^LICENSE\.md$
7-
^README\.Rmd$
8-
^\.appveyor\.yml$
9-
^_pkgdown\.yml$
10-
^docs$
11-
^pkgdown$
12-
^\.github$
13-
^cran-comments\.md$
14-
^CRAN-RELEASE$
15-
^CRAN-SUBMISSION$
16-
^touchstone$
1+
^.*\.Rproj$
2+
^\.Rproj\.user$
3+
^archive$
4+
^man-roxygen$
5+
^\.travis\.yml$
6+
^LICENSE\.md$
7+
^README\.Rmd$
8+
^\.appveyor\.yml$
9+
^_pkgdown\.yml$
10+
^docs$
11+
^pkgdown$
12+
^\.github$
13+
^cran-comments\.md$
14+
^CRAN-RELEASE$
15+
^CRAN-SUBMISSION$
16+
^touchstone$
17+
^codecov\.yml$

.github/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.html

.github/workflows/covr.yml

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

codecov.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
comment: false
2+
3+
coverage:
4+
status:
5+
project:
6+
default:
7+
target: auto
8+
threshold: 1%
9+
informational: true
10+
patch:
11+
default:
12+
target: auto
13+
threshold: 1%
14+
informational: true

0 commit comments

Comments
 (0)