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

doc+ci: match ci and style with epipredict/epidatr #418

Merged
merged 25 commits into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
9885f70
doc+ci+repo: fix style and release guide
dshemetov Feb 16, 2024
6b325da
Update .github/workflows/pkgdown.yaml
dshemetov Mar 7, 2024
c16b98b
Update DEVELOPMENT.md
dshemetov Mar 7, 2024
219e04a
ci: add document, lint, style like epidatr
dshemetov Mar 5, 2024
b40f90f
ci: add doc string with workflow mods
dshemetov Mar 6, 2024
cbf4e44
ci: fix style indentation
dshemetov Mar 6, 2024
4a941d2
doc: improve release process wording
dshemetov Mar 7, 2024
aa52363
doc: add link to DEVELOPMENT.md in pull request template
dshemetov Mar 7, 2024
f89ecdd
ci: simplify pkgdown ref logic
dshemetov Mar 7, 2024
a48d82c
doc: transfer maintainer role from Ryan to Logan
dshemetov Mar 7, 2024
9143422
doc: add comments explaining pkgdown action
dshemetov Mar 7, 2024
1a0a885
doc: clarify DEVELOPMENT.md
dshemetov Mar 7, 2024
d6f3675
Merge pull request #425 from cmu-delphi/ds/ci
dshemetov Mar 7, 2024
6fd2e1f
ci: fix pkgdown
dshemetov Mar 7, 2024
b19921a
More color-blind friendly green
dsweber2 Mar 7, 2024
68c027b
repo: add to .Rbuildignore
dshemetov Mar 7, 2024
0c8144e
lint: increase lintr happiness
dshemetov Mar 7, 2024
9331e6e
ci: build README.rmd only if it exists
dshemetov Mar 7, 2024
eb55b8b
ci: build README.rmd only if it exists
dshemetov Mar 7, 2024
b1f0432
Merge branch 'dev' into ds/docs-style
dshemetov Mar 7, 2024
69e0228
repo: ignore linter commit in blame
dshemetov Mar 7, 2024
9256dd2
refactor+lint: remove unused functions, snake_case
dshemetov Mar 7, 2024
0f47808
lint: objects to dplyr perhaps too much
dsweber2 Mar 7, 2024
ae1f3ad
style: styler (GHA)
dsweber2 Mar 7, 2024
216f0e9
light searchbar
dsweber2 Mar 8, 2024
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
5 changes: 4 additions & 1 deletion .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
c65876078a6f9525952b305eaea2fca003adf907
# Move to styler
c65876078a6f9525952b305eaea2fca003adf907
# Move to lintr
0c8144e0e9deb79547eb523298d782926a7337a6
27 changes: 15 additions & 12 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,23 @@

Please:

- [ ] Make sure this PR is against "dev", not "main".
- [ ] Request a review from one of the current epiprocess main reviewers:
brookslogan, nmdefries.
- [ ] Makes sure to bump the version number in `DESCRIPTION` and `NEWS.md`.
Always increment the patch version number (the third number), unless you are
making a release PR from dev to main, in which case increment the minor
version number (the second number).
- [ ] Describe changes made in NEWS.md, making sure breaking changes
(backwards-incompatible changes to the documented interface) are noted.
Collect the changes under the next release number (e.g. if you are on
0.7.2, then write your changes under the 0.8 heading).
- [ ] Make sure this PR is against "dev", not "main" (unless this is a release
PR).
- [ ] Request a review from one of the current main reviewers:
brookslogan, nmdefries.
- [ ] Makes sure to bump the version number in `DESCRIPTION`. Always increment
the patch version number (the third number), unless you are making a
release PR from dev to main, in which case increment the minor version
number (the second number).
- [ ] Describe changes made in NEWS.md, making sure breaking changes
(backwards-incompatible changes to the documented interface) are noted.
Collect the changes under the next release number (e.g. if you are on
1.7.2, then write your changes under the 1.8 heading).
- See [DEVELOPMENT.md](DEVELOPMENT.md) for more information on the development
process.

