Skip to content

Commit e4093e9

Browse files
committed
Added CD step
1 parent 7b7cd9e commit e4093e9

14 files changed

+172
-3
lines changed

.Rbuildignore

+4
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ $run_dev.*
1010
^LICENSE\.md$
1111
^README\.Rmd$
1212
^\.github$
13+
^app\.R$
14+
^rsconnect$
15+
^\.rscignore$
16+
^deploy$

.github/workflows/workflow.yml

+11-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
33

44
# Name of the workflow
5-
name: CI-renv
6-
# Create status badge with usethis::use_github_actions_badge("ci-renv.yml")
5+
name: CI-CD-renv
6+
# Create status badge with usethis::use_github_actions_badge("ci-cd-renv.yml")
77

88
on:
99
# Triggered on push and pull request events
@@ -65,3 +65,12 @@ jobs:
6565

6666
- name: Check package
6767
uses: r-lib/actions/check-r-package@v2
68+
69+
- name: Deploy to shinyapps.io
70+
# Continuous deployment only for pushes to the main / master branch
71+
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
72+
env:
73+
SHINYAPPS_ACCOUNT: ${{ secrets.SHINYAPPS_ACCOUNT }}
74+
SHINYAPPS_TOKEN: ${{ secrets.SHINYAPPS_TOKEN }}
75+
SHINYAPPS_SECRET: ${{ secrets.SHINYAPPS_SECRET }}
76+
run: Rscript deploy/deploy-shinyapps.R

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
.httr-oauth
55
.DS_Store
66
.quarto
7+
rsconnect

.here

Whitespace-only changes.

.rscignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
renv.lock

DESCRIPTION

+2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ Imports:
88
config (>= 0.3.2),
99
golem (>= 0.4.1),
1010
graphics,
11+
pkgload,
1112
shiny (>= 1.8.1.1)
1213
Encoding: UTF-8
1314
LazyData: true
1415
RoxygenNote: 7.3.1
1516
URL: https://github.com/guidomaggioorg/shinyfaithful
1617
BugReports: https://github.com/guidomaggioorg/shinyfaithful/issues
1718
Suggests:
19+
rsconnect,
1820
spelling,
1921
testthat (>= 3.0.0)
2022
Config/testthat/edition: 3

NAMESPACE

+1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ importFrom(golem,bundle_resources)
88
importFrom(golem,favicon)
99
importFrom(golem,with_golem_options)
1010
importFrom(graphics,hist)
11+
importFrom(pkgload,load_all)
1112
importFrom(shiny,shinyApp)

R/_disable_autoload.R

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Disabling shiny autoload
2+
3+
# See ?shiny::loadSupport for more information

R/shinyfaithful-package.R

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#' @keywords internal
2+
"_PACKAGE"
3+
4+
## usethis namespace: start
5+
#' @importFrom pkgload load_all
6+
## usethis namespace: end
7+
NULL

app.R

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Launch the ShinyApp (Do not remove this comment)
2+
# To deploy, run: rsconnect::deployApp()
3+
# Or use the blue button on top of this file
4+
5+
pkgload::load_all(export_all = FALSE,helpers = FALSE,attach_testthat = FALSE)
6+
options( "golem.app.prod" = TRUE)
7+
shinyfaithful::run_app() # add parameters here (if any)

deploy/deploy-shinyapps.R

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# deploy/deploy-shinyapps.R
2+
# usethis::use_build_ignore("deploy")
3+
if (!interactive()) {
4+
rsconnect::setAccountInfo(
5+
Sys.getenv("SHINYAPPS_ACCOUNT"),
6+
Sys.getenv("SHINYAPPS_TOKEN"),
7+
Sys.getenv("SHINYAPPS_SECRET")
8+
)
9+
}
10+
# Add here any additional files/directories the app needs
11+
app_files = c(
12+
"app.R",
13+
"DESCRIPTION",
14+
"NAMESPACE",
15+
"R/",
16+
"inst/"
17+
)
18+
rsconnect::deployApp(
19+
account = "gmaggio", # not necessary
20+
appName = "FaithfulPlots", appFiles = app_files, forceUpdate = TRUE
21+
)

man/shinyfaithful-package.Rd

+23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

renv.lock

