From 7ba47edf6988a86b88b1a3088a68ebf13e6e0572 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Fri, 15 Sep 2023 08:48:47 -0400 Subject: [PATCH] test simplified github r cmd actions workflow --- .github/workflows/R-CMD-check.yaml | 89 ++++++------------------------ R/calibrate.R | 6 +- 2 files changed, 19 insertions(+), 76 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index eedf20e3..9f7beb04 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -1,12 +1,10 @@ -# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. -# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions +# 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 + branches: [main] pull_request: - branches: - - main + branches: [main] name: R-CMD-check @@ -20,86 +18,31 @@ jobs: fail-fast: false matrix: config: - - {os: macOS-latest, r: 'release'} + - {os: macos-latest, r: 'release'} - {os: windows-latest, r: 'release'} - {os: ubuntu-latest, r: 'release'} env: R_REMOTES_NO_ERRORS_FROM_WARNINGS: true - RSPM: ${{ matrix.config.rspm }} GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - RENV_CI_CACHE_VERSION_LINUX: 1 - RENV_CI_CACHE_VERSION_MACOS: 1 - RENV_CI_CACHE_VERSION_WINDOWS: 1 - USE_CXX1X: TRUE - USE_CXX11: TRUE + R_KEEP_PKG_SOURCE: yes steps: - - uses: actions/checkout@v2 - - - uses: r-lib/actions/setup-r@v2 - with: - r-version: ${{ matrix.config.r }} + - uses: actions/checkout@v3 - uses: r-lib/actions/setup-pandoc@v2 - with: - pandoc-version: '2.7.3' - - - name: Install system dependencies - if: runner.os == 'Linux' - env: - RHUB_PLATFORM: linux-x86_64-ubuntu-gcc - run: | - # install spatial dependencies - sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable - sudo apt update - sudo apt install \ - libudunits2-dev \ - libgdal-dev \ - libgeos-dev \ - libproj-dev \ - libharfbuzz-dev \ - libfribidi-dev - - name: Install system dependencies - if: runner.os == 'macOS' - run: | - # install spatial dependencies - brew install pkg-config gdal proj geos harfbuzz fribidi - export LDFLAGS="-L/usr/local/opt/libpq/lib" - export CPPFLAGS="-I/usr/local/opt/libpq/include" - - - name: Install renv - shell: Rscript {0} - run: | - install.packages("renv") - - - uses: actions/cache@v2 - if: startsWith(runner.os, 'Linux') + - uses: r-lib/actions/setup-r@v2 with: - path: ~/.local/share/renv - key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }} - restore-keys: | - ${{ runner.os }}-renv- + r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true - - uses: actions/cache@v2 - if: startsWith(runner.os, 'macOS') + - uses: r-lib/actions/setup-r-dependencies@v2 with: - path: ~/Library/Application Support/renv - key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }} - restore-keys: | - ${{ runner.os }}-renv- + extra-packages: any::rcmdcheck + needs: check - - uses: actions/cache@v2 - if: startsWith(runner.os, 'Windows') + - uses: r-lib/actions/check-r-package@v2 with: - path: ~\AppData\Local\renv - key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }} - restore-keys: | - ${{ runner.os }}-renv- - - - name: Restore packages - shell: Rscript {0} - run: | - renv::restore() - rcmdcheck::rcmdcheck(args = c("--no-manual", "--no-multiarch"), error_on = "warning") + upload-snapshots: true diff --git a/R/calibrate.R b/R/calibrate.R index 166b0b5b..3792d24d 100644 --- a/R/calibrate.R +++ b/R/calibrate.R @@ -796,7 +796,7 @@ calibrate <- function(infected_years_file, mean(c(median(parameters_test[, 16], na.rm = TRUE), config$quantity)) - 0.02 config$allocation_threshold <- mean(c(median(parameters_test[, 17], na.rm = TRUE), config$allocation)) - 0.02 - config$configuration_threshold<- + config$configuration_threshold <- mean(c(median(parameters_test[, 18], na.rm = TRUE), config$configuration_dis)) - 0.02 ## reset starting point of parameters kept and acceptance rate parameters_kept <- matrix(ncol = 18, nrow = config$num_particles) @@ -814,7 +814,7 @@ calibrate <- function(infected_years_file, config$mcc_threshold <- median(parameters_kept[, 15], na.rm = TRUE) config$quantity_threshold <- median(parameters_kept[, 16], na.rm = TRUE) config$allocation_threshold <- median(parameters_kept[, 17], na.rm = TRUE) - config$configuration_threshold<- median(parameters_kept[, 18], na.rm = TRUE) + config$configuration_threshold <- median(parameters_kept[, 18], na.rm = TRUE) ## reset starting point of parameters kept and acceptance rate parameters_kept <- matrix(ncol = 18, nrow = config$num_particles) parameters_test <- matrix(ncol = 18, nrow = 200) @@ -855,7 +855,7 @@ calibrate <- function(infected_years_file, config$mcc_threshold <- median(parameters_kept[start_index:end_index, 15]) config$quantity_threshold <- median(parameters_kept[start_index:end_index, 16]) config$allocation_threshold <- median(parameters_kept[start_index:end_index, 17]) - config$configuration_threshold<- median(parameters_kept[start_index:end_index, 18]) + config$configuration_threshold <- median(parameters_kept[start_index:end_index, 18]) config$current_bin <- config$current_bin + 1 }