Skip to content

Merge branch 'main' into copilot/convert-repo-to-quarto-website #13

Merge branch 'main' into copilot/convert-repo-to-quarto-website

Merge branch 'main' into copilot/convert-repo-to-quarto-website #13

# GitHub Copilot Setup Steps for rme
#
# This workflow configures the GitHub Copilot coding agent's environment
# by preinstalling R, Quarto, TinyTeX, and all required dependencies.
#
# See: https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment
# For detailed setup instructions, see .github/copilot-instructions.md
#
# This workflow aligns with the setup requirements documented in .github/copilot-instructions.md:
# - R version >= 3.5 (as specified in DESCRIPTION, prefer latest release)
# - Quarto CLI for rendering the website
# - TinyTeX for PDF output
# - JAGS for Bayesian analysis (rjags and runjags packages)
# - All package dependencies managed via renv
name: "Copilot Setup Steps"
# Automatically run the setup steps when they are changed to allow for easy validation,
# and allow manual testing through the repository's "Actions" tab
on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
pull_request:
paths:
- .github/workflows/copilot-setup-steps.yml
jobs:
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
copilot-setup-steps:
runs-on: ubuntu-latest
# Set the permissions to the lowest permissions possible needed for your steps.
# Copilot will be given its own token for its operations.
permissions:
contents: read
# Timeout after 55 minutes (max is 59 for copilot-setup-steps)
timeout-minutes: 55
steps:
# Checkout code - Copilot will do this automatically if we don't,
# but we need it to install dependencies from renv.lock
- name: Checkout code
uses: actions/checkout@v4
# Install system dependencies required for R packages
# See .github/copilot-instructions.md "System Dependencies" and "JAGS Dependencies" sections
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
jags \
libcurl4-openssl-dev \
libssl-dev \
libxml2-dev \
libfontconfig1-dev \
libharfbuzz-dev \
libfribidi-dev \
libfreetype6-dev \
libpng-dev \
libtiff5-dev \
libjpeg-dev
# Set up pandoc for documentation
- name: Set up Pandoc
uses: r-lib/actions/setup-pandoc@v2
# Set up R using the standard GitHub Actions setup
# R version >= 3.5 required (see DESCRIPTION and .github/copilot-instructions.md)
# Using 'release' to get the latest R version
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
r-version: 'release'
use-public-rspm: true
# Set up Quarto - required for rendering the website
# See .github/copilot-instructions.md "Quarto Rendering" section
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
tinytex: true
# Install R dependencies using renv
# This project uses renv for package management
# See .github/copilot-instructions.md "R Package Management" section
- name: Install R dependencies via renv
uses: r-lib/actions/setup-renv@v2
with:
cache-version: 1
# Verify R environment is properly configured
# See .github/copilot-instructions.md sections on development setup
- name: Verify development environment
run: |
echo "=== R Development Environment Status ==="
Rscript -e '
cat("R version:", R.version.string, "\n\n")
# Check R version meets minimum requirement (>= 3.5)
r_version <- paste(R.version$major, R.version$minor, sep = ".")
cat("Checking R version >= 3.5... ")
if (getRversion() >= "3.5") {
cat("PASSED (", r_version, ")\n\n", sep = "")
} else {
cat("FAILED (", r_version, ")\n\n", sep = "")
stop("R version must be >= 3.5")
}
# Display key installed packages from DESCRIPTION
cat("Key installed packages:\n")
key_packages <- c("arm", "arsenal", "cards", "cardx", "cvTools", "dobson",
"forcats", "fs", "glmmTMB", "glmnet", "gtsummary", "here",
"insight", "knitr", "latex2exp", "olsrr", "pander", "printr",
"reactable", "rlang", "rmarkdown", "stringr", "table1", "tibble",
"webshot2", "tidyverse", "rjags", "runjags", "ggplot2", "dplyr",
"tidyr", "spelling", "gh", "lintr", "purrr", "pkgdown")
for (pkg in key_packages) {
if (requireNamespace(pkg, quietly = TRUE)) {
cat(" -", pkg, ":", as.character(packageVersion(pkg)), "\n")
} else {
cat(" -", pkg, ": NOT INSTALLED\n")
}
}
cat("\nTotal packages installed:", nrow(installed.packages()), "\n")
'
# Verify Quarto is installed and working
echo ""
echo "=== Quarto Status ==="
quarto --version
quarto list tools
# Verify JAGS is installed
echo ""
echo "=== JAGS Status ==="
if which jags > /dev/null 2>&1; then
echo "JAGS found in PATH"
jags -v 2>&1 || echo "JAGS installed but version check failed"
else
echo "JAGS not found in PATH"
fi
# Verify renv is active
echo ""
echo "=== renv Status ==="
Rscript -e 'cat("renv active:", !is.null(renv::project()), "\n")'
Rscript -e 'cat("renv library path:", .libPaths()[1], "\n")'
echo ""
echo "Development environment setup complete!"