+90
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@
99
]
1010
},
1111
"Packages": {
12+
"PKI": {
13+
"Package": "PKI",
14+
"Version": "0.1-12",
15+
"Source": "Repository",
16+
"Repository": "CRAN",
17+
"Requirements": [
18+
"R",
19+
"base64enc"
20+
],
21+
"Hash": "999d7960fe5a5fd98267d0b68fd10065"
22+
},
1223
"R6": {
1324
"Package": "R6",
1425
"Version": "2.5.1",
@@ -30,6 +41,16 @@
3041
],
3142
"Hash": "e749cae40fa9ef469b6050959517453c"
3243
},
44+
"askpass": {
45+
"Package": "askpass",
46+
"Version": "1.1",
47+
"Source": "Repository",
48+
"Repository": "CRAN",
49+
"Requirements": [
50+
"sys"
51+
],
52+
"Hash": "e8a22846fff485f0be3770c2da758713"
53+
},
3354
"attempt": {
3455
"Package": "attempt",
3556
"Version": "0.3.1",
@@ -141,6 +162,16 @@
141162
],
142163
"Hash": "e8a1e41acf02548751f45c718d55aa6a"
143164
},
165+
"curl": {
166+
"Package": "curl",
167+
"Version": "5.0.1",
168+
"Source": "Repository",
169+
"Repository": "CRAN",
170+
"Requirements": [
171+
"R"
172+
],
173+
"Hash": "2118af9cb164c8d2dddc7b89eaf732d9"
174+
},
144175
"desc": {
145176
"Package": "desc",
146177
"Version": "1.4.2",
@@ -430,6 +461,28 @@
430461
],
431462
"Hash": "18e9c28c1d3ca1560ce30658b22ce104"
432463
},
464+
"openssl": {
465+
"Package": "openssl",
466+
"Version": "2.0.6",
467+
"Source": "Repository",
468+
"Repository": "CRAN",
469+
"Requirements": [
470+
"askpass"
471+
],
472+
"Hash": "0f7cd2962e3044bb940cca4f4b5cecbe"
473+
},
474+
"packrat": {
475+
"Package": "packrat",
476+
"Version": "0.9.1",
477+
"Source": "Repository",
478+
"Repository": "CRAN",
479+
"Requirements": [
480+
"R",
481+
"tools",
482+
"utils"
483+
],
484+
"Hash": "481428983c19a7c443f7ea1beff0a2de"
485+
},
433486
"pillar": {
434487
"Package": "pillar",
435488
"Version": "1.9.0",
@@ -600,6 +653,36 @@
600653
],
601654
"Hash": "1de7ab598047a87bba48434ba35d497d"
602655
},
656+
"rsconnect": {
657+
"Package": "rsconnect",
658+
"Version": "1.2.2",
659+
"Source": "Repository",
660+
"Repository": "CRAN",
661+
"Requirements": [
662+
"PKI",
663+
"R",
664+
"cli",
665+
"curl",
666+
"digest",
667+
"jsonlite",
668+
"lifecycle",
669+
"openssl",
670+
"packrat",
671+
"renv",
672+
"rlang",
673+
"rstudioapi",
674+
"tools",
675+
"yaml"
676+
],
677+
"Hash": "77e9ed1307e84cd7ca1c7fb2cd7bbfe2"
678+
},
679+
"rstudioapi": {
680+
"Package": "rstudioapi",
681+
"Version": "0.14",
682+
"Source": "Repository",
683+
"Repository": "CRAN",
684+
"Hash": "690bd2acc42a9166ce34845884459320"
685+
},
603686
"sass": {
604687
"Package": "sass",
605688
"Version": "0.4.6",
@@ -670,6 +753,13 @@
670753
],
671754
"Hash": "632e9e83d3dc774d361b9415b15642bb"
672755
},
756+
"sys": {
757+
"Package": "sys",
758+
"Version": "3.4.2",
759+
"Source": "Repository",
760+
"Repository": "CRAN",
761+
"Hash": "3a1be13d68d47a8cd0bfd74739ca1555"
762+
},
673763
"testthat": {
674764
"Package": "testthat",
675765
"Version": "3.2.1.1",

tests/testthat/test-plot_hist.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ test_that("plot_hist produces a plot", {
66
freq = TRUE)
77
expect_visible(p)
88
expect_type(p, "list")
9-
expect_s3_class(p, "histgram")
9+
expect_s3_class(p, "histogram")
1010
})

0 commit comments

Comments
 (0)