Skip to content

Merge pull request #5 from elkronos/ci-testthat #10

Merge pull request #5 from elkronos/ci-testthat

Merge pull request #5 from elkronos/ci-testthat #10

Workflow file for this run

# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
on:
push:
branches: [main, master]
pull_request:
workflow_dispatch:
name: R-CMD-check
permissions: read-all
jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
# Every Suggests use in this package is requireNamespace()-guarded,
# so an optional backend that will not install on one platform should
# skip its tests, not fail the run.
_R_CHECK_FORCE_SUGGESTS_: false
steps:
- uses: actions/checkout@v5
- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true
# Hard dependencies only. Installing Suggests here pulled the entire
# Stan toolchain into every matrix job -- slow everywhere, and fatal on
# r-devel, where nothing arrives as a binary. There CRAN's rstan 2.32.7
# was compiled against StanHeaders 2.39.0.9000 from the stan-dev
# universe and died with "'ecuyer1988' is not a member of 'boost'":
# Stan dropped that typedef after 2.32. The optional backends are the
# job of the `backends` job below and of check-brms.yaml.
#
# Four Suggests are not optional in practice. knitr and rmarkdown
# build the vignette during R CMD build; the vignette calls
# library(ggplot2) unguarded; and tests/testthat.R opens with
# library(testthat), so without it the test stage errors rather than
# skipping. _R_CHECK_FORCE_SUGGESTS_ = false does not cover this -- it
# only downgrades the complaint about absent Suggests, it does not stop
# check from running the test file.
- uses: r-lib/actions/setup-r-dependencies@v2
with:
dependencies: '"hard"'
extra-packages: |
any::rcmdcheck
any::knitr
any::rmarkdown
any::ggplot2
any::testthat
needs: check
- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
# ---------------------------------------------------------------------------
# Optional backends live in Suggests and are guarded by requireNamespace().
# Without this job the matrix above skips most model tests, so a green
# matrix would prove very little. GWmodel / gstat / FNN / Matrix are cheap
# enough to install on every push; brms + Stan is not (see nightly workflow).
# ---------------------------------------------------------------------------
backends:
runs-on: ubuntu-latest
name: ubuntu-latest (release, with optional backends)
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
# Every Suggests use in this package is requireNamespace()-guarded,
# so an optional backend that will not install on one platform should
# skip its tests, not fail the run.
_R_CHECK_FORCE_SUGGESTS_: false
steps:
- uses: actions/checkout@v5
- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-r@v2
with:
r-version: 'release'
use-public-rspm: true
# Hard dependencies plus exactly the optional backends this job exists
# to exercise. Suggests are deliberately NOT installed wholesale: that
# dragged in brms and the Stan toolchain, which the comment above says
# belongs in the nightly workflow instead.
- uses: r-lib/actions/setup-r-dependencies@v2
with:
dependencies: '"hard"'
extra-packages: |
any::rcmdcheck
any::knitr
any::rmarkdown
any::ggplot2
any::testthat
any::sp
any::GWmodel
any::gstat
any::FNN
any::Matrix
any::geometry
needs: check
- name: Confirm optional backends are installed
run: |
for (p in c("sp", "GWmodel", "gstat", "FNN", "Matrix", "geometry")) {
if (!requireNamespace(p, quietly = TRUE))
stop("Backend package not installed: ", p)
}
cat("All optional backends present.\n")
shell: Rscript {0}
- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'