This action builds a list of R packages for WebAssembly, creates a WebAssembly file image containing an R package library, and creates a CRAN-like repository containing the R package binaries.
This action uses the rwasm R package to build packages for WebAssembly, which must be run in Docker container ghcr.io/r-wasm/webr:main
to ensure access to a Wasm development toolchain. By requiring the step to use Docker, the action can only be run in ubuntu
based runners.
- packages (
.
) - A string of R package references. - repo-path (
_site
) - Directory where the CRAN-like repository should be saved.- Note: Due to limitations in GitHub Actions, the saved files can not be altered in any subsequent steps. Related: actions/runner#434.
- image-path (
.
) - Directory where the R package library filesystem image should be saved. - strip (
NULL
) - A set of directories to remove when building the WebAssembly R package library image, orNULL
to remove nothing. To achieve a smaller bundle size, it is recommended to setstrip
to"demo, doc, examples, help, html, include, tests, vignette"
.
- Install latest
r-wasm/rwasm
- Create the repo using
{rwasm}
- Create the WebAssembly file image using
{rwasm}
- Copy files to
repo-path
andimage-path
directory
jobs:
image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build wasm image
uses: ./build-file-system-image
# Use `library.data` and `library.js.metadata` files in `./_site` directory
# to create a GitHub Pages site.
jobs:
repo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build wasm packages
uses: r-wasm/actions/build-rwasm@v1
with:
packages: |
cli
# Use `library.data` and `library.js.metadata` files or repository files
# in `./_site` directory to create a GitHub Pages site.
To add the library image files to any GitHub release as assets files, use the release-file-system-image
workflow example.
The resulting CRAN-like repository can be used to create a GitHub Pages site using the deploy-cran-repo
workflow example. The package repository could alternatively be deployed to other static storage hosting in subsequent steps.