diff --git a/.Rbuildignore b/.Rbuildignore index 48e7e3d..80a6608 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -14,3 +14,4 @@ ^vignettes/.*_cache$ ^vignettes/\.pdf$ ^codecov\.yml$ +^pkgdown$ diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 1fcca59..4e0f1ad 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -1,13 +1,10 @@ +# 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: - - master - - development - - LandWeb + branches: [main, development] pull_request: - branches: - - master - - development + branches: [main, development] name: R-CMD-check @@ -21,92 +18,32 @@ jobs: fail-fast: false matrix: config: - - {os: macOS-latest, r: 'release'} - - {os: windows-latest, r: 'devel'} + - {os: macos-latest, r: 'release'} - {os: windows-latest, r: 'release'} - - {os: windows-latest, r: '3.6'} - - {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.0.0 (ubuntu-18.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" } - - {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - - {os: ubuntu-18.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'oldrel-1'} env: - R_REMOTES_NO_ERRORS_FROM_WARNINGS: true - RSPM: ${{ matrix.config.rspm }} GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: r-lib/actions/setup-r@master + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true - - uses: r-lib/actions/setup-tinytex@v1 - - - uses: r-lib/actions/setup-pandoc@master - - - 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 additional dependencies - run: | - remotes::install_github('PredictiveEcology/Require@development') - remotes::install_github('PredictiveEcology/reproducible@development') - shell: Rscript {0} - - - name: Cache R packages - if: runner.os != 'Windows' - uses: actions/cache@v1 + - uses: r-lib/actions/setup-r-dependencies@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' - run: | - while read -r cmd - do - eval sudo $cmd - done < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "18.04"), sep = "\n")') - sudo apt-get install -y hunspell-en-ca - - - name: Install dependencies - run: | - if (R.version$major < 4) { - remotes::install_cran("versions") - versions::install.versions("XML", "3.99-0.3") - } - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("rcmdcheck") - shell: Rscript {0} - - - name: Session info - run: | - options(width = 100) - pkgs <- installed.packages()[, "Package"] - sessioninfo::session_info(pkgs, include_base = TRUE) - shell: Rscript {0} - - - name: Check - env: - _R_CHECK_CRAN_INCOMING_: false - run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), build_args = c("--compact-vignettes=both"), error_on = "warning", check_dir = "check") - shell: Rscript {0} - - - name: Show testthat output - if: always() - run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true - shell: bash + extra-packages: any::rcmdcheck + needs: check - - name: Upload check results - if: failure() - uses: actions/upload-artifact@main + - uses: r-lib/actions/check-r-package@v2 with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check + upload-snapshots: true diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml new file mode 100644 index 0000000..087f0b0 --- /dev/null +++ b/.github/workflows/pkgdown.yaml @@ -0,0 +1,46 @@ +# 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] + pull_request: + branches: [main, master] + release: + types: [published] + workflow_dispatch: + +name: pkgdown + +jobs: + pkgdown: + runs-on: ubuntu-latest + # Only restrict concurrency for non-PR jobs + concurrency: + group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v3 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::pkgdown, local::. + needs: website + + - name: Build site + run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) + shell: Rscript {0} + + - name: Deploy to GitHub pages 🚀 + if: github.event_name != 'pull_request' + uses: JamesIves/github-pages-deploy-action@v4.4.1 + with: + clean: false + branch: gh-pages + folder: docs diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index cb0d68b..bafca62 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -1,56 +1,50 @@ +# 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: - - master - - development + branches: [main, development] pull_request: - branches: - - master - - development + branches: [main, development] name: test-coverage jobs: test-coverage: - runs-on: macOS-latest - + runs-on: ubuntu-latest env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: r-lib/actions/setup-r@master + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true - - uses: r-lib/actions/setup-pandoc@master + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::covr + needs: coverage - - name: Query dependencies + - name: Test coverage 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") + covr::codecov( + quiet = FALSE, + clean = FALSE, + install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package") + ) shell: Rscript {0} - - name: Install additional dependencies + - name: Show testthat output + if: always() run: | - remotes::install_github('PredictiveEcology/Require@development') - remotes::install_github('PredictiveEcology/reproducible@development') - shell: Rscript {0} + ## -------------------------------------------------------------------- + find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true + shell: bash - - name: Cache R packages - uses: actions/cache@v1 + - name: Upload test results + if: failure() + uses: actions/upload-artifact@v3 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: | - install.packages(c("remotes")) - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("covr") - shell: Rscript {0} - - - name: Test coverage - run: covr::codecov() - shell: Rscript {0} + name: coverage-test-failures + path: ${{ runner.temp }}/package diff --git a/.gitignore b/.gitignore index 2c706a5..60d67cc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ .Rhistory .Rproj.user .Ruserdata +docs vignettes/*_cache vignettes/*_files diff --git a/DESCRIPTION b/DESCRIPTION index b56af5f..4b66e6b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -68,4 +68,3 @@ Collate: 'zzz.R' Encoding: UTF-8 Language: en-CA -RoxygenNote: 7.1.1 diff --git a/R/grainscape-package.R b/R/grainscape-package.R index 2703e78..047ce20 100644 --- a/R/grainscape-package.R +++ b/R/grainscape-package.R @@ -24,7 +24,7 @@ #' #' MPG calculations and generalization of the Voronoi tessellation used in GOC models #' is based on the routines in SELES software (Fall and Fall, 2001). -#' Routines also depend on the \code{sp} (Pebesma and Bivand, 2005), +#' Routines also depend on the \pkg{sp} (Pebesma and Bivand, 2005), #' \pkg{raster} (Hijmans and van Etten, 2011), \pkg{igraph} (Csardi and Nepusz, 2006), #' and optionally \pkg{rgeos} packages (Bivand and Rundel, 2012). #' diff --git a/README.md b/README.md index c159891..e02f9f4 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ # grainscape -[![R build status](https://github.com/achubaty/grainscape/workflows/R-CMD-check/badge.svg)](https://github.com/achubaty/grainscape/actions) +[![R-CMD-check](https://github.com/achubaty/grainscape/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/achubaty/grainscape/actions/workflows/R-CMD-check.yaml) [![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/grainscape)](https://cran.r-project.org/package=grainscape) [![DOI](https://zenodo.org/badge/62731055.svg)](https://zenodo.org/badge/latestdoi/62731055) -[![Codecov test coverage](https://codecov.io/gh/achubaty/grainscape/branch/master/graph/badge.svg)](https://codecov.io/gh/achubaty/grainscape?branch=master) +[![Codecov test coverage](https://codecov.io/gh/achubaty/grainscape/branch/main/graph/badge.svg)](https://codecov.io/gh/achubaty/grainscape?branch=main) - + ## Efficient Modelling of Landscape Connectivity, Habitat, and Protected Area Networks @@ -36,8 +36,8 @@ install.packages("grainscape") 2. **Install from GitHub:** ```r - #install.packages("devtools") - library("devtools") + #install.packages("remotes") + library("remotes") install_github("achubaty/grainscape") ``` @@ -48,8 +48,8 @@ Contact us via the package GitHub site: [https://github.com/achubaty/grainscape/ ### Contributions This Git repository uses the [Git Flow](https://nvie.com/posts/a-successful-git-branching-model/) branching model (the [`git flow`](https://github.com/petervanderdoes/gitflow-avh) extension is useful for this). -The [`development`](https://github.com/achubaty/grainscape/tree/development) branch contains the latest contributions and other code that will appear in the next release, and the [`master`](https://github.com/achubaty/grainscape) branch contains the code of the latest release, which is exactly what is currently on [CRAN](https://cran.r-project.org/package=grainscape). +The [`development`](https://github.com/achubaty/grainscape/tree/development) branch contains the latest contributions and other code that will appear in the next release, and the [`main`](https://github.com/achubaty/grainscape) branch contains the code of the latest release, which is exactly what is currently on [CRAN](https://cran.r-project.org/package=grainscape). To make a contribution to the package, just send a [pull request](https://help.github.com/articles/using-pull-requests/). When you send your PR, make sure `development` is the destination branch on the [grainscape repository](https://github.com/achubaty/grainscape). -Your PR should pass `R CMD check --as-cran`, which will also be checked by GitHub Actions when the PR is submitted. +Your PR should pass `R CMD check --as-cran`, which will also be checked by [GitHub Actions](https://github.com/achubaty/grainscape/actions) when the PR is submitted. diff --git a/_pkgdown.yml b/_pkgdown.yml index 253643b..41bce89 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -1,6 +1,16 @@ destination: docs template: - params: - bootswatch: flatly - ganalytics: UA-34446208-1 + bootstrap: 5 + bootswatch: flatly + includes: + in_header: | + + + url: https://alexchubaty.com/grainscape diff --git a/cran-submission.md b/cran-submission.md index 73de941..50bb5db 100644 --- a/cran-submission.md +++ b/cran-submission.md @@ -52,17 +52,11 @@ 9. run revdep checks (see `revdep/check.R`) -10. merge `development` branch into `master` +10. merge `development` branch into `main` 11. remove `Remotes` from `DESCRIPTION` -12. rebuild package website (`master` branch) - - ```r - pkgdown::build_site() - ``` - -13. submit to CRAN +12. submit to CRAN ```r devtools::release(args = "--compact-vignettes=both") diff --git a/man/grainscape-package.Rd b/man/grainscape-package.Rd index d4ea920..7f67f19 100644 --- a/man/grainscape-package.Rd +++ b/man/grainscape-package.Rd @@ -27,7 +27,7 @@ landscapes can also be generated using the software. MPG calculations and generalization of the Voronoi tessellation used in GOC models is based on the routines in SELES software (Fall and Fall, 2001). -Routines also depend on the \code{sp} (Pebesma and Bivand, 2005), +Routines also depend on the \pkg{sp} (Pebesma and Bivand, 2005), \pkg{raster} (Hijmans and van Etten, 2011), \pkg{igraph} (Csardi and Nepusz, 2006), and optionally \pkg{rgeos} packages (Bivand and Rundel, 2012). diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index 6083c77..99ab409 100644 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -5,6 +5,11 @@ using namespace Rcpp; +#ifdef RCPP_USE_GLOBAL_ROSTREAM +Rcpp::Rostream& Rcpp::Rcout = Rcpp::Rcpp_cout_get(); +Rcpp::Rostream& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get(); +#endif + // habConnRcpp List habConnRcpp(NumericVector cost, NumericVector patches, int ncol, int nrow); RcppExport SEXP _grainscape_habConnRcpp(SEXP costSEXP, SEXP patchesSEXP, SEXP ncolSEXP, SEXP nrowSEXP) {