Skip to content

Commit e7587e2

Browse files
committed
reworking test coverage
1 parent e1a5f51 commit e7587e2

File tree

1 file changed

+23
-29
lines changed

1 file changed

+23
-29
lines changed

.github/workflows/coverage.yaml

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
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
31
on:
42
push:
53
branches: [main, master]
@@ -10,42 +8,38 @@ name: test-coverage
108

119
jobs:
1210
test-coverage:
13-
runs-on: ubuntu-latest
11+
runs-on: macOS-latest
1412
env:
1513
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
16-
14+
1715
steps:
18-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v2
1917

2018
- uses: r-lib/actions/setup-r@v2
21-
with:
22-
use-public-rspm: true
2319

24-
- uses: r-lib/actions/setup-r-dependencies@v2
25-
with:
26-
extra-packages: any::covr
27-
needs: coverage
20+
- uses: r-lib/actions/setup-pandoc@v2
2821

29-
- name: Test coverage
22+
- name: Query dependencies
3023
run: |
31-
covr::codecov(
32-
quiet = FALSE,
33-
clean = FALSE,
34-
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package"),
35-
token = "${{ secrets.CODECOV_TOKEN }}"
36-
)
24+
install.packages('remotes')
25+
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
26+
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
3727
shell: Rscript {0}
3828

39-
- name: Show testthat output
40-
if: always()
29+
- name: Restore R package cache
30+
uses: actions/cache@v2
31+
with:
32+
path: ${{ env.R_LIBS_USER }}
33+
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
34+
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
35+
36+
- name: Install dependencies
4137
run: |
42-
## --------------------------------------------------------------------
43-
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
44-
shell: bash
38+
install.packages(c("remotes"))
39+
remotes::install_deps(dependencies = TRUE)
40+
remotes::install_cran("covr")
41+
shell: Rscript {0}
4542

46-
- name: Upload test results
47-
if: failure()
48-
uses: actions/upload-artifact@v3
49-
with:
50-
name: coverage-test-failures
51-
path: ${{ runner.temp }}/package
43+
- name: Test coverage
44+
run: covr::codecov(token = "${{ secrets.CODECOV_TOKEN }}")
45+
shell: Rscript {0}

0 commit comments

Comments
 (0)