Skip to content

Commit bee2725

Browse files
hadleyjennybc
andauthored
Custom RStudio release bullets (#1513)
* No need to specify save_as here * Custom RStudio release bullets Fixes #1511 * Also use GitHub org to detect RStudio-ness * Rescue actual changes lost in weird rebase * Split these out so I can use them separately * More recovering from the bad rebase * Work on tests Co-authored-by: Jenny Bryan <[email protected]>
1 parent fb15c4b commit bee2725

File tree

5 files changed

+104
-18
lines changed

5 files changed

+104
-18
lines changed

R/release.R

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ release_checklist <- function(version, on_cran) {
6262
has_news <- file_exists(proj_path("NEWS.md"))
6363
has_pkgdown <- uses_pkgdown()
6464
has_readme <- file_exists(proj_path("README.Rmd"))
65+
is_rstudio_pkg <- is_rstudio_pkg()
6566

6667
c(
6768
if (!on_cran) c(
@@ -87,10 +88,12 @@ release_checklist <- function(version, on_cran) {
8788
todo("`rhub::check_for_cran()`"),
8889
todo("`rhub::check(platform = 'ubuntu-rchk')`", has_src),
8990
todo("`rhub::check_with_sanitizers()`", has_src),
90-
todo("`revdepcheck::revdep_check(num_workers = 4)`", on_cran),
91+
todo("`revdepcheck::revdep_check(num_workers = 4)`", on_cran && !is_rstudio_pkg),
92+
todo("`revdepcheck::cloud_check()`", on_cran && is_rstudio_pkg),
9193
todo("Update `cran-comments.md`", on_cran),
9294
todo("Review pkgdown reference index for, e.g., missing topics", has_pkgdown && type != "patch"),
9395
todo("Draft blog post", type != "patch"),
96+
todo("Ping Tracy Teal on Slack", type != "patch" && is_rstudio_pkg),
9497
release_extra(),
9598
"",
9699
"Submit to CRAN:",
@@ -332,6 +335,38 @@ news_latest <- function(lines) {
332335
paste0(news, "\n", collapse = "")
333336
}
334337

338+
is_rstudio_pkg <- function() {
339+
is_rstudio_funded() || is_in_rstudio_org()
340+
}
341+
342+
is_rstudio_funded <- function() {
343+
if (!is_package()) {
344+
return(FALSE)
345+
}
346+
desc <- desc::desc(file = proj_get())
347+
funders <- unclass(desc$get_author("fnd"))
348+
purrr::some(funders, ~ .x$given == "RStudio")
349+
}
350+
351+
is_in_rstudio_org <- function() {
352+
if (!is_package()) {
353+
return(FALSE)
354+
}
355+
desc <- desc::desc(file = proj_get())
356+
urls <- desc$get_urls()
357+
dat <- parse_github_remotes(urls)
358+
dat <- dat[dat$host == "github.com", ]
359+
purrr::some(dat$repo_owner, ~ .x %in% rstudio_orgs())
360+
}
361+
362+
rstudio_orgs <- function() {
363+
c(
364+
"tidyverse",
365+
"r-lib",
366+
"tidymodels"
367+
)
368+
}
369+
335370
todo <- function(x, cond = TRUE) {
336371
x <- glue(x, .envir = parent.frame())
337372
if (cond) {

tests/testthat/_snaps/release.md

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# release bullets don't change accidentally
22

33
Code
4-
cat(release_checklist("0.1.0", on_cran = FALSE), sep = "\n")
4+
writeLines(release_checklist("0.1.0", on_cran = FALSE))
55
Output
66
First release:
77
@@ -40,11 +40,11 @@
4040
---
4141

4242
Code
43-
cat(release_checklist("0.0.1", on_cran = TRUE), sep = "\n")
43+
writeLines(release_checklist("0.0.1", on_cran = TRUE))
4444
Output
4545
Prepare for release:
4646
47-
* [ ] Check [current CRAN check results](https://cran.rstudio.org/web/checks/check_results_releasebullets.html)
47+
* [ ] Check [current CRAN check results](https://cran.rstudio.org/web/checks/check_results_{TESTPKG}.html)
4848
* [ ] [Polish NEWS](https://style.tidyverse.org/news.html#news-release)
4949
* [ ] `urlchecker::url_check()`
5050
* [ ] `devtools::check(remote = TRUE, manual = TRUE)`
@@ -69,11 +69,11 @@
6969
---
7070

7171
Code
72-
cat(release_checklist("1.0.0", on_cran = TRUE), sep = "\n")
72+
writeLines(release_checklist("1.0.0", on_cran = TRUE))
7373
Output
7474
Prepare for release:
7575
76-
* [ ] Check [current CRAN check results](https://cran.rstudio.org/web/checks/check_results_releasebullets.html)
76+
* [ ] Check [current CRAN check results](https://cran.rstudio.org/web/checks/check_results_{TESTPKG}.html)
7777
* [ ] [Polish NEWS](https://style.tidyverse.org/news.html#news-release)
7878
* [ ] `urlchecker::url_check()`
7979
* [ ] `devtools::check(remote = TRUE, manual = TRUE)`
@@ -99,3 +99,37 @@
9999
* [ ] Tweet
100100
* [ ] Add link to blog post in pkgdown news menu
101101

102+
# RStudio-ness detection works
103+
104+
Code
105+
writeLines(release_checklist("1.0.0", on_cran = TRUE))
106+
Output
107+
Prepare for release:
108+
109+
* [ ] Check [current CRAN check results](https://cran.rstudio.org/web/checks/check_results_{TESTPKG}.html)
110+
* [ ] [Polish NEWS](https://style.tidyverse.org/news.html#news-release)
111+
* [ ] `urlchecker::url_check()`
112+
* [ ] `devtools::check(remote = TRUE, manual = TRUE)`
113+
* [ ] `devtools::check_win_devel()`
114+
* [ ] `rhub::check_for_cran()`
115+
* [ ] `revdepcheck::cloud_check()`
116+
* [ ] Update `cran-comments.md`
117+
* [ ] Draft blog post
118+
* [ ] Ping Tracy Teal on Slack
119+
120+
Submit to CRAN:
121+
122+
* [ ] `usethis::use_version('major')`
123+
* [ ] `devtools::submit_cran()`
124+
* [ ] Approve email
125+
126+
Wait for CRAN...
127+
128+
* [ ] Accepted :tada:
129+
* [ ] `usethis::use_github_release()`
130+
* [ ] `usethis::use_dev_version()`
131+
* [ ] `usethis::use_news_md()`
132+
* [ ] Finish blog post
133+
* [ ] Tweet
134+
* [ ] Add link to blog post in pkgdown news menu
135+

tests/testthat/_snaps/tidy-upkeep.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# upkeep bullets don't change accidentally
22

33
Code
4-
cat(upkeep_checklist(), sep = "\n")
4+
writeLines(upkeep_checklist())
55
Output
66
Pre-history
77

tests/testthat/test-release.R

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,24 @@
22
# release bullets ---------------------------------------------------------
33

44
test_that("release bullets don't change accidentally", {
5-
# Avoid finding any files in real usethis project
6-
# Take care to only change active project, but not working directory
7-
# Temporary project name must be stable
8-
tmpproj <- dir_create(path_temp("releasebullets"))
9-
withr::defer(dir_delete(tmpproj))
10-
file_create(path(tmpproj, ".here"))
11-
local_project(tmpproj, setwd = FALSE)
5+
create_local_package()
126

137
# First release
148
expect_snapshot(
15-
cat(release_checklist("0.1.0", on_cran = FALSE), sep = "\n")
9+
writeLines(release_checklist("0.1.0", on_cran = FALSE)),
10+
transform = scrub_testpkg
1611
)
1712

1813
# Patch release
1914
expect_snapshot(
20-
cat(release_checklist("0.0.1", on_cran = TRUE), sep = "\n")
15+
writeLines(release_checklist("0.0.1", on_cran = TRUE)),
16+
transform = scrub_testpkg
2117
)
2218

2319
# Major release
2420
expect_snapshot(
25-
cat(release_checklist("1.0.0", on_cran = TRUE), sep = "\n")
21+
writeLines(release_checklist("1.0.0", on_cran = TRUE)),
22+
transform = scrub_testpkg
2623
)
2724
})
2825

@@ -37,6 +34,26 @@ test_that("get extra news bullets if available", {
3734
expect_equal(release_extra(env), character())
3835
})
3936

37+
test_that("RStudio-ness detection works", {
38+
create_local_package()
39+
40+
expect_false(is_rstudio_funded())
41+
expect_false(is_in_rstudio_org())
42+
43+
desc <- desc::desc(file = proj_get())
44+
desc$add_author(given = "RStudio", role = "fnd")
45+
desc$add_urls("https://github.com/tidyverse/WHATEVER")
46+
desc$write()
47+
48+
expect_true(is_rstudio_funded())
49+
expect_true(is_in_rstudio_org())
50+
51+
expect_snapshot(
52+
writeLines(release_checklist("1.0.0", on_cran = TRUE)),
53+
transform = scrub_testpkg
54+
)
55+
})
56+
4057
# news --------------------------------------------------------------------
4158

4259
test_that("must have at least one heading", {

tests/testthat/test-tidy-upkeep.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
test_that("upkeep bullets don't change accidentally", {
2-
expect_snapshot(cat(upkeep_checklist(), sep = "\n"))
2+
expect_snapshot(writeLines(upkeep_checklist()))
33
})

0 commit comments

Comments
 (0)