Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The {rwasm}/actions documentation needs to be improved #21

Open
georgestagg opened this issue May 7, 2024 · 5 comments
Open

The {rwasm}/actions documentation needs to be improved #21

georgestagg opened this issue May 7, 2024 · 5 comments
Labels
documentation Improvements or additions to documentation

Comments

@georgestagg
Copy link
Member

The instructions at https://r-wasm.github.io/rwasm/articles/github-actions.html#using-an-r-package-library-image are incorrect. The instructions should instead describe how to use rwasm-binary-and-pkgdown-site.yml.

This should be made as part of a wider refresh of the {rwasm} documentation.

@georgestagg
Copy link
Member Author

My comment above is a little strong, the release-file-system-image.yml action works OK, we use it at r-wasm/shiny, for example.

The issue is more that the documention does not make it clear enough what the difference is between the "build and attach a Wasm binary to your package releases", and the "create a CRAN-like Wasm binary repository" workflows, and why you might want to use one or the other.

For example, the first works well for attaching the action onto an existing R package repo, because it does not interfere with building a pkgdown website on Github Pages. This action also makes it possible to export your package easily with shinylive.

On the other hand, the second requires a separate git repository and listing your package(s) to include in the CRAN-like repo, otherwise it will interfere with pkgdown unless using https://github.com/r-wasm/actions/blob/main/examples/rwasm-binary-and-pkgdown-site.yml. The benefit is that you get a CRAN-like repo you can include in any webR application.

We also need to mention r-universe somewhere, because the workflow there is extremely beneficial for non-expert users.

I guess what I am saying is "there are options here, and the right one to pick is complicated". The docs need some working on to reflect that.

@georgestagg georgestagg changed the title The "Using an R package library image" instructions are incorrect. The {rwasm} documentation needs to be improved Aug 7, 2024
@georgestagg georgestagg changed the title The {rwasm} documentation needs to be improved The {rwasm}/actions documentation needs to be improved Aug 7, 2024
@psychemedia
Copy link

psychemedia commented Aug 22, 2024

In both actions, when adding packages, the phrase "A string of [R package references](https://r-lib.github.io/pkgdepends/reference/pkg_refs.html)." does not indicate how multiple packages should be listed in the string and the example gives only a single package.

@georgestagg georgestagg added the documentation Improvements or additions to documentation label Aug 27, 2024
@andrewpbray
Copy link

I admit I've struggled with the documentation as well!

I have an r package on github that is a dependency of a shiny app that I'm trying to convert to a shinylive app. On running > shinylive::export("R", "site") in the app repo, it errored out because that package didn't have the WASM binary assets associated with the release. That pointed me to this r-wasm/actions repo, where I learned from the workflows README to run :

usethis::use_github_action(
  url = "https://raw.githubusercontent.com/r-wasm/actions/v2/examples/release-file-system-image.yml"
)

On making a release, the action triggered but errored out with:

Run has_wasm_need <-
  has_wasm_need <-
    file.exists("DESCRIPTION") &&
    "Config/Needs/wasm" %in% names(as.list(read.dcf("DESCRIPTION")[1,]))
  pkg <- if (has_wasm_need) as.list(read.dcf("DESCRIPTION")[1,])$`Config/Needs/wasm` else ""
  pkg <- paste0(strsplit(pkg, "[[:space:],]+")[[1]], collapse = ",")
  cat("pkg=", pkg, "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE)
  Error: Rscript: command not found

Which makes me think that the image doesn't have R. Is the user supposed to tinker with the image used in this workflow?

Thanks for your help!

Note: I also posted this to the posit community forum.

@georgestagg
Copy link
Member Author

georgestagg commented Oct 8, 2024

Hi @andrewpbray,

How strange! I just triggered a test release on the repo and the action ran OK for me! I cannot see why they should behave differently.

EDIT: Oh wait, yours is running under ubuntu-24.04! Mine is running under ubuntu-22.04. Curious, we specify ubuntu-latest:

Oh... I see: actions/runner-images#10636. From that announcement:

This change will be rolled out over a period of several weeks beginning in September 25th, 2024. We plan to complete the migration by October 30th , 2024.

That explains the difference in behaviour.


Probably we just need to install R when running under ubuntu-24.04. The user shouldn't need to tinker with the image, I think we can do it from our end using the standard r-lib actions.

Okay, so for now I'm going to hard-code our actions to use ubuntu-22.04, and revisit it again once the migration of ubuntu-latest is complete.

Could you try updating your workflow file to read the following and releasing again? I've also added the key compress: false, which will be required for other reasons so we may as well also change now:

jobs:
  release-file-system-image:
    uses: r-wasm/actions/.github/workflows/release-file-system-image.yml@v2
    with:
      compress: false
    permissions:
      contents: write
      repository-projects: read

@andrewpbray
Copy link

Hey, good catch!

I've updated my workflow file with the one that you provided here and it worked just swell.

https://github.com/gradebook-dev/gradebook/actions/runs/11239419246/job/31246421132

This is a really clever workflow, the way it appends the needed assets to the release. Very excited to see if I can get the whole app deployed via shinylive.

Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants