Skip to content

Commit

Permalink
- Added tar_nix_ga(), a function to run targets pipelines on Github A…
Browse files Browse the repository at this point in the history
…ctions using a Nix expression
  • Loading branch information
Bruno Rodrigues committed Oct 21, 2023
1 parent 6705024 commit b709fce
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 23 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 0 additions & 17 deletions R/nix_github_actions.R

This file was deleted.

31 changes: 31 additions & 0 deletions R/tar_nix_ga.R
Original file line number Diff line number Diff line change
@@ -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()
}
6 changes: 6 additions & 0 deletions dev/0-dev_history.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
15 changes: 11 additions & 4 deletions dev/cicd.Rmd
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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(){
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion dev/config_fusen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit b709fce

Please sign in to comment.