Skip to content

Commit e05d174

Browse files
committed
ci+doc: pull request template, version instructions, pkgdown
1 parent 44cb0f9 commit e05d174

File tree

5 files changed

+123
-26
lines changed

5 files changed

+123
-26
lines changed

.github/pull_request_template.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
### Checklist
2+
3+
Please:
4+
5+
- [ ] Make sure this PR is against "dev", not "main".
6+
- [ ] Request a review from one of the current epipredict main reviewers:
7+
dajmcdon.
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).
16+
17+
### Change explanations for reviewer
18+
19+
### Magic GitHub syntax to mark associated Issue(s) as resolved when this is merged into the default branch
20+
21+
- Resolves #{issue number}

.github/workflows/pkgdown.yaml

+17-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
1+
# 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 use API key.
4+
# Created with usethis + edited to run on PRs to dev, use API key.
55
on:
66
push:
7-
branches: [main, master]
7+
branches: [dev, main]
8+
pull_request:
9+
branches: [dev, main]
810
release:
911
types: [published]
1012
workflow_dispatch:
@@ -13,14 +15,16 @@ name: pkgdown
1315

1416
jobs:
1517
pkgdown:
18+
# only build docs on the main repository and not forks
19+
if: github.repository_owner == 'cmu-delphi'
1620
runs-on: ubuntu-latest
1721
# Only restrict concurrency for non-PR jobs
1822
concurrency:
1923
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
2024
env:
2125
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
2226
steps:
23-
- uses: actions/checkout@v2
27+
- uses: actions/checkout@v3
2428

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

@@ -35,13 +39,19 @@ jobs:
3539

3640
- name: Build site
3741
env:
38-
DELPHI_EPIDATA_KEY: ${{ secrets.SECRET_EPIPREDICT_GHACTIONS_DELPHI_EPIDATA_KEY }}
39-
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
42+
DELPHI_EPIDATA_KEY: ${{ secrets.SECRET_EPIPROCESS_GHACTIONS_DELPHI_EPIDATA_KEY }}
43+
run: |
44+
if (startsWith("${{ github.event_name }}", "pull_request")) {
45+
mode <- ifelse("${{ github.base_ref }}" == "main", "release", "devel")
46+
} else {
47+
mode <- ifelse("${{ github.ref_name }}" == "main", "release", "devel")
48+
}
49+
pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE, override=list(PKGDOWN_DEV_MODE=mode))
4050
shell: Rscript {0}
4151

4252
- name: Deploy to GitHub pages 🚀
4353
if: github.event_name != 'pull_request'
44-
uses: JamesIves/[email protected].4
54+
uses: JamesIves/github-pages-deploy-action@v4.4.1
4555
with:
4656
clean: false
4757
branch: gh-pages
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"scheme": "semantic",
3+
"versionFile": "./DESCRIPTION",
4+
"files": [],
5+
"rules": [
6+
{
7+
"trigger": "commit",
8+
"branch": "dev",
9+
"bump": "build"
10+
},
11+
{
12+
"trigger": "commit",
13+
"bump": "minor",
14+
"branch": "main",
15+
"tag": true,
16+
"reset": "build"
17+
},
18+
{
19+
"trigger": "commit",
20+
"bump": "major",
21+
"branch": "release",
22+
"tag": true,
23+
"reset": ["minor", "build"]
24+
}
25+
]
26+
}

DEVELOPMENT.md

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
## Setting up the development environment
2+
3+
```r
4+
install.packages(c('devtools', 'pkgdown', 'styler', 'lintr')) # install dev dependencies
5+
devtools::install_deps(dependencies = TRUE) # install package dependencies
6+
devtools::document() # generate package meta data and man files
7+
devtools::build() # build package
8+
```
9+
10+
## Validating the package
11+
12+
```r
13+
styler::style_pkg() # format code
14+
lintr::lint_package() # lint code
15+
16+
devtools::test() # test package
17+
devtools::check() # check package for errors
18+
```
19+
20+
## Developing the documentation site
21+
22+
The [documentation site](https://cmu-delphi.github.io/epipredict/) is built off of the `main` branch. The `dev` version of the site is available at https://cmu-delphi.github.io/epipredict/dev.
23+
24+
The documentation site can be previewed locally by running in R
25+
26+
```r
27+
pkgdown::build_site(preview=TRUE)
28+
```
29+
30+
The `main` version is available at `file:///<local path>/epidatr/epipredict/index.html` and `dev` at `file:///<local path>/epipredict/docs/dev/index.html`.
31+
32+
You can also build the docs manually and launch the site with python. From the terminal, this looks like
33+
```bash
34+
R -e 'devtools::document()'
35+
python -m http.server -d docs
36+
```
37+
38+
## Versioning
39+
40+
Please follow the guidelines in the PR template document (reproduced here):
41+
42+
- [ ] Make sure this PR is against "dev", not "main".
43+
- [ ] Request a review from one of the current epipredict main reviewers:
44+
dajmcdon.
45+
- [ ] Makes sure to bump the version number in `DESCRIPTION` and `NEWS.md`.
46+
Always increment the patch version number (the third number), unless you are
47+
making a release PR from dev to main, in which case increment the minor
48+
version number (the second number).
49+
- [ ] Describe changes made in NEWS.md, making sure breaking changes
50+
(backwards-incompatible changes to the documented interface) are noted.
51+
Collect the changes under the next release number (e.g. if you are on
52+
0.7.2, then write your changes under the 0.8 heading).
53+
54+
## Release process
55+
56+
TBD

NEWS.md

+3-19
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,33 @@
11
# epipredict (development)
22

3-
# epipredict 0.0.8
3+
Pre-1.0.0 numbering scheme: 0.x will indicate releases, while 0.0.x will indicate PR's.
4+
5+
# epipredict 0.1
46

57
- add `check_enough_train_data` that will error if training data is too small
68
- added `check_enough_train_data` to `arx_forecaster`
7-
8-
# epipredict 0.0.7
9-
109
- simplify `layer_residual_quantiles()` to avoid timesuck in `utils::methods()`
11-
12-
# epipredict 0.0.6
13-
1410
- rename the `dist_quantiles()` to be more descriptive, breaking change)
1511
- removes previous `pivot_quantiles()` (now `*_wider()`, breaking change)
1612
- add `pivot_quantiles_wider()` for easier plotting
1713
- add complement `pivot_quantiles_longer()`
1814
- add `cdc_baseline_forecaster()` and `flusight_hub_formatter()`
19-
20-
# epipredict 0.0.5
21-
2215
- add `smooth_quantile_reg()`
2316
- improved printing of various methods / internals
2417
- canned forecasters get a class
2518
- fixed quantile bug in `flatline_forecaster()`
2619
- add functionality to output the unfit workflow from the canned forecasters
27-
28-
# epipredict 0.0.4
29-
3020
- add quantile_reg()
3121
- clean up documentation bugs
3222
- add smooth_quantile_reg()
3323
- add classifier
3424
- training window step debugged
3525
- `min_train_window` argument removed from canned forecasters
36-
37-
# epipredict 0.0.3
38-
3926
- add forecasters
4027
- implement postprocessing
4128
- vignettes avaliable
4229
- arx_forecaster
4330
- pkgdown
44-
45-
# epipredict 0.0.0.9000
46-
4731
- Publish public for easy navigation
4832
- Two simple forecasters as test beds
4933
- Working vignette

0 commit comments

Comments
 (0)