Skip to content

Add fast RF cross-pairs via Day 1985 ClusterTable batch (#192) #431

Add fast RF cross-pairs via Day 1985 ClusterTable batch (#192)

Add fast RF cross-pairs via Day 1985 ClusterTable batch (#192) #431

Workflow file for this run

on:
push:
branches:
- main
- master
paths:
- 'DESCRIPTION'
- '**pkgdown.yml'
- '*.md'
- 'inst/CITATION'
- 'inst/*.bib'
- 'man/**.Rd'
- 'vignettes/**.Rmd'
release:
types: [published]
workflow_dispatch:
name: pkgdown
jobs:
pkgdown:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
# ── Build pkgdown site (no shinylive, no deploy) ──────────────
- uses: ms609/actions/pkgdown@main
with:
extra-repositories: https://ms609.github.io/packages/
deploy: 'false'
# ── Export Shinylive app ──────────────────────────────────────
- name: Export Shinylive app
shell: Rscript {0}
run: |
# ── Use dev shinylive for R 4.5 WASM support ──
# CRAN shinylive 0.3.0 targets webR R 4.4.1.
# The dev version (0.3.0.9000) targets R 4.5.1, where:
# - otel is available on repo.r-wasm.org
# - R-universe has a fixed TreeTools (no RCurl dep)
# TODO: Switch back to CRAN shinylive once 0.4.0 ships.
remotes::install_github("posit-dev/r-shinylive", quiet = TRUE)
# ── Install TreeTools and TreeDist from R-universe ──
# repo.r-wasm.org has TreeTools 2.0.0 (still imports RCurl) for
# both R 4.4 and 4.5. R-universe has 2.2.0.9001 (RCurl moved to
# Suggests) compiled for R 4.5. Setting Repository to the
# R-universe URL makes shinylive fetch the WASM binary from there.
# Similarly, installing TreeDist from R-universe avoids the version
# mismatch warning (local dev != WASM 2.9.2 on repo.r-wasm.org).
# TODO: Remove once TreeTools >= 2.2.0 and TreeDist >= 2.13.0
# are on CRAN and r-wasm.org has rebuilt them.
install.packages(
c("TreeTools", "TreeDist"),
repos = c("https://ms609.r-universe.dev",
"https://cloud.r-project.org")
)
# ── Work around shinylive bug (coatless/quarto-webr#228) ──
# shinylive resolves deps from the WASM repo's PACKAGES
# database, which may reference packages not installed
# locally (e.g. R.cache). packageDescription() returns NA
# for these, and shinylive crashes on desc$Repository.
# Patch packageDescription to return a stub instead of NA.
#
# TODO: Remove once shinylive handles missing packages.
local({
real_pd <- utils::packageDescription
ns <- asNamespace("utils")
unlockBinding("packageDescription", ns)
assign("packageDescription", function(pkg, lib.loc = NULL,
fields = NULL, drop = TRUE, encoding = "") {
result <- real_pd(pkg, lib.loc = lib.loc, fields = fields,
drop = drop, encoding = encoding)
if (identical(result, NA)) {
message(" [shinylive patch] '", pkg,
"' not installed locally; stub description used")
result <- structure(
list(Package = pkg, Version = "0.0.0",
Repository = "CRAN"),
class = "packageDescription"
)
if (!is.null(fields)) {
result <- result[fields]
if (drop && length(fields) == 1L)
return(result[[1L]])
}
}
result
}, envir = ns)
})
# ── Locate app ──
pkg_name <- read.dcf("DESCRIPTION")[, "Package"]
app_dir <- system.file("treespace", package = pkg_name)
if (!dir.exists(app_dir)) app_dir <- "inst/treespace"
stopifnot(
"app.R not found" = file.exists(file.path(app_dir, "app.R"))
)
# ── Export ──
tryCatch(
shinylive::export(appdir = app_dir, destdir = "docs/app"),
error = function(e) {
msg <- conditionMessage(e)
message("\n===== shinylive::export() failed =====")
message(msg)
message("This is often caused by a dependency not available")
message("as a WebAssembly binary. Check both:")
message(" https://repo.r-wasm.org/bin/emscripten/contrib/4.5/PACKAGES")
message(" https://ms609.r-universe.dev/bin/emscripten/contrib/4.5/PACKAGES")
stop(e)
}
)
file.create("docs/.nojekyll")
# ── Deploy ────────────────────────────────────────────────────
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs
branch: gh-pages
clean: false