From 14f21df58d5c143fff41734acfcd12b796137fb7 Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Mon, 1 Jul 2024 11:00:40 -0400 Subject: [PATCH 1/7] ci(integration): Use latest shinylive assets in r package tests --- .github/workflows/R-CMD-check.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index c827a89..c4adbb6 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -72,10 +72,19 @@ jobs: make all - name: Link shinylive assets + id: r-linked-assets shell: Rscript {0} run: | shinylive::assets_install_copy("shinylive_assets") shinylive::assets_info() + cat( + "version=", shinylive:::package_json_version("shinylive_assets"), + file = Sys.getenv("GITHUB_OUTPUT"), + append = TRUE, + sep = "" + ) + + - name: Update lua script for debugging shell: Rscript {0} run: | @@ -104,6 +113,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() From 7159e314aca44339a8bbae85110d6fa429e6ffab Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Mon, 1 Jul 2024 11:01:00 -0400 Subject: [PATCH 2/7] ci(integration): Match `py-shinylive` assets version in Quarto integration test --- .github/workflows/R-CMD-check.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index c4adbb6..52cdb8c 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -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 @@ -124,10 +126,14 @@ 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 uses: quarto-dev/quarto-actions/render@v2 + env: + # Test r-shinylive against the same shinylive assets as py-shinylive + SHINYLIVE_ASSETS_VERSION: ${{ steps.py-shinylive.outputs.version }} with: path: local/quarto/ From 525dbb96cb083f900ab90e9513651403c3389799 Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Mon, 1 Jul 2024 11:06:22 -0400 Subject: [PATCH 3/7] ci(integration): Also do Quarto integration test with latest shinylive assets --- .github/workflows/R-CMD-check.yaml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 52cdb8c..cf15f1a 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -127,12 +127,23 @@ jobs: testthat::test_local() + - name: Link shinylive assets for py-shinylive + shell: bash + run: | + shinylive assets link-from-local shinylive_assets/build + # 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: + SHINYLIVE_ASSETS_VERSION: ${{ steps.r-linked-assets.outputs.version }} + with: + path: local/quarto/ + + - name: Test shinylive quarto extension with py-shinylive assets version uses: quarto-dev/quarto-actions/render@v2 env: - # Test r-shinylive against the same shinylive assets as py-shinylive SHINYLIVE_ASSETS_VERSION: ${{ steps.py-shinylive.outputs.version }} with: path: local/quarto/ From 90106c4fe75de3d8e86a4ee75543956794318248 Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Mon, 1 Jul 2024 11:11:31 -0400 Subject: [PATCH 4/7] ci(integration): Test latest shinylive assets _after_ py-shinylive shipped assets --- .github/workflows/R-CMD-check.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index cf15f1a..1dd981c 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -126,25 +126,25 @@ jobs: shinylive::assets_ensure() testthat::test_local() - - - name: Link shinylive assets for py-shinylive - shell: bash - run: | - shinylive assets link-from-local shinylive_assets/build - + # If this (^^) completes, it is a big success! # Run quarto test after testthat test - - name: Test shinylive quarto extension with latest shinylive assets + - name: Test shinylive quarto extension with py-shinylive assets version uses: quarto-dev/quarto-actions/render@v2 env: - SHINYLIVE_ASSETS_VERSION: ${{ steps.r-linked-assets.outputs.version }} + SHINYLIVE_ASSETS_VERSION: ${{ steps.py-shinylive.outputs.version }} with: path: local/quarto/ + + - name: Link shinylive assets for py-shinylive + shell: bash + run: | + shinylive assets link-from-local shinylive_assets/build - - name: Test shinylive quarto extension with py-shinylive assets version + - name: Test shinylive quarto extension with latest shinylive assets uses: quarto-dev/quarto-actions/render@v2 env: - SHINYLIVE_ASSETS_VERSION: ${{ steps.py-shinylive.outputs.version }} + SHINYLIVE_ASSETS_VERSION: ${{ steps.r-linked-assets.outputs.version }} with: path: local/quarto/ From 31522e134bc540c1db44d6f21417feb1f6a4e441 Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Mon, 1 Jul 2024 11:13:43 -0400 Subject: [PATCH 5/7] tests(quarto_ext): Expect `assets_ensure()` downloads `assets_version()` assets not the hard-coded default assets version --- tests/testthat/test-quarto_ext.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-quarto_ext.R b/tests/testthat/test-quarto_ext.R index 8871e2c..486c906 100644 --- a/tests/testthat/test-quarto_ext.R +++ b/tests/testthat/test-quarto_ext.R @@ -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) && From e8ab3f5c41cf9d179890b7b52262024a2f9949f1 Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Mon, 1 Jul 2024 11:23:44 -0400 Subject: [PATCH 6/7] 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. --- .github/workflows/R-CMD-check.yaml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 1dd981c..8136c17 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -60,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: @@ -126,15 +133,6 @@ 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 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: Link shinylive assets for py-shinylive shell: bash From e296451279dbc9d6e0a56d3130a2f47b0317d76f Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Mon, 1 Jul 2024 12:01:24 -0400 Subject: [PATCH 7/7] ci: ensure old cached assets are cleaned up before linking to new asstes --- .github/workflows/R-CMD-check.yaml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 8136c17..025cb33 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -84,16 +84,17 @@ jobs: 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:::package_json_version("shinylive_assets"), + "version=", shinylive_local_version, file = Sys.getenv("GITHUB_OUTPUT"), append = TRUE, sep = "" ) - - name: Update lua script for debugging shell: Rscript {0} run: | @@ -133,15 +134,12 @@ jobs: shinylive::assets_ensure() testthat::test_local() - - - name: Link shinylive assets for py-shinylive - shell: bash - run: | - shinylive assets link-from-local shinylive_assets/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/