-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from inbo/more_work
Version 0.1.1
- Loading branch information
Showing
41 changed files
with
1,126 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
on: | ||
push: | ||
branches-ignore: | ||
- master | ||
- ghpages | ||
|
||
name: "check package" | ||
|
||
jobs: | ||
check-package: | ||
runs-on: ubuntu-latest | ||
name: "check package" | ||
steps: | ||
- uses: inbo/actions/check_pkg@master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
name: R-CMD-check | ||
|
||
jobs: | ||
R-CMD-check: | ||
runs-on: ${{ matrix.config.os }} | ||
|
||
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
- {os: macOS-latest, r: 'devel'} | ||
- {os: macOS-latest, r: 'release'} | ||
- {os: windows-latest, r: 'release'} | ||
- {os: ubuntu-16.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} | ||
|
||
env: | ||
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | ||
RSPM: ${{ matrix.config.rspm }} | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: r-lib/actions/setup-r@master | ||
with: | ||
r-version: ${{ matrix.config.r }} | ||
|
||
- 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: Cache R packages | ||
if: runner.os != 'Windows' | ||
uses: actions/cache@v1 | ||
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: | | ||
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"), 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 | ||
|
||
- name: Upload check results | ||
if: failure() | ||
uses: actions/upload-artifact@master | ||
with: | ||
name: ${{ runner.os }}-r${{ matrix.config.r }}-results | ||
path: check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
on: | ||
push: | ||
branches: | ||
- master | ||
schedule: | ||
- cron: '6 0 * * 1' | ||
|
||
name: "check package on master" | ||
|
||
jobs: | ||
check-package: | ||
runs-on: ubuntu-latest | ||
name: "check package" | ||
steps: | ||
- uses: inbo/actions/check_pkg@master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Type: Package | ||
Package: checklist | ||
Title: A Thorough and Strict Set of Checks for R Packages | ||
Version: 0.1.0 | ||
Version: 0.1.1 | ||
Authors@R: | ||
c(person(given = "Thierry", | ||
family = "Onkelinx", | ||
|
@@ -13,13 +13,19 @@ Authors@R: | |
email = "[email protected]")) | ||
Description: An opinated set of rules for R packages and code. | ||
License: GPL-3 | ||
Imports: | ||
assertthat, | ||
devtools, | ||
git2r, | ||
lintr, | ||
R6, | ||
rcmdcheck, | ||
rmarkdown, | ||
usethis, | ||
yaml | ||
Suggests: | ||
testthat | ||
Encoding: UTF-8 | ||
LazyData: true | ||
Roxygen: list(markdown = TRUE) | ||
RoxygenNote: 7.1.1 | ||
Imports: | ||
assertthat, | ||
lintr, | ||
rcmdcheck, | ||
R6, | ||
yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,44 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(check_cran) | ||
export(check_description) | ||
export(check_documentation) | ||
export(check_filename) | ||
export(check_lintr) | ||
export(check_package) | ||
export(check_source) | ||
export(checklist) | ||
export(checklist_template) | ||
export(is_workdir_clean) | ||
export(read_checklist) | ||
export(write_checklist) | ||
export(yesno) | ||
importFrom(R6,R6Class) | ||
importFrom(assertthat,assert_that) | ||
importFrom(assertthat,has_name) | ||
importFrom(assertthat,is.flag) | ||
importFrom(assertthat,is.string) | ||
importFrom(assertthat,noNA) | ||
importFrom(devtools,document) | ||
importFrom(git2r,branch_target) | ||
importFrom(git2r,branches) | ||
importFrom(git2r,commits) | ||
importFrom(git2r,in_repository) | ||
importFrom(git2r,ls_tree) | ||
importFrom(git2r,repository) | ||
importFrom(git2r,repository_head) | ||
importFrom(git2r,reset) | ||
importFrom(git2r,sha) | ||
importFrom(git2r,status) | ||
importFrom(lintr,lint_dir) | ||
importFrom(lintr,lint_package) | ||
importFrom(rcmdcheck,rcmdcheck) | ||
importFrom(rmarkdown,github_document) | ||
importFrom(rmarkdown,render) | ||
importFrom(stats,na.omit) | ||
importFrom(usethis,use_tidy_description) | ||
importFrom(utils,file_test) | ||
importFrom(utils,head) | ||
importFrom(utils,menu) | ||
importFrom(utils,tail) | ||
importFrom(yaml,read_yaml) | ||
importFrom(yaml,write_yaml) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# checklist 0.1.1 | ||
|
||
* Added a `NEWS.md` file to track changes to the package. | ||
* Added a `README.Rmd` file with installation instructions. | ||
* Rework `checklist_template()` into `write_checklist()`. | ||
* Add `check_description()`. | ||
* Add `check_documentation()`. | ||
* Add `check_filename()`. | ||
* Add `check_source()`. | ||
* `check_lintr()` also works on source code repositories. | ||
* Activate GitHub action `inbo/check_package`. | ||
|
||
# checklist 0.1.0 | ||
|
||
* Initital version. | ||
* Create `checklist` R6 class. | ||
* Add `check_cran()`. | ||
* Add `check_lintr()`. | ||
* Add `check_package()`. | ||
* Add `read_checklist()`. | ||
* Add `checklist_template()`. | ||
* Add Dockerimage for GitHub actions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#' Check the DESCRIPTION file | ||
#' @inheritParams read_checklist | ||
#' @importFrom assertthat has_name | ||
#' @importFrom git2r branches branch_target commits repository repository_head | ||
#' reset sha | ||
#' @importFrom stats na.omit | ||
#' @importFrom usethis use_tidy_description | ||
#' @importFrom utils head tail | ||
#' @export | ||
check_description <- function(x = ".") { | ||
if (!inherits(x, "Checklist") || !"checklist" %in% x$get_checked) { | ||
x <- read_checklist(x = x) | ||
} | ||
assert_that( | ||
x$package, | ||
msg = "`check_description()` is only relevant for packages. | ||
`checklist.yml` indicates this is not a package." | ||
) | ||
|
||
repo <- repository(x$get_path) | ||
description <- file.path(x$get_path, "DESCRIPTION") | ||
assert_that(file_test("-f", description), msg = "DESCRIPTION file missing") | ||
|
||
version <- read.dcf(description)[, "Version"] | ||
"Incorrect version tag format. Use `0.0`, `0.0.0`"[ | ||
!grepl("^[0-9]+\\.[0-9]+(\\.[0-9]+)?$", version) | ||
] -> desc_error | ||
|
||
branch_sha <- vapply(branches(repo, "all"), branch_target, character(1)) | ||
head_sha <- sha(repository_head(repo)) | ||
current_branch <- head(names(which(branch_sha == head_sha)), 1) | ||
if (current_branch == "master") { | ||
old_sha <- vapply( | ||
tail(commits(repo, ref = "master", n = 2), 1), sha, character(1) | ||
) | ||
desc_diff <- system2( | ||
"git", args = c("diff", old_sha, head_sha, "DESCRIPTION"), | ||
stdout = TRUE | ||
) | ||
} else { | ||
desc_diff <- system2( | ||
"git", args = c("diff", "origin/master", "--", "DESCRIPTION"), | ||
stdout = TRUE | ||
) | ||
} | ||
clean <- is_workdir_clean(repo) | ||
use_tidy_description() | ||
if (clean && !is_workdir_clean(repo)) { | ||
desc_error <- c( | ||
desc_error, | ||
"DESCRIPTION not tidy. use `usethis::use_tidy_description()`" | ||
) | ||
reset(repo) | ||
} | ||
old_version <- desc_diff[grep("\\-Version: ", desc_diff)] | ||
old_version <- gsub("-Version: ", "", old_version) | ||
version_bump <- ifelse( | ||
length(old_version), | ||
ifelse( | ||
package_version(old_version) < package_version(version), | ||
NA, | ||
"Package version not increased" | ||
), | ||
"Package version not updated" | ||
) | ||
desc_error <- c(desc_error, na.omit(version_bump)) | ||
|
||
x$add_error(desc_error, "DESCRIPTION") | ||
return(x) | ||
} |
Oops, something went wrong.