Skip to content

Commit

Permalink
ci(integration): Coordinate tested assets versions (#101)
Browse files Browse the repository at this point in the history
* ci(integration): Use latest shinylive assets in r package tests

* ci(integration): Match `py-shinylive` assets version in Quarto integration test

* ci(integration): Also do Quarto integration test with latest shinylive assets

* ci(integration): Test latest shinylive assets _after_ py-shinylive shipped assets

* tests(quarto_ext): Expect `assets_ensure()` downloads `assets_version()` assets

not the hard-coded default assets version

* ci(integration): Test r/py-shinylive in quarto earlier to ensure release shinylive assets

Otherwise the locally-built and installed assets may have the same version number and may mask the released assets.

* ci: ensure old cached assets are cleaned up before linking to new asstes
  • Loading branch information
gadenbuie authored Jul 1, 2024
1 parent 49eebff commit 5b1cebe
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
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")
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

0 comments on commit 5b1cebe

Please sign in to comment.