Add pkgdown configuration and update GitHub Actions for deployment #102
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
on: | |
push: | |
branches: [main, master] | |
pull_request: | |
branches: [main, master] | |
name: workflow_with_cmdstanr | |
jobs: | |
workflow_with_cmdstanr: | |
runs-on: ${{ matrix.config.os }} | |
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- {os: macos-latest, r: 'release'} | |
- {os: windows-latest, r: 'release', rtools: '44'} | |
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} | |
- {os: ubuntu-latest, r: 'release'} | |
- {os: ubuntu-latest, r: 'oldrel-1'} | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
R_KEEP_PKG_SOURCE: yes | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: ${{ matrix.config.r }} | |
rtools-version: '44' | |
http-user-agent: ${{ matrix.config.http-user-agent }} | |
use-public-rspm: true | |
- name: Install R dependencies | |
shell: Rscript {0} | |
run: | | |
install.packages("SeuratObject") | |
if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") | |
BiocManager::install() | |
if (!requireNamespace("devtools", quietly = TRUE)) install.packages("devtools") | |
devtools::install_deps(dependencies = TRUE) | |
- name: Install CmdStan | |
shell: Rscript {0} | |
run: | | |
# TEMPORARY: Install cmdstanr from GitHub v0.9.0 for this branch | |
if (!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes") | |
remotes::install_github("stan-dev/cmdstanr", ref = "v0.9.0") | |
# ORIGINAL CRAN INSTALLATION (commented out for temporary GitHub install): | |
# install.packages("cmdstanr", repos = c("https://mc-stan.org/r-packages/", getOption("repos"))) | |
cmdstanr::check_cmdstan_toolchain(fix = TRUE) | |
cmdstanr::install_cmdstan(cores = 2) | |
cmdstanr::cmdstan_version() | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
dependencies: '"hard"' # do not install packages in Suggests | |
cache: false | |
extra-packages: | | |
any::rcmdcheck | |
any::knitr | |
any::rmarkdown | |
any::ggplot2 | |
any::tibble | |
any::dplyr | |
any::prettydoc | |
needs: check | |
- uses: r-lib/actions/check-r-package@v2 | |
with: | |
upload-snapshots: true | |
# Build job | |
build: | |
runs-on: ubuntu-latest | |
needs: workflow_with_cmdstanr | |
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: 'release' | |
use-public-rspm: true | |
- name: Install R dependencies | |
shell: Rscript {0} | |
run: | | |
install.packages("SeuratObject") | |
if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") | |
BiocManager::install() | |
if (!requireNamespace("devtools", quietly = TRUE)) install.packages("devtools") | |
devtools::install_deps(dependencies = TRUE) | |
- name: Install CmdStan | |
shell: Rscript {0} | |
run: | | |
install.packages("cmdstanr", repos = c("https://mc-stan.org/r-packages/", getOption("repos"))) | |
cmdstanr::check_cmdstan_toolchain(fix = TRUE) | |
cmdstanr::install_cmdstan(cores = 2) | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
dependencies: '"hard"' | |
extra-packages: | | |
any::pkgdown | |
any::knitr | |
any::rmarkdown | |
any::ggplot2 | |
any::tibble | |
any::dplyr | |
any::prettydoc | |
- name: Build pkgdown site | |
shell: Rscript {0} | |
run: | | |
pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
- name: Deploy to GitHub pages 🚀 | |
if: github.event_name != 'pull_request' || github.head_ref == 'fix-github-pages' | |
uses: JamesIves/github-pages-deploy-action@v4.5.0 | |
with: | |
clean: false | |
branch: gh-pages | |
folder: docs | |