Skip to content

Commit

Permalink
Merge branch 'main' into Quickfix/EFvignette/logscale
Browse files Browse the repository at this point in the history
  • Loading branch information
d-morrison authored Oct 15, 2024
2 parents 2f532a7 + 1fd80d4 commit 6c39a26
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 35 deletions.
150 changes: 125 additions & 25 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,54 @@
# 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
# Deploys pkgdown for Pull Requests, tags, and pushes to main branch
# PRs are deployed to /preview/pr<number>/
# Tags are deployed to /<tag>/
# copied from https://github.com/rstudio/education-workflows/blob/main/examples/pkgdown.yaml
# referred from https://github.com/r-lib/actions/issues/865
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
branches:
- main
types:
- opened
- reopened
- synchronize
- closed
paths:
- 'man/**'
- 'pkgdown/**'
- 'vignettes/**'
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+' # build on version tags
- '!v[0-9]+.[0-9]+.[0-9]+.[0-9]+' # but not if version involves a dev component
branches:
- main
workflow_dispatch:
inputs:
tag:
description: Tag to deploy
required: true
default: ''

name: pkgdown.yaml
name: pkgdown

jobs:
pkgdown:
pkgdown-build:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
if: ${{ !(github.event_name == 'pull_request' && github.event.action == 'closed') }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v2

- name: Configure git
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "[email protected]"
- uses: r-lib/actions/pr-fetch@v2
if: ${{ github.event_name == 'pull_request' }}
with:
repo-token: ${{ github.token }}

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

Expand All @@ -32,17 +58,91 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website
needs: |
connect
website
extra-packages: |
local::.
any::pkgdown
# If events is a PR, set subdir to 'preview/pr<pr_number>'
- name: "[PR] Set documentation subdirectory"
if: github.event_name == 'pull_request'
run: |
echo "PKGDOWN_DEV_MODE=unreleased" >> $GITHUB_ENV
echo "subdir=preview/pr${{ github.event.number }}" >> $GITHUB_ENV
- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
# If event is a tag, set subdir to '<tag_name>'
- name: "[tag] Set documentation subdirectory"
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
run: |
echo "PKGDOWN_DEV_MODE=release" >> $GITHUB_ENV
echo "subdir=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
# If event is workflow_dispatch, set subdir to 'inputs.tag'
- name: '[dispatch] Set documentation subdirectory'
if: github.event_name == 'workflow_dispatch'
run: |
echo "subdir=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
- name: Deploy pkgdown site
id: deploy
shell: Rscript {0}
run: |
subdir <- "${{ env.subdir }}"
pkg <- pkgdown::as_pkgdown(".")
# Deploy pkgdown site to branch
pkgdown::deploy_to_branch(subdir = if (nzchar(subdir)) subdir, clean = nzchar(subdir))
# Report deployed site URL
deployed_url <- file.path(pkg$meta$url, subdir)
cat(sprintf('url=%s', deployed_url), file = Sys.getenv("GITHUB_OUTPUT"), append = TRUE)
- name: Notify pkgdown deployment
if: github.event_name == 'pull_request'
uses: hasura/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
number: ${{ github.event.number }}
id: pkgdown-deploy
append: false
message: >
:book: ${{ steps.deploy.outputs.url }}
Preview documentation for this PR (at commit ${{ github.event.pull_request.head.sha }})
pkgdown-clean:
if: ${{ github.event_name == 'pull_request' && github.event.action == 'closed' }}
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
with:
ref: "gh-pages"

- name: Clean up PR Preview
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "[email protected]"
preview_dir="preview/pr${{ github.event.pull_request.number }}"
if [ -d "$preview_dir" ]; then
git rm -r $preview_dir
git commit -m "Remove $preview_dir (GitHub Actions)" || echo 'No preview to remove'
git push origin || echo 'No preview to remove'
else
echo 'No preview to remove'
fi
- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/[email protected]
- name: Notify pkgdown cleanup
uses: hasura/[email protected]
with:
clean: false
branch: gh-pages
folder: docs
github-token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
number: ${{ github.event.number }}
id: pkgdown-deploy
message: |
_:closed_book: Preview documentation for this PR has been cleaned up._
5 changes: 4 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
* Added template for pull requests
(from <https://github.com/bcgov/ssdtools>) (#265)

## Developer-facing changes
## Internal changes

* Added online preview builds for PRs that change the `pkgdown` website (#309)

* initialized [`lintr`](https://lintr.r-lib.org/) with `lintr::use_lint()` (#278)

Expand All @@ -28,6 +30,7 @@
* fixed `dplyr::select()` deprecation warning in `df_to_array()` (#276)

* Added `devtag` to package (using `devtag::use_devtag()`) (#292)

* Added `@dev` tag to `?df_to_array()` (#292)

* Generalized `get_()` and `set_()` methods to be general-purpose
Expand Down
3 changes: 3 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ template:
light-switch: true

bibliography: vignettes/references.bib

search:
exclude: ['preview/']
9 changes: 1 addition & 8 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Nadu
OSF
Orientia
PLoS
PRs
Pebody
Polina
RStudio
Expand Down Expand Up @@ -84,9 +85,6 @@ Valk
Vectorized
Vellore
Versteegh
VignetteEncoding
VignetteEngine
VignetteIndexEntry
Volterra
Wetering
Wiens
Expand All @@ -97,7 +95,6 @@ behaviour
bioassays
biomarker
boldsymbol
bookdown
callout
campylobacteriosis
cdot
Expand Down Expand Up @@ -125,7 +122,6 @@ isotypes
jinf
jitter
kDa
knitr
le
leq
llik
Expand Down Expand Up @@ -155,7 +151,6 @@ qquad
recombinant
renewcommand
rescale
rmarkdown
savePath
sectionally
sera
Expand All @@ -178,11 +173,9 @@ subfigures
th
tibble
titers
toc
tsutsugamushi
undercount
unstratified
varepsilon
vec
vee
xsectionalData
7 changes: 6 additions & 1 deletion vignettes/articles/enteric_fever_example.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ bibliography: ../references.bib
---
## Introduction

This vignette provides users with an example analysis using the [**serocalculator**](https://github.com/UCD-SERG/serocalculator) package by reproducing the analysis for: [**Estimating typhoid incidence from community-based serosurveys: a multicohort study**](https://www.thelancet.com/journals/lanmic/article/PIIS2666-5247(22)00114-8/fulltext) (@Aiemjoy_2022_Lancet). We review the methods underlying the analysis and then walk through an example of enteric fever incidence in Pakistan. Note that because this is a simplified version of the analysis, the results here will differ slightly from those presented in the publication.
This vignette provides users with an example analysis using the [**serocalculator**](https://github.com/UCD-SERG/serocalculator) package
by reproducing the analysis for:
[**Estimating typhoid incidence from community-based serosurveys: a multicohort study**](https://www.thelancet.com/journals/lanmic/article/PIIS2666-5247(22)00114-8/fulltext) (@Aiemjoy_2022_Lancet).
We review the methods underlying the analysis
and then walk through an example of enteric fever incidence in Pakistan.
Note that because this is a simplified version of the analysis, the results here will differ slightly from those presented in the publication.

In this example, users will determine the seroincidence of enteric fever in cross-sectional serosurveys conducted as part of the SeroEpidemiology and Environmental Surveillance (SEES) for enteric fever study in Bangladesh, Nepal, and Pakistan. Longitudinal antibody responses were modeled from 1420 blood culture-confirmed enteric fever cases enrolled from the same countries.

Expand Down

0 comments on commit 6c39a26

Please sign in to comment.