diff --git a/.github/workflows/test-reports.yaml b/.github/workflows/test-reports.yaml new file mode 100644 index 0000000..a50c36e --- /dev/null +++ b/.github/workflows/test-reports.yaml @@ -0,0 +1,40 @@ +# 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: + workflow_dispatch: + pull_request: + branches: [main, master] + +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/R/list_templates.R b/R/list_templates.R index f140985..16e0ed8 100644 --- a/R/list_templates.R +++ b/R/list_templates.R @@ -9,5 +9,10 @@ #' @export #' list_templates <- function() { - list.files(system.file("rmarkdown", "templates", package = "episoap")) + + reps <- list.files(system.file("rmarkdown", "templates", package = "episoap")) + stable_reps <- grep("^_", reps, invert = TRUE, value = TRUE) + + return(stable_reps) + } diff --git a/tests/testthat/test-render_templates.R b/tests/testthat/test-render_templates.R deleted file mode 100644 index c94d3f6..0000000 --- a/tests/testthat/test-render_templates.R +++ /dev/null @@ -1,18 +0,0 @@ -test_that("all templates render (at least with default params)", { - skip_on_cran() - skip_on_ci() - - 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 - ) - )) - ) - } -})