Skip to content

Commit

Permalink
Modernise CHECK and coverage github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenneth Benoit authored and Kenneth Benoit committed Feb 23, 2024
1 parent dd7d2fb commit 3db3749
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/R-CMD-check.yaml
Expand Up @@ -29,7 +29,7 @@ jobs:
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand Down
59 changes: 32 additions & 27 deletions .github/workflows/test-coverage.yaml
@@ -1,45 +1,50 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches:
- master
branches: [main, master]
pull_request:
branches:
- master
branches: [main, master]

name: test-coverage

jobs:
test-coverage:
runs-on: macOS-latest
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@master
- uses: r-lib/actions/setup-r@v2
with:
r-version: 'release'
use-public-rspm: true

- uses: r-lib/actions/setup-pandoc@master
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr
needs: coverage

- name: Query dependencies
- name: Test coverage
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
covr::codecov(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
shell: Rscript {0}

- name: Cache R packages
uses: actions/cache@v1
with:
path: ${{ env.R_LIBS_USER }}
key: macOS-r-4.0-2-${{ hashFiles('.github/depends.Rds') }}
restore-keys: macOS-r-4.0-2-

- name: Install dependencies
- name: Show testthat output
if: always()
run: |
install.packages(c("remotes"))
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("covr")
shell: Rscript {0}
## --------------------------------------------------------------------
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Test coverage
run: covr::codecov()
shell: Rscript {0}
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package

0 comments on commit 3db3749

Please sign in to comment.