RC CRAN 1.6.2: Fix tests for easystats update (#301) #458
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
# Run tests with `options(warn = 2)` to fail on test warnings | |
on: | |
push: | |
branches: [main, master] | |
pull_request: | |
branches: [main, master] | |
name: check-test-warnings | |
jobs: | |
check-test-warnings: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: "devel" | |
use-public-rspm: true | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
pak-version: devel | |
upgrade: 'TRUE' | |
extra-packages: | | |
local::. | |
needs: check | |
- name: Run Tests | |
run: | | |
options(crayon.enabled = TRUE) | |
pkgload::load_all() | |
test_script_paths <- testthat::find_test_scripts("tests/testthat") | |
test_with_warning_as_error <- function(path) { | |
withr::local_options(list(warn = 2L)) | |
testthat::test_file(path, stop_on_failure = TRUE, stop_on_warning = TRUE) | |
} | |
purrr::walk(test_script_paths, test_with_warning_as_error) | |
shell: Rscript {0} |