Skip to content

Sort .Rbuildignore #366

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
^.*\.Rproj$
^API$
^CONTRIBUTING\.md$
^LICENSE\.md$
^README\.Rmd$
^\.Rproj\.user$
^\.github$
^\.pre-commit-config\.yaml$
^\.pre-commit-hooks\.yaml$
^\.Rproj\.user$
^API$
^CONTRIBUTING\.md$
^_pkgdown\.yml$
^cran-comments\.md$
^docs$
^inst/WORDLIST$
^inst/hooks/local$
^inst/renv-update\.R$
^inst/WORDLIST$
^LICENSE\.md$
^pkgdown$
^_pkgdown\.yml$
^README\.Rmd$
^renv$
^renv\.lock$
^scratch$
5 changes: 3 additions & 2 deletions .github/workflows/hook-dependencies-upate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ jobs:
sudo -s eval "$sysreqs"
- name: update existing packages
run: |
options(repos = c(CRAN = "https://packagemanager.rstudio.com/all/latest"))
install.packages('renv')
install.packages('jsonlite')
renv_deps <- names(jsonlite::read_json('renv.lock')$Packages)
renv::load()
renv::restore()
can_be_updated <- renv::update(renv_deps)
can_be_updated <- renv::update(renv_deps, prompt = FALSE)
renv::snapshot(packages = renv_deps)
shell: Rscript {0}
- name: update dependency graph among packages
Expand All @@ -58,7 +59,7 @@ jobs:
out <- names(renv:::renv_package_dependencies(out))
return(out)
}

options(repos = c(CRAN = "https://packagemanager.rstudio.com/all/latest"))
options(renv.snapshot.filter = hook_deps)

renv::snapshot(type = "custom", prompt = FALSE)
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/hook-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
with:
path: ~\AppData\Local\renv
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('renv.lock') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-2-

- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
Expand All @@ -70,8 +70,11 @@ jobs:
renv::install(getwd(), dependencies = FALSE)
# needed to make sure renv is activated in run_test()
activate <- c(
"if (nzchar(Sys.getenv('R_PRECOMMIT_HOOK_ENV')))",
paste0("renv::load('", getwd(), "')")
"if (nzchar(Sys.getenv('R_PRECOMMIT_HOOK_ENV'))) {",
paste0(" renv::load(\"", getwd(), "\")"),
# " print(renv::status())",
"}",
"print('R profile activated')"
)
writeLines(activate, '~/.Rprofile')
shell: Rscript {0}
Expand Down
12 changes: 2 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,14 @@ repos:
- id: check-added-large-files
- id: end-of-file-fixer
exclude: '\.Rd' # sometimes roxygen fails to generate EOF blank line.
- id: file-contents-sorter
files: '^\.Rbuildignore$'
- repo: https://github.com/lorenzwalthert/gitignore-tidy
rev: 65851818058ac40fd8e9640b4dc026e8724c629f
hooks:
- id: tidy-gitignore
- repo: local
hooks:
- id: install-local
name: install-local
entry: Rscript -e "renv::deactivate(); devtools::install(dependencies = c('imports', 'depends'))"
language: r
additional_dependencies:
- callr
- devtools
- renv
stages: [push]
always_run: True
- id: consistent-release-tag
name: consistent-release-tag
entry: Rscript inst/hooks/local/consistent-release-tag.R
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# precommit 0.2.1.900* (Development version)

* The template `.pre-commit-config.yaml` does now include `file-contents-sorter`
to sort `.Rbuildignore` (#366).
* Port codemeta hook to `language: r` (#350).
* Don't include `R` as a dependency with
`snippet_generate("additional-deps-roxygenize")` (#358).
Expand Down
2 changes: 2 additions & 0 deletions inst/pre-commit-config-pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ repos:
hooks:
- id: check-added-large-files
args: ['--maxkb=200']
- id: file-contents-sorter
files: '^\.Rbuildignore$'
- id: end-of-file-fixer
exclude: '\.Rd'
- repo: local
Expand Down
Loading