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

Mid year cleanup #212

Merged
merged 9 commits into from
Jun 12, 2024
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
4 changes: 1 addition & 3 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,9 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
# Exists since R 4.3.0 but `false` by default
_R_CHECK_LENGTH_COLON_: true

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

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

Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/dependency-change.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ jobs:

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

if (nrow(deps_added) > 0) {
nudge <- "Reach out on slack (`#code-review` or `#help` channels) to double check if there are base R alternatives to the new dependencies.\n"
} else {
nudge <- ""
}

msg <- glue::glue(
.sep = "\n",
"This pull request:",
Expand All @@ -60,7 +66,8 @@ jobs:
"- 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.)"
nudge,
"(Note that results may be inaccurate if you branched from an outdated version of the target branch.)"
)

message("Posting results as a pull request comment.")
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/lint-changed-files.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ on:
workflow_dispatch:
pull_request:
branches: [main, master]
paths:
- '**.R'
- '**.Rmd'
- '**/.lintr'
- '**/.lintr.R'

name: lint-changed-files

Expand All @@ -17,7 +22,7 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
Expand All @@ -29,6 +34,7 @@ jobs:
any::gh
any::lintr
any::purrr
any::cyclocomp
epiverse-trace/etdev
needs: check

Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

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

Expand All @@ -71,9 +71,14 @@ jobs:
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Check website links
uses: untitaker/hyperlink@0.1.32
with:
args: docs/

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'merge_group' && github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@4.1.4
uses: JamesIves/github-pages-deploy-action@v4.6.1
with:
# We clean on releases because we want to remove old vignettes,
# figures, etc. that have been deleted from the `main` branch.
Expand Down
56 changes: 45 additions & 11 deletions .github/workflows/render_readme.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,55 @@
# Name of the workflow
# Reproduce locally by running:
# ```r
# pak::pak(c("any::rmarkdown", "any::usethis", "."))
# writeLines(
# knitr::knit_expand(
# "README.Rmd",
# packagename = read.dcf("DESCRIPTION", "Package"),
# gh_repo = usethis:::github_remote_list()$repo_spec
# ),
# "README_expanded.Rmd"
# )
# rmarkdown::render(
# "README_expanded.Rmd",
# output_file = "README.md",
# output_dir = "."
# )
# unlink("README_expanded.Rmd")
# ```
name: render-readme

# Controls when the action will run. Triggers include:
#
#
# - button trigger from github action page
# - on changes to readme.Rmd

on:
workflow_dispatch:
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:
- 'README.Rmd'
- '.github/workflows/render_readme.yml'

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

permissions:
contents: write

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
render-readme:
runs-on: macos-latest
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repos
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup R
uses: r-lib/actions/setup-r@v2
Expand All @@ -29,25 +58,29 @@ jobs:

- name: Setup pandoc
uses: r-lib/actions/setup-pandoc@v2

- name: Install dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rmarkdown, local::.

- name: Compile the readme
run: |
writeLines(
knitr::knit_expand(
"README.Rmd",
packagename = read.dcf("DESCRIPTION", "Package"),
"README.Rmd",
packagename = read.dcf("DESCRIPTION", "Package"),
gh_repo = Sys.getenv("GITHUB_REPOSITORY")
),
),
"README_expanded.Rmd"
)
rmarkdown::render("README_expanded.Rmd", output_file = "README.md", output_dir = ".")
rmarkdown::render(
"README_expanded.Rmd",
output_file = "README.md",
output_dir = "."
)
shell: Rscript {0}

- name: Commit files
run: |
git config --local user.email "action@github.com"
Expand All @@ -59,4 +92,5 @@ jobs:
git add man/figures/
fi
git diff-index --quiet HEAD || git commit -m "Automatic readme update"
git pull --rebase origin ${{ github.ref.name }}
git push origin || echo "No changes to push"
29 changes: 12 additions & 17 deletions .github/workflows/update-citation-cff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,25 @@
on:
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'
- '**'
- main
paths:
- DESCRIPTION
- inst/CITATION
- .github/workflows/update-citation-cff.yaml
workflow_dispatch:

name: Update CITATION.cff

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

permissions:
contents: write
pull-requests: write

jobs:
update-citation-cff:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
Expand All @@ -53,12 +47,13 @@ jobs:
cff_write(keys = mykeys)

shell: Rscript {0}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
commit-message: Update `CITATION.cff`
title: Update `CITATION.cff`
body: |
This pull request updates the citation file, ensuring all authors are credited and there are no discrepancies.

- name: Commit results
run: |
git config --local user.email "action@github.com"
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"
Please verify the changes before merging.
branch: update-citation-cff
37 changes: 37 additions & 0 deletions .github/workflows/update-copyright-year.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Update copyright year(s) in license file

on:
workflow_dispatch:
schedule:
- cron: '0 3 1 1 *'

permissions:
contents: write
pull-requests: write

jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: FantasticFiasco/action-update-license-year@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
path: |
LICENSE.md
prBody: >
This PR updates the copyright license for this new year! If you're reading this while you're celebrating, enjoy! Don't worry about this one :blush:

![Happy new year!](https://media.giphy.com/media/HyDfNCZlTn5iU/giphy.gif?cid=ecf05e4777yl7dbo1xfha6bx1z5lrl13uq7biv6rs9dqsyoh&ep=v1_gifs_search&rid=giphy.gif&ct=g)
- uses: FantasticFiasco/action-update-license-year@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
path: |
LICENSE
prBody: >
This PR updates the copyright license for this new year! If you're reading this while you're celebrating, enjoy! Don't worry about this one :blush:

![Happy new year!](https://media.giphy.com/media/HyDfNCZlTn5iU/giphy.gif?cid=ecf05e4777yl7dbo1xfha6bx1z5lrl13uq7biv6rs9dqsyoh&ep=v1_gifs_search&rid=giphy.gif&ct=g)
transform: (?<=YEAR:\s)(?<from>\d{4})?-?(\d{4})?
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ Package: finalsize
Title: Calculate the Final Size of an Epidemic
Version: 0.2.1.9000
Authors@R: c(
person("Pratik", "Gupte", , "pratik.gupte@lshtm.ac.uk", role = c("aut", "cre", "cph"),
person("Pratik", "Gupte", , "pratik.gupte@lshtm.ac.uk", role = c("aut", "cph"),
comment = c(ORCID = "0000-0001-5294-7819")),
person("Edwin", "Van Leeuwen", , "edwin.vanleeuwen@ukhsa.gov.uk", role = c("aut", "cph"),
comment = c(ORCID = "0000-0002-2383-5305")),
person("Adam", "Kucharski", , "adam.kucharski@lshtm.ac.uk", role = c("aut", "cph"),
comment = c(ORCID = "0000-0001-8814-9421")),
person("Rosalind", "Eggo", , "r.eggo@lshtm.ac.uk", role = "ctb",
person("Rosalind", "Eggo", , "r.eggo@lshtm.ac.uk", role = c("ctb", "cre"),
comment = c(ORCID = "0000-0002-0362-6717")),
person("Hugo", "Gruson", , "hugo.gruson@data.org", role = "ctb",
comment = c(ORCID = "0000-0002-4094-1476")),
Expand Down Expand Up @@ -61,4 +61,4 @@ Encoding: UTF-8
Language: en-GB
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
YEAR: 2022
YEAR: 2024
COPYRIGHT HOLDER: finalsize authors
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MIT License

Copyright (c) 2022 finalsize authors
Copyright (c) 2024 finalsize authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 12 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# finalsize (development version)

Maintainer is changing to @rozeggo (#212).

1. Updated all GitHub Actions workflows in line with {epiverse-trace/packagetemplate} (#212).

2. Updated DESCRIPTION and license files with new maintainer and new copyright year (#212).

3. Added `R/dev-utils.R` for extra release issue bullet points, and added `tools/check.env` for global environment checks (#212).

4. Corrected internal article links in vignettes (#212).

5. Added continuous benchmarking workflows using {touchstone} following the pattern of {epiforecasts/EpiNow2} (#212).

# finalsize 0.2.1

This patch adds:
Expand Down
8 changes: 8 additions & 0 deletions R/dev-utils.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This unexported function adds a custom item to `usethis::use_release_issue()`
release_bullets <- function() {
c(
"Run `goodpractice::gp()`",
"Review [WORDLIST](https://docs.cran.dev/spelling#wordlist)",
"Check if `# nolint` comments are still needed with recent lintr releases"
)
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ citation("finalsize")
#> To cite package 'finalsize' in publications use:
#>
#> Gupte P, Van Leeuwen E, Kucharski A (2024). _finalsize: Calculate the
#> Final Size of an Epidemic_. R package version 0.2.1,
#> Final Size of an Epidemic_. R package version 0.2.1.9000,
#> https://epiverse-trace.github.io/finalsize/,
#> <https://github.com/epiverse-trace/finalsize>.
#>
Expand All @@ -194,7 +194,7 @@ citation("finalsize")
#> title = {finalsize: Calculate the Final Size of an Epidemic},
#> author = {Pratik Gupte and Edwin {Van Leeuwen} and Adam Kucharski},
#> year = {2024},
#> note = {R package version 0.2.1,
#> note = {R package version 0.2.1.9000,
#> https://epiverse-trace.github.io/finalsize/},
#> url = {https://github.com/epiverse-trace/finalsize},
#> }
Expand Down
3 changes: 3 additions & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Cppcheck
Cpplint
Dylanger
Eigen
EpiNow
Epiverse
Github
Kwok
Expand Down Expand Up @@ -41,7 +42,9 @@ doi
dt
dx
eff
epiforecasts
episoap
epiverse
frac
gh
github
Expand Down
Loading
Loading