Skip to content

Commit

Permalink
use main branch + update GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
achubaty committed Apr 18, 2023
1 parent 5a49232 commit 67a4827
Show file tree
Hide file tree
Showing 12 changed files with 125 additions and 138 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Expand Up @@ -14,3 +14,4 @@
^vignettes/.*_cache$
^vignettes/\.pdf$
^codecov\.yml$
^pkgdown$
101 changes: 19 additions & 82 deletions .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

Expand All @@ -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
46 changes: 46 additions & 0 deletions .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
64 changes: 29 additions & 35 deletions .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
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,5 +2,6 @@
.Rhistory
.Rproj.user
.Ruserdata
docs
vignettes/*_cache
vignettes/*_files
1 change: 0 additions & 1 deletion DESCRIPTION
Expand Up @@ -68,4 +68,3 @@ Collate:
'zzz.R'
Encoding: UTF-8
Language: en-CA
RoxygenNote: 7.1.1
2 changes: 1 addition & 1 deletion R/grainscape-package.R
Expand Up @@ -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).
#'
Expand Down
14 changes: 7 additions & 7 deletions README.md
@@ -1,13 +1,13 @@
# grainscape

<!-- badges: start -->
[![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)
<!-- badges: end -->

<img align="right" width="80" pad="20" src="https://github.com/achubaty/grainscape/raw/master/stickers/hexsticker.png">
<img align="right" width="80" pad="20" src="https://github.com/achubaty/grainscape/raw/main/stickers/hexsticker.png">

## Efficient Modelling of Landscape Connectivity, Habitat, and Protected Area Networks

Expand Down Expand Up @@ -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")
```

Expand All @@ -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 <a href="https://github.com/achubaty/grainscape/actions">GitHub Actions</a> 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.
16 changes: 13 additions & 3 deletions _pkgdown.yml
@@ -1,6 +1,16 @@
destination: docs
template:
params:
bootswatch: flatly
ganalytics: UA-34446208-1
bootstrap: 5
bootswatch: flatly
includes:
in_header: |
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-SBRW4YWBD0"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-SBRW4YWBD0');
</script>
url: https://alexchubaty.com/grainscape
10 changes: 2 additions & 8 deletions cran-submission.md
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion man/grainscape-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/RcppExports.cpp
Expand Up @@ -5,6 +5,11 @@

using namespace Rcpp;

#ifdef RCPP_USE_GLOBAL_ROSTREAM
Rcpp::Rostream<true>& Rcpp::Rcout = Rcpp::Rcpp_cout_get();
Rcpp::Rostream<false>& 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) {
Expand Down

0 comments on commit 67a4827

Please sign in to comment.