diff --git a/.github/workflows/check-all-examples.yaml b/.github/workflows/check-all-examples.yaml deleted file mode 100644 index 36415fc90..000000000 --- a/.github/workflows/check-all-examples.yaml +++ /dev/null @@ -1,42 +0,0 @@ -# Make sure all examples run successfully, even the ones that are not supposed -# to be run or tested on CRAN machines by default. -# -# The examples that fail should use -# - `if (FALSE) { ... }` (if example is included only for illustrative purposes) -# - `try({ ... })` (if the intent is to show the error) -# -# This workflow helps find such failing examples that need to be modified. - -on: - push: - branches: [main, master] - pull_request: - branches: [main, master] - -name: check-all-examples - -jobs: - check-all-examples: - runs-on: ubuntu-latest - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - - steps: - - uses: actions/checkout@v4 - - - uses: r-lib/actions/setup-r@v2 - with: - use-public-rspm: true - - - uses: r-lib/actions/setup-r-dependencies@v2 - with: - pak-version: devel - extra-packages: | - any::devtools - local::. - - - name: Run examples - run: | - options(crayon.enabled = TRUE) - devtools::run_examples(fresh = TRUE, run_dontrun = TRUE, run_donttest = TRUE) - shell: Rscript {0} diff --git a/.github/workflows/check-no-warnings.yaml b/.github/workflows/check-no-warnings.yaml new file mode 100644 index 000000000..4b792a68d --- /dev/null +++ b/.github/workflows/check-no-warnings.yaml @@ -0,0 +1,48 @@ +# execute all examples and tests with warnings turned into errors to look for new warnings +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +name: check-no-warnings + +jobs: + check-no-warnings: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + pak-version: devel + extra-packages: | + any::devtools + local::. + + - name: Run examples + run: | + options(crayon.enabled = TRUE, warn = 2L) + devtools::run_examples(fresh = TRUE, run_dontrun = TRUE, run_donttest = TRUE) + shell: Rscript {0} + + - name: Run Tests + run: | + options(crayon.enabled = TRUE) + pkgload::load_all() + # this workaround needed to play nicely with parallel testing + # see: https://github.com/r-lib/testthat/issues/1912 + 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}