Skip to content

Commit ae0d749

Browse files
committed
Add GH actions, codecov, contributing info
1 parent 5093cfc commit ae0d749

13 files changed

+424
-1
lines changed

.Rbuildignore

+2
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
^\.Rproj\.user$
33
^README\.Rmd$
44
^LICENSE\.md$
5+
^codecov\.yml$
6+
^\.github$

.github/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.html

.github/CODEOWNERS

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# CODEOWNERS for spatialsample
2+
# https://www.tidyverse.org/development/understudies
3+
.github/CODEOWNERS @topepo @juliasilge

.github/CONTRIBUTING.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Contributing to tidymodels
2+
3+
For more detailed information about contributing to tidymodels packages, see our [**development contributing guide**](https://www.tidymodels.org/contribute/).
4+
5+
## Documentation
6+
7+
Typos or grammatical errors in documentation may be edited directly using the GitHub web interface, as long as the changes are made in the _source_ file.
8+
9+
* YES ✅: you edit a roxygen comment in an `.R` file in the `R/` directory.
10+
* NO 🚫: you edit an `.Rd` file in the `man/` directory.
11+
12+
We use [roxygen2](https://cran.r-project.org/package=roxygen2), with [Markdown syntax](https://cran.r-project.org/web/packages/roxygen2/vignettes/rd-formatting.html), for documentation.
13+
14+
## Code
15+
16+
Before you submit 🎯 a pull request on a tidymodels package, always file an issue and confirm the tidymodels team agrees with your idea and is happy with your basic proposal.
17+
18+
The [tidymodels packages](https://www.tidymodels.org/packages/) work together. Each package contains its own unit tests, while integration tests and other tests using all the packages are contained in [extratests](https://github.com/tidymodels/extratests).
19+
20+
* For pull requests, we recommend that you [create a fork of this repo](https://usethis.r-lib.org/articles/articles/pr-functions.html) with `usethis::create_from_github()`, and then initiate a new branch with `usethis::pr_init()`.
21+
* Look at the build status before and after making changes. The `README` contains badges for any continuous integration services used by the package.
22+
* New code should follow the tidyverse [style guide](http://style.tidyverse.org). You can use the [styler](https://CRAN.R-project.org/package=styler) package to apply these styles, but please don't restyle code that has nothing to do with your PR.
23+
* For user-facing changes, add a bullet to the top of `NEWS.md` below the current development version header describing the changes made followed by your GitHub username, and links to relevant issue(s)/PR(s).
24+
* We use [testthat](https://cran.r-project.org/package=testthat). Contributions with test cases included are easier to accept.
25+
* If your contribution spans the use of more than one package, consider building [extratests](https://github.com/tidymodels/extratests) with your changes to check for breakages and/or adding new tests there. Let us know in your PR if you ran these extra tests.
26+
27+
### Code of Conduct
28+
29+
This project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.

.github/workflows/R-CMD-check.yaml

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# NOTE: This workflow is overkill for most R packages
2+
# check-standard.yaml is likely a better choice
3+
# usethis::use_github_action("check-standard") will install it.
4+
#
5+
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
6+
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
7+
on:
8+
push:
9+
branches:
10+
- main
11+
- master
12+
pull_request:
13+
branches:
14+
- main
15+
- master
16+
17+
name: R-CMD-check
18+
19+
jobs:
20+
R-CMD-check:
21+
runs-on: ${{ matrix.config.os }}
22+
23+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
24+
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
config:
29+
- {os: macOS-latest, r: 'release'}
30+
- {os: windows-latest, r: 'release'}
31+
- {os: windows-latest, r: '3.6'}
32+
- {os: ubuntu-16.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest", http-user-agent: "R/4.0.0 (ubuntu-16.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" }
33+
- {os: ubuntu-16.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
34+
- {os: ubuntu-16.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
35+
- {os: ubuntu-16.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
36+
- {os: ubuntu-16.04, r: '3.4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
37+
- {os: ubuntu-16.04, r: '3.3', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
38+
39+
env:
40+
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
41+
RSPM: ${{ matrix.config.rspm }}
42+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
43+
44+
steps:
45+
- uses: actions/checkout@v2
46+
47+
- uses: r-lib/actions/setup-r@v1
48+
with:
49+
r-version: ${{ matrix.config.r }}
50+
http-user-agent: ${{ matrix.config.http-user-agent }}
51+
52+
- uses: r-lib/actions/setup-pandoc@v1
53+
54+
- name: Query dependencies
55+
run: |
56+
install.packages('remotes')
57+
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
58+
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
59+
shell: Rscript {0}
60+
61+
- name: Cache R packages
62+
if: runner.os != 'Windows'
63+
uses: actions/cache@v2
64+
with:
65+
path: ${{ env.R_LIBS_USER }}
66+
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
67+
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
68+
69+
- name: Install system dependencies
70+
if: runner.os == 'Linux'
71+
run: |
72+
while read -r cmd
73+
do
74+
eval sudo $cmd
75+
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "16.04"))')
76+
77+
- name: Install dependencies
78+
run: |
79+
remotes::install_deps(dependencies = TRUE)
80+
remotes::install_cran("rcmdcheck")
81+
shell: Rscript {0}
82+
83+
- name: Session info
84+
run: |
85+
options(width = 100)
86+
pkgs <- installed.packages()[, "Package"]
87+
sessioninfo::session_info(pkgs, include_base = TRUE)
88+
shell: Rscript {0}
89+
90+
- name: Check
91+
env:
92+
_R_CHECK_CRAN_INCOMING_: false
93+
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
94+
shell: Rscript {0}
95+
96+
- name: Show testthat output
97+
if: always()
98+
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
99+
shell: bash
100+
101+
- name: Upload check results
102+
if: failure()
103+
uses: actions/upload-artifact@main
104+
with:
105+
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
106+
path: check

.github/workflows/check-pak.yaml

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# NOTE: This workflow is overkill for most R packages
2+
# check-standard.yaml is likely a better choice
3+
# usethis::use_github_action("check-standard") will install it.
4+
#
5+
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
6+
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
7+
on:
8+
push:
9+
branches:
10+
- main
11+
- master
12+
pull_request:
13+
branches:
14+
- main
15+
- master
16+
17+
name: R-CMD-check-with-pak
18+
19+
jobs:
20+
R-CMD-check:
21+
runs-on: ${{ matrix.config.os }}
22+
23+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
24+
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
config:
29+
- {os: macOS-latest, r: 'release'}
30+
- {os: windows-latest, r: 'release'}
31+
- {os: windows-latest, r: '3.6'}
32+
- {os: ubuntu-16.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest", http-user-agent: "R/4.0.0 (ubuntu-16.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" }
33+
- {os: ubuntu-16.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
34+
- {os: ubuntu-16.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
35+
- {os: ubuntu-16.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
36+
- {os: ubuntu-16.04, r: '3.4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
37+
- {os: ubuntu-16.04, r: '3.3', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
38+
39+
env:
40+
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
41+
RSPM: ${{ matrix.config.rspm }}
42+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
43+
44+
steps:
45+
- uses: actions/checkout@v2
46+
47+
- uses: r-lib/actions/setup-r@v1
48+
id: install-r
49+
with:
50+
r-version: ${{ matrix.config.r }}
51+
http-user-agent: ${{ matrix.config.http-user-agent }}
52+
53+
- uses: r-lib/actions/setup-pandoc@v1
54+
55+
- name: Install pak and query dependencies
56+
run: |
57+
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
58+
saveRDS(pak::pkg_deps_tree("local::.", dependencies = TRUE), ".github/r-depends.rds")
59+
shell: Rscript {0}
60+
61+
- name: Cache R packages
62+
uses: actions/cache@v2
63+
with:
64+
path: ${{ env.R_LIBS_USER }}
65+
key: ${{ runner.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
66+
restore-keys: ${{ runner.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-
67+
68+
- name: Install system dependencies
69+
if: runner.os == 'Linux'
70+
run: Rscript -e 'pak::local_system_requirements(execute = TRUE)'
71+
72+
- name: Install dependencies
73+
run: |
74+
pak::local_install_dev_deps(upgrade = TRUE)
75+
pak::pkg_install("rcmdcheck")
76+
shell: Rscript {0}
77+
78+
- name: Session info
79+
run: |
80+
options(width = 100)
81+
pkgs <- installed.packages()[, "Package"]
82+
sessioninfo::session_info(pkgs, include_base = TRUE)
83+
shell: Rscript {0}
84+
85+
- name: Check
86+
env:
87+
_R_CHECK_CRAN_INCOMING_: false
88+
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
89+
shell: Rscript {0}
90+
91+
- name: Show testthat output
92+
if: always()
93+
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
94+
shell: bash
95+
96+
- name: Upload check results
97+
if: failure()
98+
uses: actions/upload-artifact@main
99+
with:
100+
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
101+
path: check

.github/workflows/pkgdown.yaml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
- main
6+
pull_request:
7+
branches:
8+
- master
9+
- main
10+
11+
name: pkgdown
12+
13+
jobs:
14+
pkgdown:
15+
runs-on: macOS-latest
16+
env:
17+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- uses: r-lib/actions/setup-r@v1
22+
23+
- uses: r-lib/actions/setup-pandoc@v1
24+
25+
- name: Query dependencies
26+
run: |
27+
install.packages('remotes')
28+
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
29+
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
30+
shell: Rscript {0}
31+
32+
- name: Cache R packages
33+
uses: actions/cache@v2
34+
with:
35+
path: ${{ env.R_LIBS_USER }}
36+
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
37+
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
38+
39+
- name: Install dependencies
40+
run: |
41+
remotes::install_deps(dependencies = TRUE)
42+
remotes::install_github("tidyverse/tidytemplate")
43+
install.packages("pkgdown", type = "binary")
44+
shell: Rscript {0}
45+
46+
- name: Install package
47+
run: R CMD INSTALL .
48+
49+
- name: Build site
50+
if: github.event_name == 'pull_request'
51+
run: |
52+
Rscript -e 'pkgdown::build_site()'
53+
54+
- name: Deploy package
55+
run: |
56+
git config --local user.email "actions@github.com"
57+
git config --local user.name "GitHub Actions"
58+
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'

.github/workflows/pr-commands.yaml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
on:
2+
issue_comment:
3+
types: [created]
4+
name: Commands
5+
jobs:
6+
document:
7+
if: startsWith(github.event.comment.body, '/document')
8+
name: document
9+
runs-on: macOS-latest
10+
env:
11+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: r-lib/actions/pr-fetch@v1
15+
with:
16+
repo-token: ${{ secrets.GITHUB_TOKEN }}
17+
- uses: r-lib/actions/setup-r@v1
18+
- name: Install dependencies
19+
run: Rscript -e 'install.packages(c("remotes", "roxygen2"))' -e 'remotes::install_deps(dependencies = TRUE)'
20+
- name: Document
21+
run: Rscript -e 'roxygen2::roxygenise()'
22+
- name: commit
23+
run: |
24+
git config --local user.email "actions@github.com"
25+
git config --local user.name "GitHub Actions"
26+
git add man/\* NAMESPACE
27+
git commit -m 'Document'
28+
- uses: r-lib/actions/pr-push@v1
29+
with:
30+
repo-token: ${{ secrets.GITHUB_TOKEN }}
31+
style:
32+
if: startsWith(github.event.comment.body, '/style')
33+
name: style
34+
runs-on: macOS-latest
35+
env:
36+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
37+
steps:
38+
- uses: actions/checkout@v2
39+
- uses: r-lib/actions/pr-fetch@v1
40+
with:
41+
repo-token: ${{ secrets.GITHUB_TOKEN }}
42+
- uses: r-lib/actions/setup-r@v1
43+
- name: Install dependencies
44+
run: Rscript -e 'install.packages("styler")'
45+
- name: Style
46+
run: Rscript -e 'styler::style_pkg()'
47+
- name: commit
48+
run: |
49+
git config --local user.email "actions@github.com"
50+
git config --local user.name "GitHub Actions"
51+
git add \*.R
52+
git commit -m 'Style'
53+
- uses: r-lib/actions/pr-push@v1
54+
with:
55+
repo-token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)