Skip to content

Commit

Permalink
Merge pull request #958 from stan-dev/fix-rtools44
Browse files Browse the repository at this point in the history
Fix Github Workflows
  • Loading branch information
andrjohns authored Apr 29, 2024
2 parents 9580b06 + 6c67158 commit cd3da48
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 120 deletions.
21 changes: 4 additions & 17 deletions .github/workflows/R-CMD-check-wsl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,9 @@ jobs:
- uses: r-lib/actions/setup-r@v2.8.7
- uses: r-lib/actions/setup-pandoc@v2.8.7

- 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}

- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
remotes::install_local(path = ".", INSTALL_opts = "--no-test-load")
install.packages("curl")
shell: Rscript {0}
- uses: r-lib/actions/setup-r-dependencies@v2.8.7
with:
extra-packages: any::rcmdcheck, local::.

- uses: Vampire/setup-wsl@v3
with:
Expand Down Expand Up @@ -82,11 +71,9 @@ jobs:
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}

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

- name: Show testthat output
if: always()
Expand Down
48 changes: 10 additions & 38 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ jobs:
config:
- {os: macOS-latest, r: 'devel', rtools: ''}
- {os: macOS-latest, r: 'release', rtools: ''}
- {os: windows-latest, r: 'devel', rtools: ''}
- {os: windows-latest, r: 'release', rtools: ''}
- {os: windows-latest, r: 'oldrel', rtools: '42'}
- {os: ubuntu-20.04, r: 'devel', rtools: ''}
- {os: ubuntu-20.04, r: 'release', rtools: ''}
- {os: ubuntu-20.04, r: 'oldrel', rtools: ''}
- {os: windows-latest, r: 'devel', rtools: '44'}
- {os: windows-latest, r: 'release', rtools: '44'}
- {os: windows-latest, r: 'oldrel', rtools: '43'}
- {os: ubuntu-latest, r: 'devel', rtools: ''}
- {os: ubuntu-latest, r: 'release', rtools: ''}
- {os: ubuntu-latest, r: 'oldrel', rtools: ''}
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -49,42 +49,16 @@ jobs:

- uses: actions/checkout@v4

- name: Install system dependencies
if: runner.os == 'Linux'
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
- uses: r-lib/actions/setup-r@v2.8.7
with:
r-version: ${{ matrix.config.r }}
rtools-version: ${{ matrix.config.rtools }}
- uses: r-lib/actions/setup-pandoc@v2.8.7

- 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.8.7

- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v4
- uses: r-lib/actions/setup-r-dependencies@v2.8.7
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-

- name: Install dependencies
run: |
Sys.setenv("MAKEFLAGS"="-j2")
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
remotes::install_local(path = ".")
install.packages("curl")
shell: Rscript {0}
extra-packages: any::rcmdcheck, local::.

- name: Install cmdstan
run: |
Expand All @@ -99,11 +73,9 @@ jobs:
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}

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

- name: Show testthat output
if: always()
Expand Down
79 changes: 17 additions & 62 deletions .github/workflows/Test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,18 @@ name: Test coverage
- master

jobs:
test-coverage-ubuntu:
name: "Linux"
test-coverage:
if: "! contains(github.event.head_commit.message, '[ci skip]')"
runs-on: ubuntu-20.04
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }}

strategy:
fail-fast: false
matrix:
config:
- { os: windows-latest }
- { os: ubuntu-latest }
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
NOT_CRAN: true
Expand All @@ -37,76 +45,23 @@ jobs:
- uses: r-lib/actions/setup-r@v2.8.7
- uses: r-lib/actions/setup-pandoc@v2.8.7

- name: Install Ubuntu dependencies
run: |
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev
sudo apt-get install -y openmpi-bin openmpi-common openmpi-doc libopenmpi-dev
- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
shell: Rscript {0}

- name: Cache R packages
uses: actions/cache@v4
- uses: r-lib/actions/setup-r-dependencies@v2.8.7
with:
path: ${{ env.R_LIBS_USER }}
key: ubuntu-r-4.0-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ubuntu-r-4.0-1-

- name: Install dependencies
run: |
install.packages(c("remotes", "curl"), dependencies = TRUE)
remotes::install_local(path = ".", INSTALL_opts = "--no-test-load")
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("covr")
remotes::install_cran("gridExtra")
shell: Rscript {0}
extra-packages: any::rcmdcheck, local::., any::covr, any::gridExtra

- name: Install cmdstan
run: |
cmdstanr::check_cmdstan_toolchain(fix = TRUE)
cmdstanr::install_cmdstan(cores = 2)
shell: Rscript {0}

- name: Test coverage
- name: Test coverage (Linux)
if: runner.os == 'Linux'
run: covr::codecov(type = "tests")
shell: Rscript {0}

test-coverage-windows:
name: "Windows"
if: "! contains(github.event.head_commit.message, '[ci skip]')"
runs-on: windows-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
NOT_CRAN: true
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2.8.7

- uses: r-lib/actions/setup-pandoc@v2.8.7

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
shell: Rscript {0}

- name: Install dependencies
run: |
install.packages(c("remotes", "curl"), dependencies = TRUE)
remotes::install_local(path = ".")
cmdstanr::check_cmdstan_toolchain(fix = TRUE)
cmdstanr::install_cmdstan(cores = 2, overwrite = TRUE)
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("covr")
remotes::install_cran("gridExtra")
shell: Rscript {0}

- name: Test coverage
- name: Test coverage (Windows)
if: runner.os == 'Windows'
run: |
options(covr.gcov = 'C:/rtools40/mingw64/bin/gcov.exe');
covr::codecov(type = "tests", function_exclusions = "sample_mpi")
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-install.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ test_that("install_cmdstan() works with version and release_url", {
expect_message(
expect_output(
install_cmdstan(dir = dir, overwrite = TRUE, cores = 4,
release_url = "https://github.com/stan-dev/cmdstan/releases/download/v2.26.1/cmdstan-2.26.1.tar.gz",
release_url = "https://github.com/stan-dev/cmdstan/releases/download/v2.33.0/cmdstan-2.33.0.tar.gz",
wsl = os_is_wsl()),
"Compiling, linking C++ code",
fixed = TRUE
Expand All @@ -110,7 +110,7 @@ test_that("install_cmdstan() works with version and release_url", {
expect_message(
expect_output(
install_cmdstan(dir = dir, overwrite = TRUE, cores = 4,
version = "2.27.0",
version = "2.33.0",
# the URL is intentionally invalid to test that the version has higher priority
release_url = "https://github.com/stan-dev/cmdstan/releases/download/v2.27.3/cmdstan-2.27.3.tar.gz",
wsl = os_is_wsl()),
Expand All @@ -123,7 +123,7 @@ test_that("install_cmdstan() works with version and release_url", {
"version and release_url shouldn't both be specified",
fixed = TRUE
)
expect_true(dir.exists(file.path(dir, "cmdstan-2.27.0")))
expect_true(dir.exists(file.path(dir, "cmdstan-2.33.0")))
set_cmdstan_path(cmdstan_default_path())
})

Expand Down

0 comments on commit cd3da48

Please sign in to comment.