From 0f814a94643d2c4b626fde62ae983bb6bcacc3dc Mon Sep 17 00:00:00 2001 From: Hugo Gruson Date: Tue, 12 Dec 2023 12:00:13 +0100 Subject: [PATCH] Test render in a dedicated workflow --- .github/workflows/test-reports.yaml | 45 ++++++++++++++++++++++++++ tests/testthat/test-render_templates.R | 17 ---------- 2 files changed, 45 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/test-reports.yaml delete mode 100644 tests/testthat/test-render_templates.R diff --git a/.github/workflows/test-reports.yaml b/.github/workflows/test-reports.yaml new file mode 100644 index 0000000..d896990 --- /dev/null +++ b/.github/workflows/test-reports.yaml @@ -0,0 +1,45 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + paths: + - 'inst/**' + pull_request: + branches: [main, master] + paths: + - 'inst/**' + +name: test reports + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test-reports: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v3 + - uses: r-lib/actions/setup-pandoc@v2 + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: + sodium # it would be good to automatically identify system dependencies in the future + - run: | + library(episoap) + for (tp in list_templates()) { + rmarkdown::render( + system.file("rmarkdown", "templates", tp, "skeleton", "skeleton.Rmd", + package = "episoap" + ), + output_file = tempfile(), + quiet = TRUE + ) + } + shell: Rscript {0} diff --git a/tests/testthat/test-render_templates.R b/tests/testthat/test-render_templates.R deleted file mode 100644 index 262f5cd..0000000 --- a/tests/testthat/test-render_templates.R +++ /dev/null @@ -1,17 +0,0 @@ -test_that("all templates render (at least with default params)", { - skip_on_cran() - - for (tp in list_templates()) { - expect_no_error( - suppressMessages(suppressWarnings( - rmarkdown::render( - system.file("rmarkdown", "templates", tp, "skeleton", "skeleton.Rmd", - package = "episoap" - ), - output_file = tempfile(), - quiet = TRUE - ) - )) - ) - } -})