Skip to content

Commit efab89e

Browse files
authored
Merge pull request #418 from cmu-delphi/ds/docs-style
doc+ci: match ci and style with epipredict/epidatr
2 parents d55a076 + 216f0e9 commit efab89e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+818
-465
lines changed

.git-blame-ignore-revs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
c65876078a6f9525952b305eaea2fca003adf907
1+
# Move to styler
2+
c65876078a6f9525952b305eaea2fca003adf907
3+
# Move to lintr
4+
0c8144e0e9deb79547eb523298d782926a7337a6

.github/pull_request_template.md

+15-12
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,23 @@
22

33
Please:
44

5-
- [ ] Make sure this PR is against "dev", not "main".
6-
- [ ] Request a review from one of the current epiprocess main reviewers:
7-
brookslogan, nmdefries.
8-
- [ ] Makes sure to bump the version number in `DESCRIPTION` and `NEWS.md`.
9-
Always increment the patch version number (the third number), unless you are
10-
making a release PR from dev to main, in which case increment the minor
11-
version number (the second number).
12-
- [ ] Describe changes made in NEWS.md, making sure breaking changes
13-
(backwards-incompatible changes to the documented interface) are noted.
14-
Collect the changes under the next release number (e.g. if you are on
15-
0.7.2, then write your changes under the 0.8 heading).
5+
- [ ] Make sure this PR is against "dev", not "main" (unless this is a release
6+
PR).
7+
- [ ] Request a review from one of the current main reviewers:
8+
brookslogan, nmdefries.
9+
- [ ] Makes sure to bump the version number in `DESCRIPTION`. Always increment
10+
the patch version number (the third number), unless you are making a
11+
release PR from dev to main, in which case increment the minor version
12+
number (the second number).
13+
- [ ] Describe changes made in NEWS.md, making sure breaking changes
14+
(backwards-incompatible changes to the documented interface) are noted.
15+
Collect the changes under the next release number (e.g. if you are on
16+
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.
1619

1720
### Change explanations for reviewer
1821

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

21-
- Resolves #{issue number}
24+
- Resolves #{issue number}

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
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]
89
pull_request:
910
branches: [main, dev]
11+
workflow_dispatch:
1012

1113
name: R-CMD-check
1214

.github/workflows/document.yaml

+58
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 'if (file.exists("README.Rmd")) 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

+39
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

+26-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
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+
# * workflow_dispatch added to allow manual triggering of the workflow
6+
# * trigger branches changed
7+
# * API key secrets.SECRET_EPIPROCESS_GHACTIONS_DELPHI_EPIDATA_KEY
58
on:
69
push:
7-
branches: [dev, main]
10+
branches: [main, dev]
811
pull_request:
9-
branches: [dev, main]
12+
branches: [main, dev]
1013
release:
1114
types: [published]
1215
workflow_dispatch:
@@ -23,6 +26,7 @@ jobs:
2326
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
2427
env:
2528
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
29+
DELPHI_EPIDATA_KEY: ${{ secrets.SECRET_EPIPROCESS_GHACTIONS_DELPHI_EPIDATA_KEY }}
2630
steps:
2731
- uses: actions/checkout@v3
2832

@@ -34,19 +38,31 @@ jobs:
3438

3539
- uses: r-lib/actions/setup-r-dependencies@v2
3640
with:
37-
extra-packages: any::pkgdown, local::.
41+
extra-packages: any::pkgdown, local::., any::cli
3842
needs: website
3943

4044
- name: Build site
41-
env:
42-
DELPHI_EPIDATA_KEY: ${{ secrets.SECRET_EPIPROCESS_GHACTIONS_DELPHI_EPIDATA_KEY }}
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-
if (startsWith("${{ github.event_name }}", "pull_request")) {
45-
mode <- ifelse("${{ github.base_ref }}" == "main", "release", "devel")
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"))
4658
} else {
47-
mode <- ifelse("${{ github.ref_name }}" == "main", "release", "devel")
59+
stop("Unexpected target_ref: ", target_ref)
4860
}
49-
pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE, override=list(PKGDOWN_DEV_MODE=mode))
61+
pkg <- pkgdown::as_pkgdown(".", override = override)
62+
cli::cli_rule("Cleaning files from old site...")
63+
pkgdown::clean_site(pkg)
64+
pkgdown::build_site(pkg, preview = FALSE, install = FALSE, new_process = FALSE)
65+
pkgdown:::build_github_pages(pkg)
5066
shell: Rscript {0}
5167

5268
- name: Deploy to GitHub pages 🚀

.github/workflows/release-helper.yaml

-23
This file was deleted.

.github/workflows/style.yml

+87
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

+2-2
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")

0 commit comments

Comments
 (0)