dshemetov marked this conversation as resolved.
Show resolved Hide resolved
### Change explanations for reviewer

### Magic GitHub syntax to mark associated Issue(s) as resolved when this is merged into the default branch

- Resolves #{issue number}
- Resolves #{issue number}
4 changes: 3 additions & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# 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
#
# Created with usethis + edited to run on PRs to dev, use API key.
# Modifications:
# - API key secrets.SECRET_EPIPROCESS_GHACTIONS_DELPHI_EPIDATA_KEY
on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]
workflow_dispatch:

name: R-CMD-check

Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/document.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# 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
#
# Modifications:
# - devtools::build_readme()
# - workflow_dispatch added to allow manual triggering of the workflow
# - trigger branches changed
# - API key secrets.DELPHI_GITHUB_ACTIONS_EPIDATA_API_KEY
on:
push:
paths: ["R/**", "README.Rmd"]
workflow_dispatch:

name: Document

jobs:
document:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
DELPHI_EPIDATA_KEY: ${{ secrets.DELPHI_GITHUB_ACTIONS_EPIDATA_API_KEY }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0

- 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:
extra-packages: |
any::devtools
any::roxygen2
needs: |
devtools
roxygen2

- name: Document
run: roxygen2::roxygenise()
shell: Rscript {0}

- name: Build README.md from README.Rmd
run: Rscript -e 'if (file.exists("README.Rmd")) devtools::build_readme()'

- name: Commit and push changes
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "[email protected]"
git add README.md
git add man/\* NAMESPACE DESCRIPTION
git commit -m "docs: document (GHA)" || echo "No changes to commit"
git pull --rebase
git push origin
39 changes: 39 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# 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
#
# Modifications:
# * workflow_dispatch added to allow manual triggering of the workflow
# * trigger branches changed
# * API key secrets.DELPHI_GITHUB_ACTIONS_EPIDATA_API_KEY
on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]
workflow_dispatch:

name: Lint

jobs:
lint:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
DELPHI_EPIDATA_KEY: ${{ secrets.DELPHI_GITHUB_ACTIONS_EPIDATA_API_KEY }}
steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::lintr, local::.
needs: lint

- name: Lint
run: lintr::lint_package()
shell: Rscript {0}
env:
LINTR_ERROR_ON_LINT: true
36 changes: 26 additions & 10 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# 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
#
# Created with usethis + edited to run on PRs to dev, use API key.
# Modifications:
# * workflow_dispatch added to allow manual triggering of the workflow
# * trigger branches changed
# * API key secrets.SECRET_EPIPROCESS_GHACTIONS_DELPHI_EPIDATA_KEY
on:
push:
branches: [dev, main]
branches: [main, dev]
pull_request:
branches: [dev, main]
branches: [main, dev]
release:
types: [published]
workflow_dispatch:
Expand All @@ -23,6 +26,7 @@ jobs:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
dshemetov marked this conversation as resolved.
Show resolved Hide resolved
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
DELPHI_EPIDATA_KEY: ${{ secrets.SECRET_EPIPROCESS_GHACTIONS_DELPHI_EPIDATA_KEY }}
steps:
- uses: actions/checkout@v3

Expand All @@ -34,19 +38,31 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
extra-packages: any::pkgdown, local::., any::cli
needs: website

