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

ci(integration): Coordinate tested assets versions #101

Merged
merged 7 commits into from
Jul 1, 2024
29 changes: 26 additions & 3 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ jobs:
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
Expand All @@ -58,6 +60,13 @@ jobs:
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:
Expand All @@ -72,10 +81,20 @@ jobs:
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")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use the py-shinylive assets version here, but that would lead to confusing testing. Instead, a proper and reasonable solution would be to update py-shinylive to support --assets-version in CLI to use different versions when exporting.

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: |
Expand Down Expand Up @@ -104,6 +123,7 @@ jobs:
- 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()
Expand All @@ -114,10 +134,13 @@ jobs:
shinylive::assets_ensure()

testthat::test_local()
# If this (^^) completes, it is a big success!
# Run quarto test after testthat test
- name: Test shinylive quarto extension can build

- 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/

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-quarto_ext.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test_that("quarto_ext handles `extension info`", {
}))
info <- jsonlite::parse_json(txt)
expect_equal(info$version, as.character(utils::packageVersion("shinylive")))
expect_equal(info$assets_version, SHINYLIVE_ASSETS_VERSION)
expect_equal(info$assets_version, assets_version())

expect_true(
is.list(info$scripts) &&
Expand Down
Loading