Skip to content

Add SHINYLIVE_WASM_PACKAGES environment variable #268

Add SHINYLIVE_WASM_PACKAGES environment variable

Add SHINYLIVE_WASM_PACKAGES environment variable #268

Workflow file for this run

# Workflow derived from https://github.com/rstudio/shiny-workflows
#
# NOTE: This Shiny team GHA workflow is overkill for most R packages.
# For most R packages it is better to use https://github.com/r-lib/actions
on:
push:
branches: [main, rc-**]
pull_request:
branches: [main]
schedule:
- cron: "0 9 * * 1" # every monday
name: Package checks
jobs:
website:
uses: rstudio/shiny-workflows/.github/workflows/website.yaml@v1
routine:
uses: rstudio/shiny-workflows/.github/workflows/routine.yaml@v1
R-CMD-check:
uses: rstudio/shiny-workflows/.github/workflows/R-CMD-check.yaml@v1
integration:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python - 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Upgrade pip
shell: bash
run: |
python -m pip install --upgrade pip
- name: Install py-shinylive
id: py-shinylive
shell: bash
run: |
pip install shinylive
# pip install https://github.com/posit-dev/py-shinylive/archive/split_api.zip
echo "version=$(shinylive assets version)" >> "$GITHUB_OUTPUT"
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: Install quarto-ext/shinylive
shell: bash
run: |
cd local/quarto
quarto add quarto-ext/shinylive --no-prompt
# Trouble installing from branch. Using url instead.
# quarto add http://github.com/quarto-ext/shinylive/archive/v2_api.zip --no-prompt
- name: Install R, system dependencies, and package dependencies
uses: rstudio/shiny-workflows/setup-r-package@v1
with:
needs: quarto
- name: Test shinylive quarto extension with py-shinylive assets version
uses: quarto-dev/quarto-actions/render@v2
env:
SHINYLIVE_ASSETS_VERSION: ${{ steps.py-shinylive.outputs.version }}
with:
path: local/quarto/
- name: Check out 'posit-dev/shinylive' repo into './shinylive_assets'
uses: actions/checkout@v4
with:
repository: posit-dev/shinylive
path: shinylive_assets
- name: Build shinylive assets
shell: bash
run: |
cd shinylive_assets
make submodules
make all
- name: Link shinylive assets
id: r-linked-assets
shell: Rscript {0}
run: |
shinylive_local_version <- shinylive:::package_json_version("shinylive_assets")
shinylive::assets_remove(shinylive_local_version)
shinylive::assets_install_copy("shinylive_assets")
shinylive::assets_info()
cat(
"version=", shinylive_local_version,
file = Sys.getenv("GITHUB_OUTPUT"),
append = TRUE,
sep = ""
)
- name: Update lua script for debugging
shell: Rscript {0}
run: |
shinylive_lua <- file.path(
"local", "quarto", "_extensions",
# (When installing from a zip url, there is no `quarto-ext` dir.)
"quarto-ext",
"shinylive", "shinylive.lua"
)
shinylive_lua |>
brio::read_file() |>
sub(
pattern = "-- print(\"Calling",
replacement = "print(\"Calling",
fixed = TRUE
) |>
sub(
pattern = "-- print(\"res",
replacement = "-- print(\"res",
fixed = TRUE
) |>
brio::write_file(shinylive_lua)
cat(brio::read_file(shinylive_lua),"\n")
- name: Run shinylive R package tests
env:
TEST_ASSETS: "TRUE"
SHINYLIVE_ASSETS_VERSION: ${{ steps.r-linked-assets.outputs.version }}
shell: Rscript {0}
run: |
shinylive::assets_info()
dir(shinylive:::assets_cache_dir())
dir(shinylive:::assets_dirs())
as.list(fs::file_info(shinylive:::assets_dirs()))
shinylive::assets_ensure()
testthat::test_local()
- name: Test shinylive quarto extension with latest shinylive assets
uses: quarto-dev/quarto-actions/render@v2
env:
# TODO: py-shinylive doesn't follow this envvar yet. If shinylive
# has a newer version, this action will fail.
SHINYLIVE_ASSETS_VERSION: ${{ steps.r-linked-assets.outputs.version }}
with:
path: local/quarto/
# TODO-barret-future; Test the output of the render using pyright / py-shiny e2e controls?