- name: Build site
env:
DELPHI_EPIDATA_KEY: ${{ secrets.SECRET_EPIPROCESS_GHACTIONS_DELPHI_EPIDATA_KEY }}
# - target_ref gets the ref from a different variable, depending on the event
# - override allows us to set the pkgdown mode and version_label
# - mode: release is the standard build mode, devel places the site in /dev
# - version_label: 'light' and 'success' are CSS labels for Bootswatch: Cosmo
# https://bootswatch.com/cosmo/
# - we use pkgdown:::build_github_pages to build the site because of an issue in pkgdown
# https://github.com/r-lib/pkgdown/issues/2257
run: |
if (startsWith("${{ github.event_name }}", "pull_request")) {
mode <- ifelse("${{ github.base_ref }}" == "main", "release", "devel")
target_ref <- "${{ github.event_name == 'pull_request' && github.base_ref || github.ref }}"
override <- if (target_ref == "main") {
list(development = list(mode = "release", version_label = "light"))
} else if (target_ref == "dev") {
list(development = list(mode = "devel", version_label = "success"))
} else {
mode <- ifelse("${{ github.ref_name }}" == "main", "release", "devel")
stop("Unexpected target_ref: ", target_ref)
}
pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE, override=list(PKGDOWN_DEV_MODE=mode))
pkg <- pkgdown::as_pkgdown(".", override = override)
cli::cli_rule("Cleaning files from old site...")
pkgdown::clean_site(pkg)
pkgdown::build_site(pkg, preview = FALSE, install = FALSE, new_process = FALSE)
pkgdown:::build_github_pages(pkg)
dshemetov marked this conversation as resolved.
Show resolved Hide resolved
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
Expand Down
23 changes: 0 additions & 23 deletions .github/workflows/release-helper.yaml

This file was deleted.

87 changes: 87 additions & 0 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# 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
#
# Modifications:
# * workflow_dispatch added to allow manual triggering of the workflow
# * trigger branches changed
# * API key secrets.DELPHI_GITHUB_ACTIONS_EPIDATA_API_KEY
on:
push:
paths:
[
"**.[rR]",
"**.[qrR]md",
"**.[rR]markdown",
"**.[rR]nw",
"**.[rR]profile",
]
workflow_dispatch:

name: Style

jobs:
style:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
DELPHI_EPIDATA_KEY: ${{ secrets.DELPHI_GITHUB_ACTIONS_EPIDATA_API_KEY }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0

- 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:
extra-packages: any::styler, any::roxygen2
needs: styler

- name: Enable styler cache
run: styler::cache_activate()
shell: Rscript {0}

- name: Determine cache location
id: styler-location
run: |
cat(
"location=",
styler::cache_info(format = "tabular")$location,
"\n",
file = Sys.getenv("GITHUB_OUTPUT"),
append = TRUE,
sep = ""
)
shell: Rscript {0}

- name: Cache styler
uses: actions/cache@v3
with:
path: ${{ steps.styler-location.outputs.location }}
key: ${{ runner.os }}-styler-${{ github.sha }}
restore-keys: |
${{ runner.os }}-styler-
${{ runner.os }}-

- name: Style
run: styler::style_pkg()
shell: Rscript {0}

- name: Commit and push changes
run: |
if FILES_TO_COMMIT=($(git diff-index --name-only ${{ github.sha }} \
| egrep --ignore-case '\.(R|[qR]md|Rmarkdown|Rnw|Rprofile)$'))
then
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "[email protected]"
git commit ${FILES_TO_COMMIT[*]} -m "style: styler (GHA)"
git pull --rebase
git push origin
else
echo "No changes to commit."
fi
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Title: Tools for basic signal processing in epidemiology
Version: 0.7.5
Authors@R: c(
person("Jacob", "Bien", role = "ctb"),
person("Logan", "Brooks", role = "aut"),
person("Logan", "Brooks", email = "[email protected]", role = c("aut", "cre")),
person("Rafael", "Catoia", role = "ctb"),
person("Nat", "DeFries", role = "ctb"),
person("Daniel", "McDonald", role = "aut"),
Expand All @@ -14,7 +14,7 @@ Authors@R: c(
person("Quang", "Nguyen", role = "ctb"),
person("Evan", "Ray", role = "aut"),
person("Dmitry", "Shemetov", role = "ctb"),
person("Ryan", "Tibshirani", , "[email protected]", role = c("aut", "cre")),
person("Ryan", "Tibshirani", role = "aut"),
person("Lionel", "Henry", role = "ctb", comment = "Author of included rlang fragments"),
person("Hadley", "Wickham", role = "ctb", comment = "Author of included rlang fragments"),
person("Posit", role = "cph", comment = "Copyright holder of included rlang fragments")
Expand Down
Loading
Loading