Skip to content

Commit

Permalink
test simplified github r cmd actions workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisJones687 committed Sep 15, 2023
1 parent 3e15c63 commit 7ba47ed
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 76 deletions.
89 changes: 16 additions & 73 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
6 changes: 3 additions & 3 deletions R/calibrate.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 7ba47ed

Please sign in to comment.