Skip to content
---
# R-CMD check which allows you to lock the R version and date of the CRAN snapshot.
# This is particularly helpful for ensuring that the package works with internal systems.
on:
workflow_dispatch:
workflow_call:
name: R-CMD-check-versions
jobs:
R-CMD-check:
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} (R ${{ matrix.config.r }}, CRAN ${{ matrix.config.date }})
strategy:
fail-fast: false
matrix:
os:
#- macos-latest
#- windows-latest
- ubuntu-latest
config:
- date: 'latest'
r: 'release'
- date: 2023-10-25 # Lock the date of the CRAN snapshot
r: 4.3.1
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
use-public-rspm: false
# - name: Install curl ()
# if: matrix.os == 'ubuntu-latest' && matrix.config.date != 'latest'
# run: |
# sudo apt install libcurl4-openssl-dev

Check failure on line 43 in .github/workflows/R-CMD-check-versions.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/R-CMD-check-versions.yaml

Invalid workflow file

You have an error in your yaml syntax on line 43
- name: Install pak (Windows + CRAN snapshot)
if: runner.os == 'Windows' && matrix.config.date != 'latest'
run: |
# Install pak
cat("::group::Install pak\n")
#lib <- Sys.getenv("R_LIB_FOR_PAK")
#dir.create(lib, showWarnings = FALSE, recursive = TRUE)
install.packages("pak", repos = sprintf(
"https://r-lib.github.io/p/pak/%s/%s/%s/%s",
"stable",
.Platform$pkgType,
R.Version()$os,
R.Version()$arch
))
cat("::endgroup::\n")
shell: Rscript {0}
- name: Install pak (Unix + CRAN snapshot)
if: runner.os != 'Windows' && matrix.config.date != 'latest'
run: |
# Install pak
echo "::group::Install pak"
if which sudo >/dev/null; then SUDO="sudo -E --preserve-env=PATH env"; else SUDO=""; fi
#$SUDO R -q -e 'dir.create(Sys.getenv("R_LIB_FOR_PAK"), recursive = TRUE, showWarnings = FALSE)'
$SUDO R -q -e 'install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/%s/%s/%s/%s", "stable", .Platform$pkgType, R.Version()$os, R.Version()$arch))'
echo "::endgroup::"
shell: bash
# Install package dependencies (if a specific date)
- name: Install dependencies ${{ matrix.config.date }} (CRAN snapshot)
if: matrix.config.date != 'latest'
run: |
options(
repos = c(CRAN = "https://packagemanager.posit.co/cran/${{ matrix.config.date }}")
)
install.packages(c("rcmdcheck", "devtools"), Ncpus = parallel::detectCores()-1)
pak::pkg_install(".", dependencies = TRUE, upgrade = TRUE)
#devtools::install(".", dependencies = TRUE, upgrade = TRUE, Ncpus = parallel::detectCores()-1)
shell: Rscript {0}
# Install package dependencies (if lastest)
- uses: r-lib/actions/setup-r-dependencies@v2
if: matrix.config.date == 'latest'
with:
extra-packages: any::rcmdcheck
needs: check
- name: Session info
run: |
sessionInfo()
installed.packages()[,c("Package", "Version")]
shell: Rscript {0}
- uses: r-lib/actions/check-r-package@v2
with:
args: 'c("--no-manual", "--as-cran")'
upload-snapshots: true
error-on: '"error"'
check-dir: '"check"'
upload-results: true