Build Shiny App #524
This file contains 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
# Derived from https://github.com/miraisolutions/ShinyCICD/blob/master/.github/workflows/ci-cd-renv.yml | |
# and https://github.com/r-lib/actions/tree/v2/examples | |
name: Build Shiny App | |
on: | |
# Triggered on push and pull request events | |
push: | |
pull_request: | |
# Allow manual runs from the Actions tab | |
workflow_dispatch: | |
# Monthly runs on the 1st day of the month at midnight | |
schedule: | |
- cron: '0 0 1 * *' | |
jobs: | |
R-CMD-check: | |
runs-on: ${{ matrix.config.os }} | |
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | |
strategy: | |
fail-fast: false | |
# We keep a matrix for convenience, but we would typically just run on one | |
# single OS and R version, aligned with the target deployment environment | |
matrix: | |
config: | |
- {os: windows-latest, r: 'renv'} | |
# - {os: macos-latest, r: 'renv'} | |
# shinyapps.io uses ubuntu-22.04 instead of ubuntu-latest | |
# https://docs.posit.co/shinyapps.io/appendix.html#default-system-packages | |
- {os: ubuntu-22.04, r: 'renv'} | |
env: | |
# Access token for GitHub | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
# Preserve package sources for informative references in case of errors | |
R_KEEP_PKG_SOURCE: yes | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Setup R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: ${{ matrix.config.r }} | |
# Specify for windows | |
rtools-version: '42' | |
# Enable RStudio Package Manager to speed up package installation | |
use-public-rspm: true | |
- name: Install macOS system dependencies | |
if: runner.os == 'macOS' | |
# https://r-spatial.github.io/sf/#installing | |
run: brew install gdal proj | |
- name: Install ubuntu system dependencies | |
if: runner.os == 'Linux' | |
# https://r-spatial.github.io/sf/#installing | |
run: | | |
sudo apt-get -y update | |
sudo apt-get install -y libudunits2-dev libgdal-dev libgeos-dev libproj-dev | |
- name: Setup renv | |
uses: r-lib/actions/setup-renv@v2 | |
- name: Install R CMD check | |
run: install.packages("rcmdcheck") | |
shell: Rscript {0} | |
- name: Build shiny app as package | |
uses: r-lib/actions/check-r-package@v2 | |
with: | |
args: 'c("--no-manual", "--as-cran")' | |
# Bypass warning failures | |
error-on: '"error"' |