diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index c222df86..11652b96 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -1,70 +1,62 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? +# Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: - - main - - master + branches: [main, master] pull_request: - branches: - - main - - master + branches: [main, master] schedule: - cron: '1 23 * * Sun' -name: R-CMD-check +name: R-CMD-check.yaml defaults: run: shell: Rscript {0} +permissions: read-all + jobs: R-CMD-check: - name: ${{ matrix.os }}, tf-${{ matrix.tf }}, R-${{ matrix.r}} - timeout-minutes: 30 + runs-on: ${{ matrix.config.os }} + + timeout-minutes: 60 + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) (${{ matrix.config.tf }}) + strategy: fail-fast: false matrix: - include: - - {os: 'ubuntu-latest' , tf: 'default', r: 'release'} - - {os: 'windows-latest', tf: 'default', r: 'release'} - - {os: 'macOS-latest' , tf: 'default', r: 'release'} + config: + - {os: macos-latest, r: 'release', tf: 'default'} + - {os: windows-latest, r: 'release', tf: 'default'} + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release', tf: 'default'} + - {os: ubuntu-latest, r: 'release', tf: 'default'} + - {os: ubuntu-latest, r: 'oldrel-1', tf: 'default'} - runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.tf == 'nightly' || contains(matrix.tf, 'rc') || matrix.r == 'devel' }} env: - R_REMOTES_NO_ERRORS_FROM_WARNINGS: 'true' - R_COMPILE_AND_INSTALL_PACKAGES: 'never' GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes steps: + - uses: actions/checkout@v4 - - uses: actions/checkout@v2 + - uses: r-lib/actions/setup-pandoc@v2 - uses: r-lib/actions/setup-r@v2 - id: setup-r with: - r-version: ${{ matrix.r }} + r-version: ${{ matrix.config.r }} Ncpus: '2L' + http-user-agent: ${{ matrix.config.http-user-agent }} use-public-rspm: true - - uses: r-lib/actions/setup-pandoc@v2 - - - name: Get Date - id: get-date - shell: bash - run: | - echo "::set-output name=year-week::$(date -u "+%Y-%U")" - echo "::set-output name=date::$(date -u "+%F")" - - - name: Restore R package cache - uses: actions/cache@v2 - id: r-package-cache + - uses: r-lib/actions/setup-r-dependencies@v2 with: - path: ${{ env.R_LIBS_USER }} - key: ${{ matrix.os }}-${{ steps.setup-r.outputs.installed-r-version }}-${{ steps.get-date.outputs.year-week }}-1 + extra-packages: any::rcmdcheck + needs: check + - - name: Install remotes - if: steps.r-package-cache.outputs.cache-hit != 'true' - run: install.packages("remotes") - name: Install system dependencies if: runner.os == 'Linux' @@ -77,6 +69,10 @@ jobs: sudo $cmd done < <(Rscript -e "writeLines(remotes::system_requirements('$ID-$VERSION_ID'))") + - name: Install remotes + if: steps.r-package-cache.outputs.cache-hit != 'true' + run: install.packages("remotes") + - name: Install package + deps run: remotes::install_local(dependencies = TRUE, force = TRUE) @@ -88,30 +84,18 @@ jobs: - name: Situation Report on greta install run: greta::greta_sitrep() - - name: Install rcmdcheck - run: remotes::install_cran("rcmdcheck") - - - name: Check - run: rcmdcheck::rcmdcheck(args = '--no-manual', error_on = 'warning', check_dir = 'check') + - uses: r-lib/actions/check-r-package@v2 + with: + upload-snapshots: true + build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' - name: Show testthat output if: always() shell: bash run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true - - name: Don't use tar from old Rtools to store the cache - if: ${{ runner.os == 'Windows' && startsWith(steps.install-r.outputs.installed-r-version, '3') }} - shell: bash - run: echo "C:/Program Files/Git/usr/bin" >> $GITHUB_PATH - - - name: Check on single core machine - if: runner.os != 'Windows' - env: - R_PARALLELLY_AVAILABLE_CORES: 1 - run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran", "--no-multiarch")) - - - name: Session info - run: | - options(width = 100) - pkgs <- installed.packages()[, "Package"] - sessioninfo::session_info(pkgs, include_base = TRUE) + # - name: Check on single core machine + # if: runner.os != 'Windows' + # env: + # R_PARALLELLY_AVAILABLE_CORES: 1 + # run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran", "--no-multiarch")) diff --git a/.github/workflows/pr-commands.yaml b/.github/workflows/pr-commands.yaml index 71f335b3..2edd93f2 100644 --- a/.github/workflows/pr-commands.yaml +++ b/.github/workflows/pr-commands.yaml @@ -4,7 +4,9 @@ on: issue_comment: types: [created] -name: Commands +name: pr-commands.yaml + +permissions: read-all jobs: document: @@ -13,8 +15,10 @@ jobs: runs-on: ubuntu-latest env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + permissions: + contents: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: r-lib/actions/pr-fetch@v2 with: @@ -50,8 +54,10 @@ jobs: runs-on: ubuntu-latest env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + permissions: + contents: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: r-lib/actions/pr-fetch@v2 with: diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 558fef72..351d2eed 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -25,23 +25,9 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: - extra-packages: | - any::covr - any::xml2 - any::remotes + extra-packages: any::covr, any::xml2, any::remotes needs: coverage - - name: Install system dependencies - if: runner.os == 'Linux' - shell: bash - run: | - . /etc/os-release - while read -r cmd - do - echo "$cmd" - sudo $cmd - done < <(Rscript -e "writeLines(remotes::system_requirements('$ID-$VERSION_ID'))") - - name: Install package + deps run: remotes::install_local(dependencies = TRUE, force = TRUE) shell: Rscript {0} diff --git a/README.md b/README.md index 1a3fb436..1a086383 100644 --- a/README.md +++ b/README.md @@ -41,14 +41,13 @@ If these python modules aren't yet installed, when `greta` is used, it provides [![CRAN status](https://www.r-pkg.org/badges/version/greta)](https://CRAN.R-project.org/package=greta) -[![R-CMD-check](https://github.com/greta-dev/greta/workflows/R-CMD-check/badge.svg)](https://github.com/greta-dev/greta/actions) +[![R-CMD-check](https://github.com/greta-dev/greta/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/greta-dev/greta/actions/workflows/R-CMD-check.yaml) [![greta status badge](https://greta-dev.r-universe.dev/badges/greta)](https://greta-dev.r-universe.dev/greta) -[![Codecov test coverage](https://codecov.io/gh/greta-dev/greta/branch/master/graph/badge.svg)](https://app.codecov.io/gh/greta-dev/greta?branch=master) - - +[![Codecov test coverage](https://codecov.io/gh/greta-dev/greta/graph/badge.svg)](https://app.codecov.io/gh/greta-dev/greta) [![license](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/license/apache-2-0) [![doi](https://zenodo.org/badge/73758247.svg)](https://zenodo.org/badge/latestdoi/73758247) [![joss](https://joss.theoj.org/papers/10.21105/joss.01601/status.svg)](https://joss.theoj.org/papers/10.21105/joss.01601) + ![](logos/bottom_banner.png) diff --git a/tests/testthat/helpers.R b/tests/testthat/helpers.R index ff90097c..b39af166 100644 --- a/tests/testthat/helpers.R +++ b/tests/testthat/helpers.R @@ -797,7 +797,7 @@ get_enough_draws <- function( sampler = sampler, n_effective = 5000, time_limit = 300, - verbose = TRUE, + verbose = FALSE, one_by_one = FALSE ) { start_time <- Sys.time() @@ -873,8 +873,7 @@ check_mvn_samples <- function(sampler, n_effective = 3000) { draws <- get_enough_draws( m, sampler = sampler, - n_effective = n_effective, - verbose = FALSE + n_effective = n_effective ) # get MCMC samples for statistics of the samples (value, variance and @@ -927,7 +926,6 @@ check_samples <- function( model = m, sampler = sampler, n_effective = n_effective, - verbose = TRUE, one_by_one = one_by_one, time_limit = time_limit )