Skip to content

Commit

Permalink
App Push Test (main@92194ee7)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilzyla committed Dec 8, 2023
0 parents commit 043e2a8
Show file tree
Hide file tree
Showing 24 changed files with 2,414 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .Rprofile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
if (file.exists("renv")) {
source("renv/activate.R")
} else {
# The `renv` directory is automatically skipped when deploying with rsconnect.
message("No 'renv' directory found; renv won't be activated.")
}

# Allow absolute module imports (relative to the app root).
options(box.path = getwd())
86 changes: 86 additions & 0 deletions .github/workflows/rhino-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Rhino Test
on: push
permissions:
contents: read
jobs:
main:
name: Run linters and tests
runs-on: ubuntu-20.04
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Extract R version from lockfile
run: printf 'R_VERSION=%s\n' "$(jq --raw-output .R.Version renv.lock)" >> $GITHUB_ENV

- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ env.R_VERSION }}

- name: Setup system dependencies
run: >
sudo apt-get update && sudo apt-get install --yes
libcurl4-openssl-dev
- name: Restore renv from cache
uses: actions/cache@v2
env:
CACHE_KEY: renv-${{ runner.arch }}-${{ runner.os }}-${{ env.R_VERSION }}
with:
path: renv/library
key: ${{ env.CACHE_KEY }}-${{ hashFiles('renv.lock') }}
restore-keys: ${{ env.CACHE_KEY }}-

- name: Sync renv with lockfile
shell: Rscript {0}
run: |
options(renv.config.cache.symlinks = FALSE)
renv::restore(clean = TRUE)
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16

- name: Lint R
if: always()
shell: Rscript {0}
run: rhino::lint_r()

- name: Lint JavaScript
if: always()
shell: Rscript {0}
run: rhino::lint_js()

- name: Lint Sass
if: always()
shell: Rscript {0}
run: rhino::lint_sass()

- name: Build JavaScript
if: always()
shell: Rscript {0}
run: rhino::build_js()

- name: Build Sass
if: always()
shell: Rscript {0}
run: rhino::build_sass()

- name: Run R unit tests
if: always()
shell: Rscript {0}
run: rhino::test_r()

- name: Run Cypress end-to-end tests
if: always()
uses: cypress-io/github-action@v5
with:
working-directory: .rhino # Created by earlier commands which use Node.js
start: npm run run-app
project: ../tests
wait-on: 'http://localhost:3333/'
wait-on-timeout: 60
5 changes: 5 additions & 0 deletions .lintr
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
linters:
linters_with_defaults(
line_length_linter = line_length_linter(100),
object_usage_linter = NULL # Does not work with `box::use()`.
)
3 changes: 3 additions & 0 deletions .renvignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Only use `dependencies.R` to infer project dependencies.
*
!dependencies.R
7 changes: 7 additions & 0 deletions .rscignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.github
.lintr
.renvignore
.Renviron
.rhino
.rscignore
tests
2 changes: 2 additions & 0 deletions app.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Rhino / shinyApp entrypoint. Do not edit.
rhino::app()
Empty file added app/js/index.js
Empty file.
2 changes: 2 additions & 0 deletions app/logic/__init__.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Logic: application code independent from Shiny.
# https://go.appsilon.com/rhino-project-structure
25 changes: 25 additions & 0 deletions app/main.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
box::use(
shiny[bootstrapPage, div, moduleServer, NS, renderUI, tags, uiOutput],
)

#' @export
ui <- function(id) {
ns <- NS(id)
bootstrapPage(
uiOutput(ns("message"))
)
}

#' @export
server <- function(id) {
moduleServer(id, function(input, output, session) {
output$message <- renderUI({
div(
style = "display: flex; justify-content: center; align-items: center; height: 100vh;",
tags$h1(
tags$a("Check out Rhino docs!", href = "https://appsilon.github.io/rhino/")
)
)
})
})
}
Binary file added app/static/favicon.ico
Binary file not shown.
Empty file added app/styles/main.scss
Empty file.
2 changes: 2 additions & 0 deletions app/view/__init__.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# View: Shiny modules and related code.
# https://go.appsilon.com/rhino-project-structure
3 changes: 3 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
default:
rhino_log_level: !expr Sys.getenv("RHINO_LOG_LEVEL", "INFO")
rhino_log_file: !expr Sys.getenv("RHINO_LOG_FILE", NA)
2 changes: 2 additions & 0 deletions dependencies.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This file allows packrat (used by rsconnect during deployment) to pick up dependencies.
library(rhino)
Loading

0 comments on commit 043e2a8

Please sign in to comment.