From 0073142fc4e50c5cade0b5da144789854d1d2254 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Tue, 3 Dec 2024 18:01:32 +0300 Subject: [PATCH] Consolidate all "no warning" workflows in one closes #302 --- .github/workflows/check-all-examples.yaml | 62 ------------------- ...t-warnings.yaml => check-no-warnings.yaml} | 25 ++++++-- .../workflows/check-vignette-warnings.yaml | 50 --------------- 3 files changed, 19 insertions(+), 118 deletions(-) delete mode 100644 .github/workflows/check-all-examples.yaml rename .github/workflows/{check-test-warnings.yaml => check-no-warnings.yaml} (55%) delete mode 100644 .github/workflows/check-vignette-warnings.yaml diff --git a/.github/workflows/check-all-examples.yaml b/.github/workflows/check-all-examples.yaml deleted file mode 100644 index e37daae0..00000000 --- a/.github/workflows/check-all-examples.yaml +++ /dev/null @@ -1,62 +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] - schedule: - # * is a special character in YAML so you have to quote this string - # Trigger once a week at 00:00 on Sunday - - cron: "0 0 * * SUN" - -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-pandoc@v2 - with: - pandoc-version: "latest" - - - 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: | - any::devtools - local::. - needs: check - - - name: Run examples - run: | - options( - crayon.enabled = TRUE, - showErrorCalls = TRUE, - showWarnCalls = TRUE, - error = rlang::entrace, - # warnPartialMatchArgs = TRUE, - # warnPartialMatchAttr = TRUE, - # warnPartialMatchDollar = TRUE, - warn = 2L - ) - devtools::run_examples(run_dontrun = TRUE, run_donttest = TRUE, document = FALSE) - shell: Rscript {0} diff --git a/.github/workflows/check-test-warnings.yaml b/.github/workflows/check-no-warnings.yaml similarity index 55% rename from .github/workflows/check-test-warnings.yaml rename to .github/workflows/check-no-warnings.yaml index 707d1081..051583c6 100644 --- a/.github/workflows/check-test-warnings.yaml +++ b/.github/workflows/check-no-warnings.yaml @@ -1,14 +1,14 @@ -# Run tests with `options(warn = 2)` to fail on test warnings +# execute all examples, tests, and vignettes with warnings turned into errors on: push: branches: [main, master] pull_request: branches: [main, master] -name: check-test-warnings +name: check-no-warnings jobs: - check-test-warnings: + check-no-warnings: runs-on: ubuntu-latest env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} @@ -18,21 +18,27 @@ jobs: - 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: | + any::devtools local::. - needs: check + + - 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)) @@ -40,3 +46,10 @@ jobs: } purrr::walk(test_script_paths, test_with_warning_as_error) shell: Rscript {0} + + - name: Build vignettes + run: | + options(crayon.enabled = TRUE, warn = 2L) + vignettes <- fs::dir_ls("vignettes/", glob = "*.Rmd", recurse = TRUE) + purrr::walk(vignettes, rmarkdown::render) + shell: Rscript {0} diff --git a/.github/workflows/check-vignette-warnings.yaml b/.github/workflows/check-vignette-warnings.yaml deleted file mode 100644 index e867e80b..00000000 --- a/.github/workflows/check-vignette-warnings.yaml +++ /dev/null @@ -1,50 +0,0 @@ -# Run vignettes with `options(warn = 2)` to fail on warnings -on: - push: - branches: [main, master] - pull_request: - branches: [main, master] - schedule: - # * is a special character in YAML so you have to quote this string - # Trigger once a week at 00:00 on Sunday - - cron: "0 0 * * SUN" - -name: check-vignette-warnings - -jobs: - check-vignette-warnings: - runs-on: ubuntu-latest - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - - steps: - - uses: actions/checkout@v4 - - - uses: r-lib/actions/setup-pandoc@v2 - with: - pandoc-version: "latest" - - - 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::. - - - name: Build vignettes - run: | - options( - crayon.enabled = TRUE, - # warnPartialMatchArgs = TRUE, - # warnPartialMatchAttr = TRUE, - # warnPartialMatchDollar = TRUE, - warn = 2L - ) - vignettes <- fs::dir_ls("vignettes/", glob = "*.Rmd", recurse = TRUE) - purrr::walk(vignettes, rmarkdown::render) - shell: Rscript {0}