Skip to content

Commit d6f3675

Browse files
authored
Merge pull request #425 from cmu-delphi/ds/ci
ci: add document, lint, style like epidatr
2 parents c16b98b + 1a0a885 commit d6f3675

File tree

10 files changed

+228
-33
lines changed

10 files changed

+228
-33
lines changed

.github/pull_request_template.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Please:
1414
(backwards-incompatible changes to the documented interface) are noted.
1515
Collect the changes under the next release number (e.g. if you are on
1616
1.7.2, then write your changes under the 1.8 heading).
17+
- See [DEVELOPMENT.md](DEVELOPMENT.md) for more information on the development
18+
process.
1719

1820
### Change explanations for reviewer
1921

.github/workflows/R-CMD-check.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
22
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
33
#
4-
# Created with usethis + edited to run on PRs to dev, use API key.
4+
# Modifications:
5+
# - API key secrets.SECRET_EPIPROCESS_GHACTIONS_DELPHI_EPIDATA_KEY
56
on:
67
push:
78
branches: [main, dev]

.github/workflows/document.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
#
4+
# Modifications:
5+
# - devtools::build_readme()
6+
# - workflow_dispatch added to allow manual triggering of the workflow
7+
# - trigger branches changed
8+
# - API key secrets.DELPHI_GITHUB_ACTIONS_EPIDATA_API_KEY
9+
on:
10+
push:
11+
paths: ["R/**", "README.Rmd"]
12+
workflow_dispatch:
13+
14+
name: Document
15+
16+
jobs:
17+
document:
18+
runs-on: ubuntu-latest
19+
env:
20+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
21+
DELPHI_EPIDATA_KEY: ${{ secrets.DELPHI_GITHUB_ACTIONS_EPIDATA_API_KEY }}
22+
steps:
23+
- name: Checkout repo
24+
uses: actions/checkout@v3
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Setup R
29+
uses: r-lib/actions/setup-r@v2
30+
with:
31+
use-public-rspm: true
32+
33+
- name: Install dependencies
34+
uses: r-lib/actions/setup-r-dependencies@v2
35+
with:
36+
extra-packages: |
37+
any::devtools
38+
any::roxygen2
39+
needs: |
40+
devtools
41+
roxygen2
42+
43+
- name: Document
44+
run: roxygen2::roxygenise()
45+
shell: Rscript {0}
46+
47+
- name: Build README.md from README.Rmd
48+
run: Rscript -e 'devtools::build_readme()'
49+
50+
- name: Commit and push changes
51+
run: |
52+
git config --local user.name "$GITHUB_ACTOR"
53+
git config --local user.email "[email protected]"
54+
git add README.md
55+
git add man/\* NAMESPACE DESCRIPTION
56+
git commit -m "docs: document (GHA)" || echo "No changes to commit"
57+
git pull --rebase
58+
git push origin

.github/workflows/lint.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
#
4+
# Modifications:
5+
# * workflow_dispatch added to allow manual triggering of the workflow
6+
# * trigger branches changed
7+
# * API key secrets.DELPHI_GITHUB_ACTIONS_EPIDATA_API_KEY
8+
on:
9+
push:
10+
branches: [main, dev]
11+
pull_request:
12+
branches: [main, dev]
13+
workflow_dispatch:
14+
15+
name: Lint
16+
17+
jobs:
18+
lint:
19+
runs-on: ubuntu-latest
20+
env:
21+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
22+
DELPHI_EPIDATA_KEY: ${{ secrets.DELPHI_GITHUB_ACTIONS_EPIDATA_API_KEY }}
23+
steps:
24+
- uses: actions/checkout@v3
25+
26+
- uses: r-lib/actions/setup-r@v2
27+
with:
28+
use-public-rspm: true
29+
30+
- uses: r-lib/actions/setup-r-dependencies@v2
31+
with:
32+
extra-packages: any::lintr, local::.
33+
needs: lint
34+
35+
- name: Lint
36+
run: lintr::lint_package()
37+
shell: Rscript {0}
38+
env:
39+
LINTR_ERROR_ON_LINT: true

.github/workflows/pkgdown.yaml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
22
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
33
#
4-
# Edits from above workflow: also check pkgdown for PRs to `dev` branch, and
5-
# update the documentation web site on pushes to `dev` branch.
4+
# Modifications:
5+
# * workflow_dispatch added to allow manual triggering of the workflow
6+
# * trigger branches changed
7+
# * API key secrets.SECRET_EPIPROCESS_GHACTIONS_DELPHI_EPIDATA_KEY
68
on:
79
push:
810
branches: [main, dev]
@@ -40,19 +42,21 @@ jobs:
4042
needs: website
4143

