Skip to content

Commit

Permalink
Merge pull request #489 from cmu-delphi/dev
Browse files Browse the repository at this point in the history
release: v0.8
  • Loading branch information
dshemetov authored Jul 23, 2024
2 parents e7a4dfa + 62155cc commit 16f38b2
Show file tree
Hide file tree
Showing 116 changed files with 9,610 additions and 6,306 deletions.
4 changes: 4 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@
^pkgdown$
^doc$
^Meta$
^.git-blame-ignore-revs$
^.lintr$
^DEVELOPMENT.md$
man-roxygen
4 changes: 4 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Move to styler
c65876078a6f9525952b305eaea2fca003adf907
# Move to lintr
0c8144e0e9deb79547eb523298d782926a7337a6
1 change: 0 additions & 1 deletion .github/CODEOWNERS

This file was deleted.

24 changes: 24 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
### Checklist

Please:

- [ ] 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.

### 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}
10 changes: 6 additions & 4 deletions .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, master]
branches: [main, dev]
pull_request:
branches: [main, master, dev]
branches: [main, dev]
workflow_dispatch:

name: R-CMD-check

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

- uses: r-lib/actions/setup-r@v2
with:
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: 29 additions & 7 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: [main, master]
branches: [main, dev]
pull_request:
branches: [main, master, dev]
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 }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
DELPHI_EPIDATA_KEY: ${{ secrets.SECRET_EPIPROCESS_GHACTIONS_DELPHI_EPIDATA_KEY }}
steps:
- uses: actions/checkout@v3

Expand All @@ -34,13 +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 }}
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
# - 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: |
target_ref <- "${{ github.event_name == 'pull_request' && github.base_ref || github.ref }}"
override <- if (target_ref == "main" || target_ref == "refs/heads/main") {
list(development = list(mode = "release", version_label = "light"))
} else if (target_ref == "dev" || target_ref == "refs/heads/dev") {
list(development = list(mode = "devel", version_label = "success"))
} else {
stop("Unexpected target_ref: ", target_ref)
}
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)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
Expand Down
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
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@ inst/doc
docs
/doc/
/Meta/
*.DS_Store
*.DS_Store

# Delphi custom
renv/
renv.lock
.Rprofile
9 changes: 9 additions & 0 deletions .lintr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
linters: linters_with_defaults(
line_length_linter(120),
cyclocomp_linter = NULL,
object_length_linter(length = 40L)
)
exclusions: list(
"renv",
"venv"
)
Loading

0 comments on commit 16f38b2

Please sign in to comment.