Skip to content

Commit

Permalink
Merge pull request #22 from ThinkR-open/as-cran
Browse files Browse the repository at this point in the history
feat: Add check as CRAN does with env. variables
  • Loading branch information
statnmap authored Sep 21, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 566ddd5 + 3da1e25 commit 75e9141
Showing 32 changed files with 2,555 additions and 178 deletions.
72 changes: 20 additions & 52 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
# 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
branches: [main, master]
pull_request:
branches:
- master
branches: [main, master]

name: R-CMD-check

@@ -20,62 +18,32 @@ jobs:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/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: 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-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@v2
- 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 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
shell: Rscript {0}

- name: Check
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}
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
56 changes: 29 additions & 27 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -1,47 +1,49 @@
# 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
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: pkgdown

jobs:
pkgdown:
runs-on: macOS-latest
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@v2

- uses: r-lib/actions/setup-r@master
- uses: r-lib/actions/setup-pandoc@v2

- 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}
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Cache R packages
uses: actions/cache@v2
- 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-
extra-packages: any::pkgdown, local::.
needs: website

- name: Install dependencies
- name: Build site
run: |
remotes::install_deps(dependencies = TRUE)
install.packages("remotes")
remotes::install_github("ThinkR-open/thinkrtemplate")
install.packages("pkgdown")
pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Install package
run: R CMD INSTALL .

- name: Deploy package
run: |
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@4.1.4
with:
clean: false
branch: gh-pages
folder: docs
41 changes: 13 additions & 28 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,46 +1,31 @@
# 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
branches: [main, master]
pull_request:
branches:
- master
branches: [main, master]

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: r-lib/actions/setup-r@master

- 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
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-
use-public-rspm: true

- name: Install dependencies
run: |
install.packages(c("remotes"))
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("covr")
shell: Rscript {0}
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr
needs: coverage

- name: Test coverage
run: covr::codecov()
run: covr::codecov(quiet = FALSE)
shell: Rscript {0}
28 changes: 13 additions & 15 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,43 +1,41 @@
Package: checkhelper
Title: Deal with check outputs
Version: 0.0.0.9000
Authors@R:
c(person(given = "Sebastien",
family = "Rochette",
role = c("aut", "cre"),
email = "sebastien@thinkr.fr"),
person(given = "Vincent",
family = "Guyader",
role = "aut",
email = "vincent@thinkr.fr"))
Version: 0.0.1
Authors@R: c(
person("Sebastien", "Rochette", , "sebastien@thinkr.fr", role = c("aut", "cre")),
person("Vincent", "Guyader", , "vincent@thinkr.fr", role = "aut")
)
Description: A package to help you deal with devtools::check outputs.
License: GPL-3
URL: https://thinkr-open.github.io/checkhelper/,
https://github.com/ThinkR-open/checkhelper
BugReports: https://github.com/ThinkR-open/checkhelper/issues
Imports:
cli,
desc,
dplyr,
glue,
magrittr,
pkgbuild,
purrr,
rcmdcheck,
roxygen2,
stringr,
tools,
utils,
whisker
whisker,
withr
Suggests:
cli,
attachment,
callr,
fs,
knitr,
rmarkdown,
testthat,
usethis,
withr
usethis
VignetteBuilder:
knitr
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.2
RoxygenNote: 7.2.1
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generated by roxygen2: do not edit by hand

export("%>%")
export(check_as_cran)
export(find_missing_tags)
export(get_data_info)
export(get_no_visible)
8 changes: 5 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# checkhelper 0.0.0.9000
# checkhelper 0.0.1

* Print code to add to 'globals.R'
* Extract "no visibles" from notes of rcmdcheck()
* Check with same variables and parameters as CRAN (#21)
* Find missing tags in your roxygen skeletons with `find_missing_tags()`
* Print code to add to 'globals.R' with `print_globals()`
* Extract "no visibles" from notes of `rcmdcheck()`
* Added a `NEWS.md` file to track changes to the package.
3 changes: 2 additions & 1 deletion R/ch_list_globals.R
Original file line number Diff line number Diff line change
@@ -62,7 +62,8 @@ get_notes <- function(path = ".", checks, ...) {
res <- tibble(notes = strsplit(notes_with_globals_return, "RETURN")[[1]]) %>%
# res <- tibble(notes = strsplit(notes_with_globals, "\n")[[1]]) %>%
mutate(
fun = str_extract(notes, ".+(?=:)"),
# Maybe a path in parenthesis ?
fun = str_extract(notes, "(\\s*\\(.*\\)\\s){0,1}.+(?=:)"),
is_function = grepl("no visible global function definition", notes),
is_global_variable = grepl("no visible binding for global variable", notes),
variable = str_extract(notes, "(?<=\\u2018).+(?=\\u2019)|(?<=\\u0027).+(?=\\u0027)"),
Loading

0 comments on commit 75e9141

Please sign in to comment.