Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ name: Unit tests
pull_request:
branches:
- master
workflow_dispatch:
inputs:
tarball_url:
description: 'CmdStan tarball URL to test with (optional, uses latest if not provided)'
required: false
default: ''

jobs:
R-CMD-check:
Expand All @@ -37,6 +43,7 @@ jobs:
NOT_CRAN: true
CMDSTANR_OPENCL_TESTS: ${{ matrix.config.opencl }}
PKG_SYSREQS_DB_UPDATE_TIMEOUT: 30s
CMDSTAN_TEST_TARBALL_URL: ${{ github.event.inputs.tarball_url }}

steps:
- name: cmdstan env vars
Expand Down Expand Up @@ -86,7 +93,12 @@ jobs:
- name: Install cmdstan
run: |
cmdstanr::check_cmdstan_toolchain(fix = TRUE)
cmdstanr::install_cmdstan(cores = 2)
tarball_url <- Sys.getenv("CMDSTAN_TEST_TARBALL_URL")
if (nzchar(tarball_url) && tarball_url != "latest") {
cmdstanr::install_cmdstan(cores = 2, release_url = tarball_url)
} else {
cmdstanr::install_cmdstan(cores = 2)
}
shell: Rscript {0}

- name: Session info
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# GitHub Actions Workflows

This directory contains GitHub Actions workflows for testing and maintaining cmdstanr.

## Testing with Custom CmdStan Tarballs

To test cmdstanr with a custom CmdStan tarball (e.g., during CmdStan releases):

1. Go to the [Actions tab](https://github.com/stan-dev/cmdstanr/actions)
2. Select the "Unit tests" workflow
3. Click "Run workflow"
4. Enter the CmdStan tarball URL in the `tarball_url` input field (or leave empty/enter "latest" for the latest release)
5. Click "Run workflow"

Example tarball URL:
```
https://github.com/stan-dev/cmdstan/releases/download/v2.35.0/cmdstan-2.35.0.tar.gz
```

If you leave the `tarball_url` field empty or enter "latest", the workflow will use the latest CmdStan release.

### Legacy Workflow

The `cmdstan-tarball-check.yaml` workflow is maintained for backwards compatibility but is deprecated. Please use the main `R-CMD-check.yaml` workflow instead as described above.
66 changes: 30 additions & 36 deletions .github/workflows/cmdstan-tarball-check.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
---
# Github Actions workflow to check CmdStanR tarball
# yamllint disable rule:line-length
#
# DEPRECATED: This workflow is maintained for backwards compatibility.
# Please use the main R-CMD-check.yaml workflow instead, which now accepts
# an optional tarball_url input via workflow_dispatch.

name: Custom CmdStan tarball unit tests

Expand All @@ -9,8 +13,8 @@ name: Custom CmdStan tarball unit tests
inputs:
tarball_url:
description: 'CmdStan tarball URL to test with.'
required: true
default: 'latest'
required: false
default: ''

jobs:
tarball-check:
Expand All @@ -22,56 +26,48 @@ jobs:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'release', rtools: ''}
- {os: windows-latest, r: 'release', rtools: '44'}
- {os: ubuntu-20.04, r: 'release', rtools: ''}
- {os: macOS-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'release'}
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
CMDSTAN_TEST_TARBALL_URL: ${{ github.event.inputs.tarball_url }}
NOT_CRAN: true

steps:
- uses: actions/checkout@v6
- name: Install system dependencies
if: runner.os == 'Linux'
- name: cmdstan env vars
run: |
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev || true
sudo apt-get install -y openmpi-bin openmpi-common libopenmpi-dev || true
echo "CMDSTAN_PATH=${HOME}/.cmdstan" >> $GITHUB_ENV
shell: bash

- uses: actions/checkout@v6

- uses: r-lib/actions/setup-r@v2.11.3
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
rtools-version: ${{ matrix.config.rtools }}

- uses: r-lib/actions/setup-pandoc@v2.11.3
- name: Install R Package Build Dependencies on MacOS
if: ${{ runner.os == 'macOS' }}
uses: r-hub/actions/setup-r-sysreqs@v1
with:
type: 'minimal'

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
- uses: r-lib/actions/setup-pandoc@v2

- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v5
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
cache: "always"
extra-packages: any::rcmdcheck, local::.

- name: Install dependencies
- name: Install cmdstan
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
remotes::install_local(path = ".", INSTALL_opts = "--no-test-load")
cmdstanr::check_cmdstan_toolchain(fix = TRUE)
if (Sys.getenv("CMDSTAN_TEST_TARBALL_URL") == "latest") {
cmdstanr::install_cmdstan(cores = 2, overwrite = TRUE)
tarball_url <- Sys.getenv("CMDSTAN_TEST_TARBALL_URL")
if (nzchar(tarball_url) && tarball_url != "latest") {
cmdstanr::install_cmdstan(cores = 2, release_url = tarball_url)
} else {
cmdstanr::install_cmdstan(cores = 2, overwrite = TRUE, release_url = "${{ github.event.inputs.tarball_url }}")
cmdstanr::install_cmdstan(cores = 2)
}
shell: Rscript {0}

Expand All @@ -82,11 +78,9 @@ jobs:
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}

- name: Check
- uses: r-lib/actions/check-r-package@v2
env:
_R_CHECK_CRAN_INCOMING_: false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran", "--ignore-vignettes"), build_args = c("--no-build-vignettes"), error_on = "warning", check_dir = "check")
shell: Rscript {0}

- name: Show testthat output
if: always()
Expand Down