Skip to content

test-coverage.yaml #529

test-coverage.yaml

test-coverage.yaml #529

# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
on:
push:
branches: main
pull_request:
branches: main
workflow_dispatch:
name: test-coverage
jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
covr
pkgdown
remotes
- name: Install local registry
run: /bin/bash -c "$(curl -fsSL https://data.scrc.uk/static/localregistry.sh)"
- name: Start registry
run: $HOME/.fair/registry/scripts/start_fair_registry
- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
- name: Restore R package cache
uses: actions/cache@v4
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
shell: Rscript {0}
- name: Install package
run: R CMD INSTALL .
- name: Test coverage
env:
_RUN_TESTS_: true
run: covr::codecov()
shell: Rscript {0}