Skip to content

Commit

Permalink
update test coverage github action
Browse files Browse the repository at this point in the history
  • Loading branch information
slager committed Feb 25, 2024
1 parent a1042f4 commit b09f508
Showing 1 changed file with 32 additions and 42 deletions.
74 changes: 32 additions & 42 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,66 +1,56 @@
# 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:
- main
- master
branches: [main, master]
pull_request:
branches:
- main
- master
- develop
branches: [main, master]

name: test-coverage

jobs:
test-coverage:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
env:
RSPM: https://packagemanager.rstudio.com/cran/__linux__/bionic/latest
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

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

- uses: r-lib/actions/setup-r@v1
id: install-r
- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-tinytex@v1
- run: tlmgr --version
- run: tlmgr update -self
- run: tlmgr install multirow

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

- name: Install pak and query dependencies
run: |
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds")
shell: Rscript {0}
- uses: r-lib/actions/setup-tinytex@v2
- run: tlmgr --version
- run: tlmgr install multirow

- name: Restore R package cache
uses: actions/cache@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: |
${{ env.R_LIBS_USER }}
!${{ env.R_LIBS_USER }}/pak
key: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
restore-keys: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1-
extra-packages: any::covr
needs: coverage

- name: Install system dependencies
if: runner.os == 'Linux'
- name: Test coverage
run: |
pak::local_system_requirements(execute = TRUE)
pak::pkg_system_requirements("covr", execute = TRUE)
covr::codecov(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
shell: Rscript {0}

- name: Install dependencies
- name: Show testthat output
if: always()
run: |
pak::local_install_dev_deps(upgrade = TRUE)
pak::pkg_install("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 b09f508

Please sign in to comment.