Skip to content
Snippets Groups Projects
Commit b2ba57c1 authored by David Dorchies's avatar David Dorchies
Browse files

feat(create_fairify): provide .gitlab-ci.yml

Fix #20
parent addd6aee
No related branches found
No related tags found
No related merge requests found
Pipeline #175175 failed
......@@ -8,7 +8,7 @@
#' @param cloud If `TRUE`, copy fairify functions for cloud capabilities
#' @param git if `TRUE`, initialise a Git repository
#' @param pkgdown if `TRUE`, initialise a pkgdown web site (See [usethis::use_pkgdown])
#' @param destdir Target directory for pkgdown website and reports
#' @param destdir Target directory for generated pkgdown website and reports
#' @param ... Further parameters passed to [usethis::create_package]
#'
#' @return Use for side effect.
......@@ -49,6 +49,7 @@ create_fairify <-
if (git) {
gert::git_init(path)
add_gitignore(path)
file.copy(pkg_sys(".gitlab-ci.yml"), path)
}
if (reports) create_reports(path = path, git = git)
......
......@@ -9,20 +9,19 @@
update_fairify <- function(path = ".") {
path <- pkgload::pkg_path(path)
b <- file.copy(
from = list.files(system.file("functions", package = "fairify"), full.names = TRUE),
from = list.files(pkg_sys("functions"), full.names = TRUE),
to = file.path(path, "R"),
overwrite = TRUE
)
if (any(!b)) {
stop("Error during the copy of fairify functions")
}
to = file.path(path, "inst")
if (file.exists(file.path(path, "inst", "config.yml"))) {
warning("config.yml already exists in the target project")
} else {
dir.create(file.path(path, "inst"), showWarnings = FALSE)
b <- file.copy(
from = system.file("config.yml", package = "fairify"),
from = pkg_sys("config.yml"),
to = file.path(path, "inst", "config.yml")
)
if (any(!b)) {
......
stages:
- checks
- deploy
default:
tags: [docker]
image: rocker/geospatial:latest
variables:
CACHE_CI: "$CI_PROJECT_DIR/ci"
R_LIBS_USER: "$CACHE_CI/lib"
cache:
paths:
- $CACHE_CI
before_script:
- mkdir -p $R_LIBS_USER
- echo "R_LIBS='$R_LIBS_USER'" > .Renviron
- R -q -e 'if (!require(remotes)) install.packages("remotes")'
- R -q -e 'remotes::install_deps(dep = T)'
pages:
stage: deploy
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
script:
- R -q -e 'fairify::build_site()'
artifacts:
paths:
- public
......@@ -42,7 +42,7 @@ error if not.}
\item{pkgdown}{if \code{TRUE}, initialise a pkgdown web site (See \link[usethis:use_pkgdown]{usethis::use_pkgdown})}
\item{destdir}{Target directory for pkgdown website and reports}
\item{destdir}{Target directory for generated pkgdown website and reports}
\item{fields}{A named list of fields to add to \code{DESCRIPTION}, potentially
overriding default values. See \code{\link[usethis:use_description]{use_description()}} for how you can set
......
......@@ -4,6 +4,7 @@ test_that("create_fairify works", {
expect_true(file.exists(file.path(path, paste0(project, ".Rproj"))))
expect_true(dir.exists(file.path(path, ".git")))
expect_true(file.exists(file.path(path, ".gitignore")))
expect_true(file.exists(file.path(path, ".gitlab-ci.yml")))
expect_true(dir.exists(file.path(path, "R")))
expect_warning(update_fairify(path))
unlink(path, recursive = TRUE)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment