diff --git a/DESCRIPTION b/DESCRIPTION index f42b5daa..ef6d0bc5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -23,7 +23,7 @@ Suggests: testthat VignetteBuilder: knitr -Config/fusen/version: 0.5.1 +Config/fusen/version: 0.5.2 Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) diff --git a/R/nix_github_actions.R b/R/nix_github_actions.R deleted file mode 100644 index d443f0d4..00000000 --- a/R/nix_github_actions.R +++ /dev/null @@ -1,17 +0,0 @@ -# WARNING - Generated by {fusen} from dev/cicd.Rmd: do not edit by hand - -#' nix_github_actions -#' @return Nothing, copies file to a diretory. -#' -#' @noRd -nix_github_actions <- function(){ - path <- file.path(".github", "workflows") - dir.create(path) - source <- system.file( - file.path("extdata", "run-pipeline.yaml"), - package = "rix", - mustWork = TRUE - ) - file.copy(source, path, overwrite = TRUE) - invisible() -} diff --git a/R/tar_nix_ga.R b/R/tar_nix_ga.R new file mode 100644 index 00000000..2190ff08 --- /dev/null +++ b/R/tar_nix_ga.R @@ -0,0 +1,31 @@ +# WARNING - Generated by {fusen} from dev/cicd.Rmd: do not edit by hand + +#' tar_nix_ga Run a {targets} pipeline on Github Actions. +#' @details This function puts a `.yaml` file inside the `.github/workflows/` +#' folders on the root of your project. This workflow file will use the +#' projects `default.nix` file to generate the development environment on +#' Github Actions and will then run the projects {targets} pipeline. Make +#' sure to give read and write permissions to the Github Actions bot. +#' @return Nothing, copies file to a diretory. +#' +#' @noRd +tar_nix_ga <- function(){ + # Add an empty .gitignore file if there isn’t any + + if(file.exists(".gitignore")){ + NULL + } else { + file.create(".gitignore") + } + + path <- ".github/workflows" + + dir.create(path, recursive = TRUE) + source <- system.file( + file.path("extdata", "run-pipeline.yaml"), + package = "rix", + mustWork = TRUE + ) + file.copy(source, path, overwrite = TRUE) + invisible() +} diff --git a/dev/0-dev_history.Rmd b/dev/0-dev_history.Rmd index 4c9017e8..d0fbe247 100755 --- a/dev/0-dev_history.Rmd +++ b/dev/0-dev_history.Rmd @@ -97,6 +97,12 @@ fusen::inflate(flat_file = "dev/build_envs.Rmd", overwrite = TRUE) ``` +```{r} +fusen::inflate(flat_file = "dev/cicd.Rmd", + vignette_name = NA, + overwrite = TRUE) +``` + ```{r} fusen::inflate(flat_file = "dev/zzz.Rmd", diff --git a/dev/cicd.Rmd b/dev/cicd.Rmd index 8979a182..9d02e2c9 100644 --- a/dev/cicd.Rmd +++ b/dev/cicd.Rmd @@ -1,5 +1,5 @@ --- -title: "Run targets pipelines on Github Actions" +title: "Functions for Github Actions CI/CD service" output: html_document editor_options: chunk_output_type: console @@ -21,8 +21,13 @@ pkgload::load_all(export_all = FALSE) The function below copies a Github actions workflow file into the `.github/workflows/run-pipeline.yaml`: -```{r function-nix_github_actions} -#' tar_nix_ga +```{r function-tar_nix_ga} +#' tar_nix_ga Run a {targets} pipeline on Github Actions. +#' @details This function puts a `.yaml` file inside the `.github/workflows/` +#' folders on the root of your project. This workflow file will use the +#' projects `default.nix` file to generate the development environment on +#' Github Actions and will then run the projects {targets} pipeline. Make +#' sure to give read and write permissions to the Github Actions bot. #' @return Nothing, copies file to a diretory. #' tar_nix_ga <- function(){ @@ -34,7 +39,9 @@ tar_nix_ga <- function(){ file.create(".gitignore") } - dir.create(".github/workflows", recursive = TRUE) + path <- ".github/workflows" + + dir.create(path, recursive = TRUE) source <- system.file( file.path("extdata", "run-pipeline.yaml"), package = "rix", diff --git a/dev/config_fusen.yaml b/dev/config_fusen.yaml index c6d431ad..9746333f 100644 --- a/dev/config_fusen.yaml +++ b/dev/config_fusen.yaml @@ -27,7 +27,7 @@ building_envs_with_rix.Rmd: cicd.Rmd: path: dev/cicd.Rmd state: active - R: R/nix_github_actions.R + R: R/tar_nix_ga.R tests: [] vignettes: [] inflate: