Skip to content

Commit afc22f8

Browse files
committed
Update test-coverage.yaml
1 parent 20910f5 commit afc22f8

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

.github/workflows/test-coverage.yaml

+19-10
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ on:
44
push:
55
branches: [main, master]
66
pull_request:
7-
branches: [main, master, patch-for-cran]
87

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

1112
jobs:
1213
test-coverage:
@@ -15,38 +16,46 @@ jobs:
1516
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1617

1718
steps:
18-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v4
1920

2021
- uses: r-lib/actions/setup-r@v2
2122
with:
2223
use-public-rspm: true
2324

2425
- uses: r-lib/actions/setup-r-dependencies@v2
2526
with:
26-
extra-packages: |
27-
any::covr
28-
any::vdiffr
27+
extra-packages: any::covr, any::xml2, any::vdiffr
2928
needs: coverage
3029

3130
- name: Test coverage
3231
run: |
33-
covr::codecov(
32+
cov <- covr::package_coverage(
3433
quiet = FALSE,
3534
clean = FALSE,
36-
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
35+
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
3736
)
37+
covr::to_cobertura(cov)
3838
shell: Rscript {0}
3939

40+
- uses: codecov/codecov-action@v4
41+
with:
42+
# Fail if error if not on PR, or if on PR and token is given
43+
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
44+
file: ./cobertura.xml
45+
plugin: noop
46+
disable_search: true
47+
token: ${{ secrets.CODECOV_TOKEN }}
48+
4049
- name: Show testthat output
4150
if: always()
4251
run: |
4352
## --------------------------------------------------------------------
44-
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
53+
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
4554
shell: bash
4655

4756
- name: Upload test results
4857
if: failure()
49-
uses: actions/upload-artifact@v3
58+
uses: actions/upload-artifact@v4
5059
with:
5160
name: coverage-test-failures
5261
path: ${{ runner.temp }}/package

0 commit comments

Comments
 (0)