-
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
Add macro do_drat()
#221
Merged
Add macro do_drat()
#221
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
fb16d42
first do_drat() try
pat-s 43952e8
require full repo slug
pat-s ff245db
fix ci_can_push()
pat-s 6a2583e
fix repo argument
pat-s d599bcd
use git/drat as the path arg default
pat-s 03c8917
always deploy
pat-s 3006dc5
clean add_to_drat()
pat-s c1aad3e
merge origin/master
pat-s 7ce717a
do not deploy dev versions
pat-s ef853b4
import desc pkg
pat-s a98eca2
try without usethis::proj_get()
pat-s 5f9cf13
no wrap
pat-s 2eb44ab
add deployment instruction for appveyor
pat-s a28680f
merge master
pat-s 81439e4
update vignette
pat-s 832bf47
remove ...
pat-s 7fb670e
give hint how to name env var
pat-s a5d1c1c
move macro checks and args to step_add_to_drat
pat-s f6613f5
clean NAMESPACE
pat-s c8ca8d7
donttest example
pat-s 567bb76
fix deploy_dev
pat-s 1714e5e
move deployment checks to `step_add_to_drat()`
pat-s d3e7e00
ups
pat-s 0d4f695
merge origin/master
pat-s 67864df
debug
pat-s 983732e
debug
pat-s 6068a1c
document
pat-s b685f85
be more verbose
pat-s 8430f15
try reverting step_install_ssh_key()() change
pat-s 80bcb57
clean
pat-s 826ba29
try
pat-s 4e422ad
Merge branch 'master' into do-drat
pat-s dbe32f2
add troubleshooting vignette
pat-s f1434ca
debug
pat-s 1f68799
debug
pat-s 190aa97
debug
pat-s 63771ac
debug
pat-s 50f5df4
solved it!
pat-s 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#' do_drat | ||
#' | ||
#' The [do_drat()] macro adds the necessary steps for building | ||
#' and deploying a drat repository to host R package sources. | ||
#' | ||
#' @include macro.R | ||
#' @include macro-package-checks.R | ||
#' @name macro | ||
NULL | ||
|
||
#' Build and deploy drat repository | ||
#' | ||
#' @description | ||
#' `do_drat()` builds and deploys R packages to a drat repository and adds | ||
#' default steps to the `"install"`, `"before_deploy"` and `"deploy"` stages: | ||
#' | ||
#' @inheritParams step_add_to_drat | ||
#' @inheritParams step_setup_ssh | ||
#' @inheritParams step_setup_push_deploy | ||
#' @inheritParams step_do_push_deploy | ||
#' @param path,branch By default, this macro deploys the `"master"` branch | ||
#' of the drat repository. An alternative option is `"gh-pages"`. | ||
#' @param ssh_key_name `string`\cr | ||
#' The name of the private SSH key which should be used for deployment to the | ||
#' drat repo. | ||
#' | ||
#' @section Deployment: Deployment can only happen to the `master` or | ||
#' `gh-pages` branch because the Github Pages functionality from Github is | ||
#' used to access the drat repository later on. You need to enable this | ||
#' functionality when creating the drat repository on Github via `Settings -> | ||
#' Github pages` and set it to the chosen setting here. | ||
#' | ||
#' To build and deploy Windows binaries, builds on Travis CI with deployment | ||
#' permissions need to be triggered. To build and deploy macOS binaries, | ||
#' builds on Travis CI with deployment permissions need to be triggered. Have | ||
#' a look at \url{https://docs.ropensci.org/tic/articles/deployment.html} for | ||
#' more information and instructions. | ||
#' @family macros | ||
#' @export | ||
#' @examples | ||
#' dsl_init() | ||
#' | ||
#' do_drat() | ||
#' | ||
#' dsl_get() | ||
do_drat <- function(repo_slug = NULL, | ||
orphan = FALSE, | ||
checkout = TRUE, | ||
path = "~/git/drat", | ||
branch = "master", | ||
remote_url = NULL, | ||
commit_message = NULL, | ||
commit_paths = ".", | ||
ssh_key_name = "id_rsa", | ||
deploy_dev = FALSE) { | ||
|
||
#' @description | ||
#' 1. [step_setup_ssh()] in the `"before_deploy"` to setup | ||
#' the upcoming deployment | ||
get_stage("before_deploy") %>% | ||
add_step(step_setup_ssh(name = ssh_key_name)) | ||
|
||
#' 1. [step_setup_push_deploy()] in the `"before_deploy"` stage | ||
#' (if `deploy` is set), | ||
get_stage("before_deploy") %>% | ||
add_step(step_setup_push_deploy( | ||
path = !!enquo(path), | ||
branch = !!enquo(branch), | ||
remote_url = paste0("git@github.com:", repo_slug, ".git"), | ||
orphan = !!enquo(orphan), | ||
checkout = !!enquo(checkout) | ||
)) | ||
|
||
#' 1. [step_add_to_drat()] in the `"deploy"` | ||
get_stage("deploy") %>% | ||
add_step(step_add_to_drat( | ||
repo_slug = repo_slug, deploy_dev = deploy_dev | ||
)) | ||
|
||
#' 1. [step_do_push_deploy()] in the `"deploy"` stage. | ||
get_stage("deploy") %>% | ||
add_step(step_do_push_deploy( | ||
path = !!enquo(path), | ||
commit_message = !!enquo(commit_message), | ||
commit_paths = !!enquo(commit_paths) | ||
)) | ||
|
||
dsl_get() | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 still the correct default?
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.
In this case yes. We have to manually insert the private secured key in
appveyor.yml
and I think inserting it with "TRAVIS_DEPLOY_KEY" would be misleading.Since "id_rsa" is supported universally, I choose to go with it here.
Keys on Appveyor needs to be manually created anyway until now. We could change the name once we have an Appveyor client pkg.
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.
I wouldn't mind reverting to
"id_rsa"
, this would save lots of downstream pain.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.
Hm, I know. One reason of the whole effort was to ensure that differently named private SSH key works throughout all functions, especially when installing the key. This came from the motivation to decouple
travis::use_travis_deploy()
from {tic}. I know that this does not mean that the default needs to change necessarily - but having a different one is an indirect way to save the tests whether a custom name would also work 😅Also I still think that some non-tech users will have an easier life understanding what that env var is about.
However, I see that we complicate things (a bit) since
id_rsa
is the canonical default picked up everywhere.Argh, I don't know what's best 🤔