Skip to content
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

End of year cleanup #150

Merged
merged 9 commits into from
Dec 14, 2023
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
2 changes: 2 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ on:
- 'LICENSE'
- '.Rbuildignore'
- '.github/workflows/R-CMD-check.yaml'
merge_group:
pull_request:
paths:
- 'data/**'
Expand Down Expand Up @@ -85,6 +86,7 @@ jobs:
id: rcmdcheck
with:
upload-snapshots: true
error-on: '"note"'

# fail-fast but only if rcmdcheck step fails
- name: Manual fail-fast
Expand Down
75 changes: 75 additions & 0 deletions .github/workflows/dependency-change.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# 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:
pull_request:
paths:
- 'DESCRIPTION'

name: Analyze dependency changes

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
pull-requests: write

jobs:
dependency-changes:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Install dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
packages: any::pak, glue, gh

- name: Analyze dependency changes
shell: Rscript {0}
run: |
deps_base <- pak::pkg_deps("${{ github.repository }}@${{ github.base_ref }}", dependencies = TRUE) |>
subset(!directpkg) |>
subset(is.na(priority))
# We install from PR number rather than branch to deal with the case
# of PR coming from forks
deps_head <- pak::pkg_deps("${{ github.repository }}#${{ github.event.number }}", dependencies = TRUE) |>
subset(!directpkg) |>
subset(is.na(priority))

deps_added <- deps_head |>
subset(!ref %in% deps_base$ref)

deps_removed <- deps_base |>
subset(!ref %in% deps_head$ref)

if (nrow(deps_added) + nrow(deps_removed) > 0) {

message("Dependencies have changed! Analyzing...")

msg <- glue::glue(
.sep = "\n",
"This pull request:",
"- Adds {nrow(deps_added)} new dependencies (direct and indirect)",
"- Adds {length(unique(deps_added$sysreqs))} new system dependencies",
"- Removes {nrow(deps_removed)} existing dependencies (direct and indirect)",
"- Removes {length(unique(deps_removed$sysreqs))} existing system dependencies",
"",
"(Note that results may be inacurrate if you branched from an outdated version of the target branch.)"
)

message("Posting results as a pull request comment.")

gh::gh(
"POST /repos/{repo}/issues/{issue_number}/comments",
repo = "${{ github.repository }}",
issue_number = "${{ github.event.number }}",
body = msg
)

}
8 changes: 5 additions & 3 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ on:
- 'DESCRIPTION'
- '.Rbuildignore'
- '.github/**'
merge_group:
pull_request:
paths:
- 'README.Rmd'
Expand All @@ -44,13 +45,14 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write

jobs:
pkgdown:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3

Expand All @@ -70,7 +72,7 @@ jobs:
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
if: github.event_name != 'merge_group' && github.event_name != 'pull_request'
uses: JamesIves/[email protected]
with:
# We clean on releases because we want to remove old vignettes,
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ on:
- 'inst/**'
- 'DESCRIPTION'
- '.github/workflows/test-coverage.yaml'
merge_group:
pull_request:
paths:
- 'R/**'
Expand Down
15 changes: 12 additions & 3 deletions .github/workflows/update-citation-cff.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# The action runs when:
# - A new release is published
# - The DESCRIPTION or inst/CITATION are modified
# - Can be run manually
# For customizing the triggers, visit https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
on:
release:
types: [published]
push:
branches:
# This may seem like a no-op but it prevents triggering on tags.
# We use '**' rather '*' to accomodate names like 'dev/branch-1'
- '**'
paths:
- DESCRIPTION
- inst/CITATION
Expand All @@ -16,6 +17,13 @@ on:

name: Update CITATION.cff

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write

jobs:
update-citation-cff:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -52,4 +60,5 @@ jobs:
git config --local user.name "GitHub Action"
git add CITATION.cff
git commit -m 'Update CITATION.cff' || echo "No changes to commit"
git pull --rebase origin ${{ github.ref.name }}
git push origin || echo "No changes to commit"
23 changes: 19 additions & 4 deletions .lintr
Original file line number Diff line number Diff line change
@@ -1,24 +1,39 @@
linters: all_linters(
packages = c("lintr", "etdev"),
object_name_linter = NULL,
undesirable_function_linter = NULL,
implicit_integer_linter = NULL,
extraction_operator_linter = NULL,
todo_comment_linter = NULL,
library_call_linter = NULL,
undesirable_function_linter(
modify_defaults(
default_undesirable_functions,
citEntry = "use the more modern bibentry() function",
library = NULL # too many false positive in too many files
)
),
function_argument_linter = NULL,
indentation_linter = NULL, # unstable as of lintr 3.1.0
object_length_linter = NULL, # do not trigger due to long internal functions
object_length_linter = NULL, # do not trigger due to long internal functions
# Use minimum R declared in DESCRIPTION or fall back to current R version.
# Install etdev package from https://github.com/epiverse-trace/etdev
backport_linter(if (length(x <- etdev::extract_min_r_version())) x else getRversion())
)
exclusions: list(
"tests/testthat.R" = list(unused_import_linter = Inf),
"tests/testthat.R" = list(
unused_import_linter = Inf
),
"tests" = list(
undesirable_function_linter = Inf
),
"data-raw" = list(
missing_package_linter = Inf,
namespace_linter = Inf
),
# RcppExports.R is auto-generated and will not pass many linters. In
# particular, it can create very long lines.
"R/RcppExports.R"
"R/RcppExports.R",
# R/stanmodels.R is auto-generated and will not pass many linters. In
# particular, it uses `sapply()`.
"R/stanmodels.R"
)
Loading
Loading