From 659f75ecf56f2697a52e3cfc90015f99f8c6c43e Mon Sep 17 00:00:00 2001 From: David Blodgett Date: Sat, 16 Nov 2024 15:27:32 -0600 Subject: [PATCH] update actions --- .github/workflows/R-CMD-check.yml | 64 +++++++--------------- R/calculate_area_intersection_weights.R | 10 ++-- man/calculate_area_intersection_weights.Rd | 10 ++-- 3 files changed, 31 insertions(+), 53 deletions(-) diff --git a/.github/workflows/R-CMD-check.yml b/.github/workflows/R-CMD-check.yml index 098027b..24e464f 100644 --- a/.github/workflows/R-CMD-check.yml +++ b/.github/workflows/R-CMD-check.yml @@ -10,59 +10,37 @@ name: R-CMD-check jobs: R-CMD-check: - runs-on: ubuntu-20.04 + runs-on: ${{ matrix.config.os }} env: R_REMOTES_NO_ERRORS_FROM_WARNINGS: true GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} _R_CHECK_TESTS_NLINES_: 0 + NOT_CRAN: true + strategy: + fail-fast: false + matrix: + config: + - {os: macos-latest, r: 'release'} + - {os: windows-latest, r: 'release'} + - {os: ubuntu-latest, r: 'release'} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: r-lib/actions/setup-r@v2 - - - 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@v2 + - uses: r-lib/actions/setup-r@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- - - - name: Install system dependencies - if: runner.os == 'Linux' - env: - RHUB_PLATFORM: linux-x86_64-ubuntu-gcc - run: | - Rscript -e "remotes::install_github('r-hub/sysreqs')" - sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))") - sudo -s eval "$sysreqs" - - - name: Install dependencies - run: | - install.packages(c("remotes")) - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("rcmdcheck") - remotes::install_cran("covr") - shell: Rscript {0} - - - name: Check - run: rcmdcheck::rcmdcheck(args = c("--ignore-vignettes", "--no-manual"), build_args = c("--no-build-vignettes"), error_on = "error", check_dir = "check") - shell: Rscript {0} + r-version: ${{ matrix.config.r }} + use-public-rspm: true + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck, any::covr + needs: check, coverage - - name: Upload check results - if: failure() - uses: actions/upload-artifact@v3 + - uses: r-lib/actions/check-r-package@v2 with: - name: results - path: check + upload-snapshots: true - name: Test coverage run: covr::codecov() - shell: Rscript {0} + shell: Rscript {0} \ No newline at end of file diff --git a/R/calculate_area_intersection_weights.R b/R/calculate_area_intersection_weights.R index 0eba8f6..621ad30 100644 --- a/R/calculate_area_intersection_weights.R +++ b/R/calculate_area_intersection_weights.R @@ -47,6 +47,10 @@ #' #' @examples #' +#' library(dplyr) +#' library(sf) +#' library(ncdfgeom) +#' #' g <- list(rbind(c(-1,-1), c(1,-1), c(1,1), c(-1,1), c(-1,-1))) #' #' a1 = sf::st_polygon(g) * 0.8 @@ -97,15 +101,11 @@ #' #' calculate_area_intersection_weights(b, a, normalize = TRUE) #' -#' NOTE: normalize = TRUE so weights sum to 1 per target polygon. Non-overlap +#' # NOTE: normalize = TRUE so weights sum to 1 per target polygon. Non-overlap #' # is ignored as if it does not exist. #' #' # a more typical arrangement of polygons #' -#' library(dplyr) -#' library(sf) -#' library(ncdfgeom) -#' #' g <- list(rbind(c(-1,-1), c(1,-1), c(1,1), #' c(-1,1), c(-1,-1))) #' diff --git a/man/calculate_area_intersection_weights.Rd b/man/calculate_area_intersection_weights.Rd index 6a103c3..2bbe991 100644 --- a/man/calculate_area_intersection_weights.Rd +++ b/man/calculate_area_intersection_weights.Rd @@ -60,6 +60,10 @@ sum to 1 per TARGET polygon if the target polygon is fully covered by source pol } \examples{ +library(dplyr) +library(sf) +library(ncdfgeom) + g <- list(rbind(c(-1,-1), c(1,-1), c(1,1), c(-1,1), c(-1,-1))) a1 = sf::st_polygon(g) * 0.8 @@ -110,15 +114,11 @@ calculate_area_intersection_weights(b, a, normalize = FALSE) calculate_area_intersection_weights(b, a, normalize = TRUE) -NOTE: normalize = TRUE so weights sum to 1 per target polygon. Non-overlap +# NOTE: normalize = TRUE so weights sum to 1 per target polygon. Non-overlap # is ignored as if it does not exist. # a more typical arrangement of polygons -library(dplyr) -library(sf) -library(ncdfgeom) - g <- list(rbind(c(-1,-1), c(1,-1), c(1,1), c(-1,1), c(-1,-1)))