Skip to content

Commit 123da5a

Browse files
committed
fix: use renv in gitlab ci connect deploy job
Why : - New version of connect successfully use renv to deploy apps. The downgrade to packrat is not necessary anymore. How : - Remove rsconnect.packrat option from deploy instruction in gitlab-ci.yml
1 parent 8198bea commit 123da5a

File tree

8 files changed

+63
-44
lines changed

8 files changed

+63
-44
lines changed

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: lozen
22
Title: Management tools for missions
3-
Version: 1.3.0.9000
3+
Version: 1.3.0.9001
44
Authors@R: c(
55
person("Sébastien", "Rochette", , "[email protected]", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0002-1565-9313")),
@@ -74,9 +74,9 @@ Remotes:
7474
ThinkR-open/gitlabr,
7575
ThinkR-open/testdown,
7676
ThinkR-open/thinkrtemplate
77-
Config/fusen/version: 0.5.1
77+
Config/fusen/version: 0.5.2
7878
Config/testthat/edition: 3
7979
Encoding: UTF-8
8080
LazyData: true
8181
Roxygen: list(markdown = TRUE)
82-
RoxygenNote: 7.2.3
82+
RoxygenNote: 7.3.1

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# lozen (development)
22

3+
# lozen 1.3.9001
4+
5+
- Use {renv} in gitlab ci connect deploy job
6+
37
# lozen 1.3.0
48

59
## Major

R/create_deploy_ci_stage.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ create_deploy_ci_stage <- function(
2424
stopifnot("deploy_function exist" = length(getFromNamespace(x = deploy_function, "lozen")) > 0)
2525

2626
le_call <- glue::glue(
27-
"Rscript -e 'options(rsconnect.packrat = TRUE); lozen::{deploy_function}(forceUpdate=TRUE, connect_url = Sys.getenv(\"CONNECT_URL\"),connect_user = Sys.getenv(\"CONNECT_USER\"),connect_api_token = Sys.getenv(\"CONNECT_TOKEN\"),app_name = Sys.getenv(\"APP_NAME\", unset = Sys.getenv(\"CI_PROJECT_NAME\")))'"
27+
"Rscript -e 'lozen::{deploy_function}(forceUpdate=TRUE, connect_url = Sys.getenv(\"CONNECT_URL\"),connect_user = Sys.getenv(\"CONNECT_USER\"),connect_api_token = Sys.getenv(\"CONNECT_TOKEN\"),app_name = Sys.getenv(\"APP_NAME\", unset = Sys.getenv(\"CI_PROJECT_NAME\")))'"
2828
)
2929

3030
# Create list of Connect CI parameters

dev/flat_init_gitlab_ci.Rmd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,13 +728,15 @@ create_deploy_ci_stage <- function(
728728
stopifnot("deploy_function exist" = length(getFromNamespace(x = deploy_function, "lozen")) > 0)
729729
730730
le_call <- glue::glue(
731-
"Rscript -e 'options(rsconnect.packrat = TRUE); lozen::{deploy_function}(forceUpdate=TRUE, connect_url = Sys.getenv(\"CONNECT_URL\"),connect_user = Sys.getenv(\"CONNECT_USER\"),connect_api_token = Sys.getenv(\"CONNECT_TOKEN\"),app_name = Sys.getenv(\"APP_NAME\", unset = Sys.getenv(\"CI_PROJECT_NAME\")))'"
731+
"Rscript -e 'lozen::{deploy_function}(forceUpdate=TRUE, connect_url = Sys.getenv(\"CONNECT_URL\"),connect_user = Sys.getenv(\"CONNECT_USER\"),connect_api_token = Sys.getenv(\"CONNECT_TOKEN\"),app_name = Sys.getenv(\"APP_NAME\", unset = Sys.getenv(\"CI_PROJECT_NAME\")))'"
732732
)
733733
734734
# Create list of Connect CI parameters
735735
connect_ci_list <- list(
736736
image = image,
737737
variables = list(
738+
GIT_DEPTH = 10L,
739+
REPO_NAME = "https://packagemanager.rstudio.com/all/__linux__/focal/latest",
738740
R_LIBS_USER = "ci/lib"
739741
),
740742
cache = list(

man/deploy_connect_bookdown.Rd

Lines changed: 8 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/deploy_connect_pkgdown.Rd

Lines changed: 8 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/deploy_connect_shiny.Rd

Lines changed: 8 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-use_gitlab_ci.R

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,27 @@ test_that("init_gitlab_ci works for bookdown and bookdown_output_format = lozen
2727
# Test on Gitlab : Create a bookdown and test the CI
2828
if (Sys.getenv("ALLOW_CI_TESTS_ON_GITLAB", unset = "FALSE") == "TRUE") {
2929
# Pour un template CI "bookdown"
30-
output_bookdown <- with_gitlab_project(
31-
gitlab_url = Sys.getenv("GITLAB_URL", unset = "https://gitlab.com"),
32-
namespace_id = NULL,
33-
private_token = Sys.getenv("GITLAB_TOKEN"),
34-
project_name = "bookdown.test.project",
35-
exp = {
36-
lozen::create_r_project(
37-
project_path = getwd(),
38-
type = "book",
39-
name_licence = "Bobo",
40-
type_licence = usethis::use_mit_license
41-
)
42-
lozen::use_gitlab_ci(type = "bookdown", bookdown_output_format = "lozen::paged_template")
43-
}
30+
output_bookdown <- with_gitlab_project(
31+
gitlab_url = Sys.getenv("GITLAB_URL", unset = "https://gitlab.com"),
32+
namespace_id = NULL,
33+
private_token = Sys.getenv("GITLAB_TOKEN"),
34+
project_name = "bookdown.test.project",
35+
exp = {
36+
lozen::create_r_project(
37+
project_path = getwd(),
38+
type = "book", name_licence = "Bobo", type_licence = usethis::use_mit_license
4439
)
40+
lozen::use_gitlab_ci(type = "bookdown", bookdown_output_format = "lozen::paged_template")
41+
}
42+
)
4543

4644
expect_equal(
4745
object = output_bookdown$status,
4846
expected = "success"
4947
)
5048
}
51-
})
49+
50+
})
5251

5352
test_that("init_gitlab_ci works for bookdown and bookdown_output_format = lozen::bs4_book_template", {
5453
# TODO - Remove ; allow test to pass on CI
@@ -57,28 +56,27 @@ test_that("init_gitlab_ci works for bookdown and bookdown_output_format = lozen
5756
# Test on Gitlab : Create a bookdown and test the CI
5857
if (Sys.getenv("ALLOW_CI_TESTS_ON_GITLAB", unset = "FALSE") == "TRUE") {
5958
# Pour un template CI "bookdown"
60-
output_bookdown <- with_gitlab_project(
61-
gitlab_url = Sys.getenv("GITLAB_URL", unset = "https://gitlab.com"),
62-
namespace_id = NULL,
63-
private_token = Sys.getenv("GITLAB_TOKEN"),
64-
project_name = "bookdown.test.project",
65-
exp = {
66-
lozen::create_r_project(
67-
project_path = getwd(),
68-
type = "book",
69-
name_licence = "Bobo",
70-
type_licence = usethis::use_mit_license
71-
)
72-
lozen::use_gitlab_ci(type = "bookdown", bookdown_output_format = "lozen::bs4_book_template")
73-
}
59+
output_bookdown <- with_gitlab_project(
60+
gitlab_url = Sys.getenv("GITLAB_URL", unset = "https://gitlab.com"),
61+
namespace_id = NULL,
62+
private_token = Sys.getenv("GITLAB_TOKEN"),
63+
project_name = "bookdown.test.project",
64+
exp = {
65+
lozen::create_r_project(
66+
project_path = getwd(),
67+
type = "book", name_licence = "Bobo", type_licence = usethis::use_mit_license
7468
)
69+
lozen::use_gitlab_ci(type = "bookdown", bookdown_output_format = "lozen::bs4_book_template")
70+
}
71+
)
7572

7673
expect_equal(
7774
object = output_bookdown$status,
7875
expected = "success"
7976
)
8077
}
81-
})
78+
79+
})
8280

8381

8482
test_that("init_gitlab_ci works for shiny", {

0 commit comments

Comments
 (0)