-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor use_tic()
#193
Merged
Merged
Refactor use_tic()
#193
Changes from 17 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
2152aab
save progress
pat-s 66169a9
save progress
pat-s 84c7d0d
update templates
pat-s 6bef175
first version of new use_tic()
pat-s 465b688
outsource to use-yaml.R
pat-s ad4389f
add circle to DESC
pat-s ae6b5d5
man
pat-s 59cf247
update vignette
pat-s 81a1d88
finish use_tic()
pat-s ed3832a
update travis yaml
pat-s ddcecb4
update badges
pat-s 5e4482a
remove after_install step
pat-s 510f185
update tic.R template
pat-s 2fa3663
remove empty line
pat-s a40b0a7
dot-travis -> travis
pat-s 385c884
export use-yaml
pat-s 57ce7a8
quiet dir.create()
pat-s 8df47ce
Merge branch 'master' into smart-use-tic
krlmlr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
#' @title Use CI YAML templates | ||
#' @description Installs YAML templates for various CI providers. | ||
#' | ||
#' @param type `[character]`\cr | ||
#' Which template to use. The string should be given following the logic | ||
#' `<provider>-<platform>-<action>`. See details for more. | ||
#' | ||
#' @section Type: | ||
#' `tic` supports a variety of different YAML templates which follow the | ||
#' `<provider>-<platform>-<action>` pattern. The first one is mandatory, the | ||
#' others are optional. | ||
#' | ||
#' * Possible values for `<provider>` are `travis`, and `circle` | ||
#' * Possible values for `<platform>` are `linux`, and `macos`, `windows`. | ||
#' * Possible values for `<action>` are `matrix` and `deploy`. | ||
#' | ||
#' Not every combinations is supported on all CI systems. | ||
#' For example, for `use_appveyor_yaml()` only `windows` and `windows-matrix` are valid. | ||
#' | ||
#' @name yaml-templates | ||
#' @export | ||
use_travis_yml <- function(type) { | ||
if (type == "linux") { | ||
template = "travis-linux.yml" | ||
} else if (type == "linux-matrix") { | ||
template = "travis-linux-matrix.yml" | ||
} else if (type == "linux-deploy") { | ||
template = "travis-linux-deploy.yml" | ||
} else if (type == "linux-deploy-matrix") { | ||
template = "travis-linux-deploy-matrix.yml" | ||
} else if (type == "macos") { | ||
template = "travis-macos.yml" | ||
} else if (type == "macos-matrix") { | ||
template = "travis-macos-matrix.yml" | ||
} else if (type == "macos-deploy") { | ||
template = "travis-macos-deploy.yml" | ||
} else if (type == "macos-deploy-matrix") { | ||
template = "travis-macos-deploy-matrix.yml" | ||
} | ||
use_tic_template( | ||
template, | ||
save_as = ".travis.yml", | ||
data = list(install_tic = double_quotes(get_install_tic_code())) | ||
) | ||
} | ||
|
||
#' @rdname yaml-templates | ||
#' @export | ||
use_appveyor_yml <- function(type) { | ||
if (type == "windows") { | ||
template = "appveyor.yml" | ||
} else if (type == "windows-matrix") { | ||
template = "appveyor-matrix.yml" | ||
} | ||
use_tic_template( | ||
template, | ||
save_as = "appveyor.yml", | ||
data = list(install_tic = get_install_tic_code()) | ||
) | ||
} | ||
|
||
#' @rdname yaml-templates | ||
#' @export | ||
use_circle_yml <- function(type) { | ||
if (type == "linux") { | ||
template = "circle.yml" | ||
} else if (type == "linux-matrix") { | ||
template = "circle-matrix.yml" | ||
} else if (type == "linux-deploy") { | ||
template = "circle-deploy.yml" | ||
} else if (type == "linux-deploy-matrix") { | ||
template = "circle-deploy-matrix.yml" | ||
} | ||
dir.create(".circleci", showWarnings = FALSE) | ||
use_tic_template( | ||
template, | ||
save_as = ".circleci/config.yml", | ||
data = list(install_tic = get_install_tic_code()) | ||
) | ||
|
||
# FIXME: upstream issue in _whisker_ pkg which cannot handle curly braces | ||
# https://github.com/edwindj/whisker/issues/20 | ||
tx <- readLines(sprintf("%s/.circleci/config.yml", usethis::proj_path())) | ||
tx2 <- gsub(pattern = "checksum", replacement = "{{ checksum", x = tx) | ||
tx2 <- gsub(pattern = '_tmp_file"', replacement = '_tmp_file" }}', x = tx2) | ||
writeLines(tx2, con=sprintf("%s/.circleci/config.yml", usethis::proj_path())) | ||
} | ||
|
||
use_tic_template <- function(template, save_as = template, open = FALSE, | ||
ignore = TRUE, data = NULL) { | ||
usethis::use_template( | ||
template, save_as, | ||
package = "tic", open = open, ignore = ignore, data = data | ||
) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This stage is not supported (anymore) by Travis. Discovered this by running the official Travis lintr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could trim it down to one file for "build", "deploy" and "meta" (matrix, libs) and cat them together when building the template. This way, we would only have to maintain three files at max per CI provider.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good.