Skip to content

Commit

Permalink
use setup-r-dependencies action (#279)
Browse files Browse the repository at this point in the history
- update Quarto extensions used
- use setup-r-dependencies

companion PRs:
- insightsengineering/r.pkg.template#260
- insightsengineering/setup-r-dependencies#14
- insightsengineering/setup-r-dependencies#15

---------

Signed-off-by: Pawel Rucki <[email protected]>
  • Loading branch information
pawelru authored Nov 8, 2024
1 parent b0b9b41 commit 7c6fc3c
Show file tree
Hide file tree
Showing 33 changed files with 1,093 additions and 299 deletions.
31 changes: 28 additions & 3 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,59 @@ jobs:
if: github.event_name != 'push'
name: Audit Dependencies 🕵️‍♂️
uses: insightsengineering/r.pkg.template/.github/workflows/audit.yaml@main
r-cmd:
r-cmd-dev:
if: github.event_name != 'push'
name: R CMD Check (development) 🧬
uses: insightsengineering/r.pkg.template/.github/workflows/build-check-install.yaml@main
secrets:
REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
with:
install-deps-from-package-repositories: "R-universe=https://pharmaverse.r-universe.dev/,CRAN=https://cloud.r-project.org/"
package-subdirectory: package
additional-env-vars: |
NOT_CRAN=true
QUARTO_PROFILE=development
TLG_CATALOG_PKG_BUILD_RENDER=TRUE
concurrency-group: development
deps-installation-method: setup-r-dependencies
lookup-refs: |
insightsengineering/random.cdisc.data
insightsengineering/formatters
insightsengineering/rlistings
insightsengineering/rtables
insightsengineering/tern
insightsengineering/tern.mmrm
insightsengineering/tern.rbmi
insightsengineering/teal.data
insightsengineering/teal.code
insightsengineering/teal.logger
insightsengineering/teal.reporter
insightsengineering/teal.slice
insightsengineering/teal.transform
insightsengineering/teal.widgets
insightsengineering/teal
insightsengineering/teal.modules.general
insightsengineering/teal.modules.clinical
skip-desc-dev: true
repository-list: "r-universe-dev=https://pharmaverse.r-universe.dev/, PPM=PPM@latest"
cache-version: "dev"
r-cmd-stable:
if: github.event_name != 'push'
name: R CMD Check (stable) 🧬
uses: insightsengineering/r.pkg.template/.github/workflows/build-check-install.yaml@main
secrets:
REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
with:
install-deps-from-package-repositories: "R-universe=https://insightsengineering.r-universe.dev/,CRAN=https://cloud.r-project.org/"
package-subdirectory: package
additional-env-vars: |
NOT_CRAN=true
QUARTO_PROFILE=stable
TLG_CATALOG_PKG_BUILD_RENDER=TRUE
concurrency-group: stable
deps-installation-method: setup-r-dependencies
skip-desc-dev: true
skip-desc-branch: true
repository-list: "r-universe-stable=https://insightsengineering.r-universe.dev/, PPM=PPM@latest"
cache-version: "stable"
linter:
if: github.event_name != 'push'
name: SuperLinter 🦸‍♀️
Expand Down
43 changes: 24 additions & 19 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ jobs:
uses: actions/cache@v4
with:
path: |
~/package/.staged.dependencies
book/_freeze
key: ${{ runner.os }}-tlg-catalog-dev

Expand All @@ -70,14 +69,16 @@ jobs:
echo "gchat_webhook=${{ secrets.GCHAT_WEBHOOK }}" >> $GITHUB_ENV
shell: bash

- name: Run Staged dependencies 🎦
uses: insightsengineering/staged-dependencies-action@v1
- name: Setup R dependencies 🎦
uses: insightsengineering/setup-r-dependencies@v1
env:
GITHUB_PAT: ${{ secrets.REPO_GITHUB_TOKEN }}
GITHUB_PAT: ${{ steps.github-token.outputs.token }}
with:
path: "./package"
enable-check: false
direction: upstream
repository-path: "./package"
skip-desc-branch: true
skip-desc-dev: true
repository-list: "r-universe-dev=https://pharmaverse.r-universe.dev/, PPM=PPM@latest"
cache-version: "dev"

- name: Render catalog 🖨
run: |
Expand All @@ -98,7 +99,7 @@ jobs:
with:
name: site-development
path: site.zip

- name: Remove large WebR assets 🧹
run: |
packages_path <- sprintf("./book/_site/site_libs/quarto-contrib/shinylive-%s/shinylive/webr/packages", shinylive::assets_version())
Expand All @@ -112,12 +113,12 @@ jobs:
unlink(x, recursive = TRUE)
}
}
# refresh the `metadata.rds` file
metadata_path <- file.path(packages_path, "metadata.rds")
metadata <- readRDS(metadata_path)
new_metadata <- metadata[intersect(names(metadata), list.dirs(packages_path, full.names = FALSE))]
saveRDS(new_metadata, metadata_path)
saveRDS(new_metadata, metadata_path)
shell: Rscript {0}

- name: Publish docs 📔
Expand Down Expand Up @@ -161,11 +162,16 @@ jobs:
echo "gchat_webhook=${{ secrets.GCHAT_WEBHOOK }}" >> $GITHUB_ENV
shell: bash

- name: Install packages 🎦
run: |
devtools::install_dev_deps(".", repos = c("https://insightsengineering.r-universe.dev/", "https://cloud.r-project.org/"))
shell: Rscript {0}
working-directory: package
- name: Setup R dependencies 🎦
uses: insightsengineering/setup-r-dependencies@v1
env:
GITHUB_PAT: ${{ steps.github-token.outputs.token }}
with:
repository-path: "./package"
skip-desc-branch: true
skip-desc-dev: true
repository-list: "r-universe-stable=https://insightsengineering.r-universe.dev/, PPM=PPM@latest"
cache-version: "stable"

- name: Render catalog 🖨
run: |
Expand All @@ -179,7 +185,7 @@ jobs:
zip -r9 ../../site.zip *
shell: bash
working-directory: book/_site

- name: Remove large WebR assets 🧹
run: |
packages_path <- sprintf("./book/_site/site_libs/quarto-contrib/shinylive-%s/shinylive/webr/packages", shinylive::assets_version())
Expand All @@ -193,15 +199,14 @@ jobs:
unlink(x, recursive = TRUE)
}
}
# refresh the `metadata.rds` file
metadata_path <- file.path(packages_path, "metadata.rds")
metadata <- readRDS(metadata_path)
new_metadata <- metadata[intersect(names(metadata), list.dirs(packages_path, full.names = FALSE))]
saveRDS(new_metadata, metadata_path)
saveRDS(new_metadata, metadata_path)
shell: Rscript {0}


- name: Upload docs ⬆
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v4
Expand Down
4 changes: 2 additions & 2 deletions book/_extensions/coatless/webr/_extension.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: webr
title: Embedded webr code cells
author: James Joseph Balamuta
version: 0.4.2-dev.3
quarto-required: ">=1.2.198"
version: 0.4.3-dev.2
quarto-required: ">=1.4.554"
contributes:
filters:
- webr.lua
4 changes: 4 additions & 0 deletions book/_extensions/coatless/webr/qwebr-cell-initialization.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ qwebrInstance.then(
break;
case 'setup':
const activeDiv = document.getElementById(`qwebr-noninteractive-setup-area-${qwebrCounter}`);

// Store code in history
qwebrLogCodeToHistory(cellCode, entry.options);

// Run the code in a non-interactive state with all output thrown away
await mainWebR.evalRVoid(`${cellCode}`);
break;
Expand Down
Loading

0 comments on commit 7c6fc3c

Please sign in to comment.