4244
- name: Build site
45+
# - target_ref gets the ref from a different variable, depending on the event
46+
# - override allows us to set the pkgdown mode and version_label
47+
# - mode: release is the standard build mode, devel places the site in /dev
48+
# - version_label: 'light' and 'success' are CSS labels for Bootswatch: Cosmo
49+
# https://bootswatch.com/cosmo/
50+
# - we use pkgdown:::build_github_pages to build the site because of an issue in pkgdown
51+
# https://github.com/r-lib/pkgdown/issues/2257
4352
run: |
44-
override <- if (startsWith("${{ github.event_name }}", "pull_request")) {
45-
if ("${{ github.base_ref }}" == "main") {
46-
list(development = list(mode = "release", version_label = "light"))
47-
} else {
48-
list(development = list(mode = "devel", version_label = "success"))
49-
}
53+
target_ref <- ${{ github.event_name == 'pull_request' && github.base_ref || github.ref }}
54+
override <- if (target_ref == "main") {
55+
list(development = list(mode = "release", version_label = "light"))
56+
} else if (target_ref == "dev") {
57+
list(development = list(mode = "devel", version_label = "success"))
5058
} else {
51-
if ("${{ github.ref_name }}" == "main") {
52-
list(development = list(mode = "release", version_label = "light"))
53-
} else {
54-
list(development = list(mode = "devel", version_label = "success"))
55-
}
59+
stop("Unexpected target_ref: ", target_ref)
5660
}
5761
pkg <- pkgdown::as_pkgdown(".", override = override)
5862
cli::cli_rule("Cleaning files from old site...")

.github/workflows/style.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
#
4+
# Modifications:
5+
# * workflow_dispatch added to allow manual triggering of the workflow
6+
# * trigger branches changed
7+
# * API key secrets.DELPHI_GITHUB_ACTIONS_EPIDATA_API_KEY
8+
on:
9+
push:
10+
paths:
11+
[
12+
"**.[rR]",
13+
"**.[qrR]md",
14+
"**.[rR]markdown",
15+
"**.[rR]nw",
16+
"**.[rR]profile",
17+
]
18+
workflow_dispatch:
19+
20+
name: Style
21+
22+
jobs:
23+
style:
24+
runs-on: ubuntu-latest
25+
env:
26+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
27+
DELPHI_EPIDATA_KEY: ${{ secrets.DELPHI_GITHUB_ACTIONS_EPIDATA_API_KEY }}
28+
steps:
29+
- name: Checkout repo
30+
uses: actions/checkout@v3
31+
with:
32+
fetch-depth: 0
33+
34+
- name: Setup R
35+
uses: r-lib/actions/setup-r@v2
36+
with:
37+
use-public-rspm: true
38+
39+
- name: Install dependencies
40+
uses: r-lib/actions/setup-r-dependencies@v2
41+
with:
42+
extra-packages: any::styler, any::roxygen2
43+
needs: styler
44+
45+
- name: Enable styler cache
46+
run: styler::cache_activate()
47+
shell: Rscript {0}
48+
49+
- name: Determine cache location
50+
id: styler-location
51+
run: |
52+
cat(
53+
"location=",
54+
styler::cache_info(format = "tabular")$location,
55+
"\n",
56+
file = Sys.getenv("GITHUB_OUTPUT"),
57+
append = TRUE,
58+
sep = ""
59+
)
60+
shell: Rscript {0}
61+
62+
- name: Cache styler
63+
uses: actions/cache@v3
64+
with:
65+
path: ${{ steps.styler-location.outputs.location }}
66+
key: ${{ runner.os }}-styler-${{ github.sha }}
67+
restore-keys: |
68+
${{ runner.os }}-styler-
69+
${{ runner.os }}-
70+
71+
- name: Style
72+
run: styler::style_pkg()
73+
shell: Rscript {0}
74+
75+
- name: Commit and push changes
76+
run: |
77+
if FILES_TO_COMMIT=($(git diff-index --name-only ${{ github.sha }} \
78+
| egrep --ignore-case '\.(R|[qR]md|Rmarkdown|Rnw|Rprofile)$'))
79+
then
80+
git config --local user.name "$GITHUB_ACTOR"
81+
git config --local user.email "[email protected]"
82+
git commit ${FILES_TO_COMMIT[*]} -m "style: styler (GHA)"
83+
git pull --rebase
84+
git push origin
85+
else
86+
echo "No changes to commit."
87+
fi

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Title: Tools for basic signal processing in epidemiology
44
Version: 0.7.5
55
Authors@R: c(
66
person("Jacob", "Bien", role = "ctb"),
7-
person("Logan", "Brooks", role = "aut"),
7+
person("Logan", "Brooks", email = "[email protected]", role = c("aut", "cre")),
88
person("Rafael", "Catoia", role = "ctb"),
99
person("Nat", "DeFries", role = "ctb"),
1010
person("Daniel", "McDonald", role = "aut"),
@@ -14,7 +14,7 @@ Authors@R: c(
1414
person("Quang", "Nguyen", role = "ctb"),
1515
person("Evan", "Ray", role = "aut"),
1616
person("Dmitry", "Shemetov", role = "ctb"),
17-
person("Ryan", "Tibshirani", , "[email protected]", role = c("aut", "cre")),
17+
person("Ryan", "Tibshirani", role = "aut"),
1818
person("Lionel", "Henry", role = "ctb", comment = "Author of included rlang fragments"),
1919
person("Hadley", "Wickham", role = "ctb", comment = "Author of included rlang fragments"),
2020
person("Posit", role = "cph", comment = "Copyright holder of included rlang fragments")

DEVELOPMENT.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,14 @@ python -m http.server -d docs
4444

4545
Please follow the guidelines in the [PR template document](.github/pull_request_template.md).
4646

47-
## Release process
47+
## Planned CRAN release process
4848

4949
Open a release issue and then copy and follow this checklist in the issue (modified from the checklist generated by `usethis::use_release_issue(version = "1.0.2")`):
5050

51-
- [ ] `git pull`
52-
- [ ] Check [current CRAN check results](https://cran.rstudio.org/web/checks/check_results_epiprocess.html)
53-
- [ ] `devtools::check(".", manual = TRUE, env_vars = c(NOT_CRAN = "FALSE"))`.
51+
- [ ] `git pull` on `dev` branch.
52+
- [ ] Make sure all changes are committed and pushed.
53+
- [ ] Check [current CRAN check results](https://cran.rstudio.org/web/checks/check_results_epiprocess.html).
54+
- [ ] `devtools::check(".", manual = TRUE, env_vars = c(NOT_CRAN = "false"))`.
5455
- Aim for 10/10, no notes.
5556
- [ ] If check works well enough, merge to main. Otherwise open a PR to fix up.
5657
- [ ] [Polish NEWS](https://github.com/cmu-delphi/epiprocess/blob/dev/NEWS.md).
@@ -61,20 +62,20 @@ Open a release issue and then copy and follow this checklist in the issue (modif
6162
- This may choke on the MIT license url, and that's ok.
6263
- [ ] `devtools::build_readme()`
6364
- [ ] `devtools::check_win_devel()`
64-
- [ ] Check email for problems
65+
- [ ] Have maintainer ("cre" in description) check email for problems.
6566
- [ ] `revdepcheck::revdep_check(num_workers = 4)`.
6667
- This may choke, it is very sensitive to the binary versions of packages on a given system. Either bypass or ask someone else to run it if you're concerned.
6768
- [ ] Update `cran-comments.md`
68-
- [ ] PR with any changes
69+
- [ ] PR with any changes (and go through the list again) into `dev` and run through the list again.
6970

7071
Submit to CRAN:
7172

72-
- [ ] `devtools::submit_cran()`
73-
- [ ] Approve email
73+
- [ ] `devtools::submit_cran()`.
74+
- [ ] Maintainer approves email.
7475

7576
Wait for CRAN...
7677

77-
- [ ] Accepted :tada:
78-
- [ ] `dev`
79-
- [ ] `usethis::use_github_release(publish = FALSE)` (publish off, otherwise it won't push).
80-
- [ ] check the release notes and publish the branch on github
78+
- [ ] If accepted :tada:, move to next steps. If rejected, fix and resubmit.
79+
- [ ] Open and merge a PR containing any updates made to `main` back to `dev`.
80+
- [ ] `usethis::use_github_release(publish = FALSE)` (publish off, otherwise it won't push) will create a draft release based on the commit hash in CRAN-SUBMISSION and push a tag to the GitHub repo.
81+
- [ ] Go to the repo, verify the release notes, and publish when ready.

man/autoplot.epi_df.Rd

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/epiprocess.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)