Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

R Package with Shiny App with shinytest2 testing and Docker deployment workflows

License

NotificationsYou must be signed in to change notification settings

r-data-science/apptemplate1

Repository files navigation

R-CMD-checktest-coveragecodecov

Shiny App via R Package

This is a working demo of (and template for) a single shiny app fullywrapped into an R package that is complete with unit testing, codecoverage, and end-to-end shiny app testing with shinytest2.

Single-App R Package Benefits

  • All latest functions, ui/server code, and dependencies for a singleapp are accessible after installing or updating a single R package
  • All functionality of the app, including simulated user-interactions,as well as load-testing, can be included in the unit and coveragetests executed by a standard R package check
  • Workflow for automated CI/Deployment of app is simplified to that ofa standard R package. App can be deployed as a docker image as partof workflow that checks, tests, and builds the package

Additional Resources

  • To unit tests this shiny app, including simulated user actions andsnapshots, I utilize the package shinytest2 in conjuction withsnapshot expectations from package testthat
  • For additional information on how to load test shiny apps, bothlocally as well as a deployed app, see shinyloadtest for more info

For an example of a multi-app R package, seehere(LINK).

Package Structure

R/├──app-run.R........................App server/ui code + function to launch app ├──app-plots.R......................App functionality to build and save plot/data └──app-utils.R......................All other functions needed during app sessiontests/testthat/├── test-app-run.R..................End-to-end app and user-interactions tests ├── test-app-plots.R................Isolated unit testing of app plot functions├── test-app-utils.R................Isolated unit testing of other app functions├── _snaps..........................Snapshots are saved here in testing└── _tools..........................Contains helpers for debugging    ├── dl-artifacts.sh.............Download gh actions artifacts by id    └── list-artifacts.sh...........List all gh actions artifacts for repoinst/ ├── docker..........................Docker context used in CI/Deploy Workflow│   ├── Dockerfile..................Dockerfile to build image of deployed app │   └── Rprofile.site...............Copied to image on docker build└── docs    └── template.Rmd................Template Report used by app on user action.github/workflows/├── R-CMD-check.yaml................Test app via package build/check steps└── test-coverage.yaml..............Test and report coverage of app codebase

Install & Run App

In R Session

This package exports a single R function that launches the packagedshiny app:

# remotes::install_github("r-data-science/apptemplate1")apptemplate1::templateApp()

In Docker Container

To run this as a docker container, perform the following bash commands:

sudo docker pull bfatemi/apptemplate1:latestsudo docker run --name demo-app \  -p 3939:3939 --rm -dt bfatemi/apptemplate1:latest

Proprietary - Do Not Distribute

About

R Package with Shiny App with shinytest2 testing and Docker deployment workflows

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp