From e43acf8ee4f514580682d5fcc070515c33a50000 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 6 Jan 2026 21:42:15 +0000 Subject: [PATCH 1/6] Initial plan From 7b021463b74d8ef5bcb19a1c0a2f8e331dbe748f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 6 Jan 2026 21:50:47 +0000 Subject: [PATCH 2/6] Update workflows to support custom tarball URLs - Add workflow_dispatch with tarball_url input to R-CMD-check.yaml - Set CMDSTAN_TEST_TARBALL_URL env var and update install_cmdstan step - Update cmdstan-tarball-check.yaml to use modern actions and add deprecation notice Co-authored-by: jgabry <7796803+jgabry@users.noreply.github.com> --- .github/workflows/R-CMD-check.yaml | 14 ++++- .github/workflows/cmdstan-tarball-check.yaml | 62 +++++++++----------- 2 files changed, 41 insertions(+), 35 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 6664d79f0..f86cdd2ec 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -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: @@ -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 @@ -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)) { + cmdstanr::install_cmdstan(cores = 2, release_url = tarball_url) + } else { + cmdstanr::install_cmdstan(cores = 2) + } shell: Rscript {0} - name: Session info diff --git a/.github/workflows/cmdstan-tarball-check.yaml b/.github/workflows/cmdstan-tarball-check.yaml index 056e37f68..f2fc84a8d 100644 --- a/.github/workflows/cmdstan-tarball-check.yaml +++ b/.github/workflows/cmdstan-tarball-check.yaml @@ -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 @@ -22,9 +26,9 @@ 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 }} @@ -32,46 +36,38 @@ jobs: 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 (tarball_url == "latest" || !nzchar(tarball_url)) { + cmdstanr::install_cmdstan(cores = 2) } else { - cmdstanr::install_cmdstan(cores = 2, overwrite = TRUE, release_url = "${{ github.event.inputs.tarball_url }}") + cmdstanr::install_cmdstan(cores = 2, release_url = tarball_url) } shell: Rscript {0} @@ -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() From ffb12298453cb68357c1150b8f68b1c0c0b56b42 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 6 Jan 2026 21:51:46 +0000 Subject: [PATCH 3/6] Add documentation for testing with custom tarballs Co-authored-by: jgabry <7796803+jgabry@users.noreply.github.com> --- .github/workflows/README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/README.md diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 000000000..002365ea3 --- /dev/null +++ b/.github/workflows/README.md @@ -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 +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, 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. From bdad978003ecce8edbe0a6129209e07d43eceb8c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 6 Jan 2026 21:53:26 +0000 Subject: [PATCH 4/6] Fix: Make "latest" handling consistent between workflows Both workflows now use the same logic: tarball URL is only used if it's non-empty AND not equal to "latest". This ensures backwards compatibility and consistent behavior. Co-authored-by: jgabry <7796803+jgabry@users.noreply.github.com> --- .github/workflows/R-CMD-check.yaml | 2 +- .github/workflows/README.md | 4 ++-- .github/workflows/cmdstan-tarball-check.yaml | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index f86cdd2ec..5037ed1bd 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -94,7 +94,7 @@ jobs: run: | cmdstanr::check_cmdstan_toolchain(fix = TRUE) tarball_url <- Sys.getenv("CMDSTAN_TEST_TARBALL_URL") - if (nzchar(tarball_url)) { + if (nzchar(tarball_url) && tarball_url != "latest") { cmdstanr::install_cmdstan(cores = 2, release_url = tarball_url) } else { cmdstanr::install_cmdstan(cores = 2) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 002365ea3..ef4b793f7 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -9,7 +9,7 @@ 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 +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: @@ -17,7 +17,7 @@ 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, the workflow will use the latest CmdStan release. +If you leave the `tarball_url` field empty or enter "latest", the workflow will use the latest CmdStan release. ### Legacy Workflow diff --git a/.github/workflows/cmdstan-tarball-check.yaml b/.github/workflows/cmdstan-tarball-check.yaml index f2fc84a8d..c8e8f26ec 100644 --- a/.github/workflows/cmdstan-tarball-check.yaml +++ b/.github/workflows/cmdstan-tarball-check.yaml @@ -64,10 +64,10 @@ jobs: run: | cmdstanr::check_cmdstan_toolchain(fix = TRUE) tarball_url <- Sys.getenv("CMDSTAN_TEST_TARBALL_URL") - if (tarball_url == "latest" || !nzchar(tarball_url)) { - cmdstanr::install_cmdstan(cores = 2) - } else { + 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} From 95870661532c528c5c19b576d2b9e4ebc98c96dd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 6 Jan 2026 21:54:23 +0000 Subject: [PATCH 5/6] Fix: Make tarball_url optional in legacy workflow Changed required from true to false to match the main workflow's behavior and provide consistent user experience. Co-authored-by: jgabry <7796803+jgabry@users.noreply.github.com> --- .github/workflows/cmdstan-tarball-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmdstan-tarball-check.yaml b/.github/workflows/cmdstan-tarball-check.yaml index c8e8f26ec..9c69400d7 100644 --- a/.github/workflows/cmdstan-tarball-check.yaml +++ b/.github/workflows/cmdstan-tarball-check.yaml @@ -13,7 +13,7 @@ name: Custom CmdStan tarball unit tests inputs: tarball_url: description: 'CmdStan tarball URL to test with.' - required: true + required: false default: 'latest' jobs: From 6922a200652dee167ed5bd6d170cdb62ec96d01c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 6 Jan 2026 21:55:16 +0000 Subject: [PATCH 6/6] Fix: Align default tarball_url value between workflows Changed legacy workflow default from 'latest' to empty string to match the main workflow exactly, ensuring identical behavior. Co-authored-by: jgabry <7796803+jgabry@users.noreply.github.com> --- .github/workflows/cmdstan-tarball-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmdstan-tarball-check.yaml b/.github/workflows/cmdstan-tarball-check.yaml index 9c69400d7..50195528c 100644 --- a/.github/workflows/cmdstan-tarball-check.yaml +++ b/.github/workflows/cmdstan-tarball-check.yaml @@ -14,7 +14,7 @@ name: Custom CmdStan tarball unit tests tarball_url: description: 'CmdStan tarball URL to test with.' required: false - default: 'latest' + default: '' jobs: tarball-check: