Skip to content

Merge pull request #444 from stan-dev/dependabot/github_actions/codec… #796

Merge pull request #444 from stan-dev/dependabot/github_actions/codec…

Merge pull request #444 from stan-dev/dependabot/github_actions/codec… #796

Workflow file for this run

on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
name: R-CMD-check
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master' }}
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: "devel" }
- { os: macOS-latest, r: "release" }
- { os: windows-latest, r: "release" }
- { os: ubuntu-latest, r: "devel" }
- { os: ubuntu-latest, r: "release" }
- { os: ubuntu-latest, r: "oldrel" }
- { os: ubuntu-latest, r: "3.6" }
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v6
- 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
- uses: r-lib/actions/setup-pandoc@v2
- name: Remove randomForest from DESCRIPTION and examples for R 3.6
if: ${{ matrix.config.r == '3.6' }}
run: |
# Remove randomForest from DESCRIPTION
desc_lines <- readLines("DESCRIPTION")
desc_lines <- desc_lines[!grepl("randomForest", desc_lines)]
writeLines(desc_lines, "DESCRIPTION")
# Remove randomForest from rstar.Rd examples
rd_file <- "man/rstar.Rd"
rd_lines <- readLines(rd_file)
# Find the examples section and remove randomForest requirement
in_examples <- FALSE
for (i in seq_along(rd_lines)) {
if (grepl("^\\\\examples\\{", rd_lines[i])) {
in_examples <- TRUE
}
if (in_examples && grepl("require\\(\"randomForest\"", rd_lines[i])) {
rd_lines[i] <- gsub(" && require\\(\"randomForest\", quietly = TRUE\\)", "", rd_lines[i])
}
if (in_examples && grepl("^\\}$", rd_lines[i])) {
in_examples <- FALSE
}
}
writeLines(rd_lines, rd_file)
shell: Rscript {0}
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check
- name: Session info
run: |
options(width = 100)
sessioninfo::session_info(installed.packages()[, "Package"], include_base = TRUE)
shell: Rscript {0}
- uses: r-lib/actions/check-r-package@v2
env:
_R_CHECK_CRAN_INCOMING_: false
with:
args: 'c("--no-manual", "--as-cran")'
- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
- name: Upload check results
if: failure()
uses: actions/upload-artifact@v6
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check