Skip to content

Commit 8199728

Browse files
committed
Update test-coverage.yaml
1 parent 4bad007 commit 8199728

File tree

1 file changed

+23
-27
lines changed

1 file changed

+23
-27
lines changed
Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
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
1+
# R-focused test coverage workflow for GitHub Actions
2+
# Optimized for Codecov and modern R package testing
3+
4+
name: test-coverage
5+
36
on:
47
push:
58
branches: [main, master]
69
pull_request:
710
branches: [main, master]
811

9-
name: test-coverage
10-
11-
permissions: read-all
12+
permissions:
13+
contents: read
1214

1315
jobs:
1416
test-coverage:
1517
runs-on: ubuntu-latest
1618
env:
1719
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1820
R_KEEP_PKG_SOURCE: yes
19-
PKG_SYSREQS: false
2021

2122
steps:
22-
- uses: actions/checkout@v4
23+
- name: Checkout code
24+
uses: actions/checkout@v4
2325

24-
- uses: r-lib/actions/setup-r@v2
26+
- name: Set up R
27+
uses: r-lib/actions/setup-r@v2
2528
with:
2629
use-public-rspm: true
2730

@@ -33,45 +36,38 @@ jobs:
3336
libudunits2-dev libgdal-dev libgeos-dev libproj-dev libglpk-dev \
3437
libgmp3-dev libmpfr-dev chromium-browser
3538
36-
- uses: r-lib/actions/setup-r-dependencies@v2
39+
- name: Install R package dependencies
40+
uses: r-lib/actions/setup-r-dependencies@v2
3741
with:
38-
cache-version: 4
3942
extra-packages: |
4043
any::covr
44+
any::testthat
4145
any::xml2
42-
any::rcmdcheck
4346
any::remotes
4447
any::lpsymphony
45-
needs: coverage
4648
47-
- name: Test coverage
49+
- name: Run tests and generate coverage
4850
run: |
49-
cov <- covr::package_coverage(
50-
quiet = FALSE,
51-
clean = FALSE,
52-
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
53-
)
54-
covr::to_cobertura(cov)
51+
cov <- covr::package_coverage()
52+
covr::to_lcov(cov, file = "coverage.lcov")
5553
shell: Rscript {0}
5654

57-
- uses: codecov/codecov-action@v5
55+
- name: Upload coverage to Codecov
56+
uses: codecov/codecov-action@v5
5857
with:
58+
file: coverage.lcov
5959
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
60-
file: ./cobertura.xml
61-
plugin: noop
62-
disable_search: true
6360
token: ${{ secrets.CODECOV_TOKEN }}
6461

6562
- name: Show testthat output
6663
if: always()
6764
run: |
68-
## --------------------------------------------------------------------
69-
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
65+
find . -name 'testthat.Rout*' -exec cat '{}' \; || true
7066
shell: bash
7167

72-
- name: Upload test results
68+
- name: Upload test results (on failure)
7369
if: failure()
7470
uses: actions/upload-artifact@v4
7571
with:
7672
name: coverage-test-failures
77-
path: ${{ runner.temp }}/package
73+
path: .

0 commit comments

Comments
 (0)