03-Run validation tests #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
# push: | |
# branches: main | |
# paths: 'data/**' | |
# pull_request: | |
# branches: main | |
# paths: 'data/**' | |
workflow_dispatch | |
name: 03-Run validation tests | |
#' This starts off identically to validate.yaml but instead of running an R | |
#' script with tests in it directly, it runs testthat::test_dir() to run tests. | |
#' There is a much more complex example of testing data like this here: | |
#' https://github.com/weecology/PortalData/tree/main/testthat | |
jobs: | |
validate: | |
runs-on: ubuntu-latest | |
env: | |
RENV_CONFIG_PAK_ENABLED: TRUE #use the `pak` package for installing R packages—it automatically detects and install system dependencies on ubuntu | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: "renv" #use the same version of R recorded in renv.lock | |
- name: Install R packages | |
uses: r-lib/actions/setup-renv@v2 #uses `renv::restore()` | |
- name: Run tests | |
run: Rscript testthat.R |