-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from wlandau/staging-freeze
Staging universe freezes and timing
- Loading branch information
Showing
21 changed files
with
225 additions
and
94 deletions.
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
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,37 @@ | ||
#' @title Check if the stating universe is active. | ||
#' @export | ||
#' @family staging | ||
#' @description Check if the stating universe is active. | ||
#' @return `TRUE` if the staging universe is active, `FALSE` otherwise. | ||
#' @param start Character vector of `"%m-%d"` dates that the | ||
#' staging universe becomes active. Staging will then last for a full | ||
#' calendar month. For example, if you supply a start date of `"01-15"`, | ||
#' then the staging period will include all days from `"01-15"` | ||
#' through `"02-14"` and not include `"02-15"`. | ||
#' @param today Character string with today's date in `"%Y-%m-%d"` format or an | ||
#' object convertible to POSIXlt format. | ||
#' @examples | ||
#' staging_is_active() | ||
staging_is_active <- function( | ||
start = c("01-15", "04-15", "07-15", "10-15"), | ||
today = Sys.Date() | ||
) { | ||
today <- as.POSIXlt(today, tz = "UTC") | ||
start <- strsplit(start, split = "-", fixed = TRUE) | ||
start <- lapply(start, as.integer) | ||
within <- lapply(start, within_staging, today = today) | ||
any(as.logical(within)) | ||
} | ||
|
||
within_staging <- function(start, today) { | ||
month <- today$mon + 1L | ||
day <- today$mday | ||
if (start[1L] > 28L) { | ||
stop( | ||
"a staging start date cannot be later than day 28 of the given month.", | ||
call. = FALSE | ||
) | ||
} | ||
(month == start[1L] && day >= start[2L]) || | ||
(month == start[1L] + 1L && day < start[2L]) | ||
} |
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 |
---|---|---|
|
@@ -26,3 +26,4 @@ reference: | |
- title: Staging | ||
contents: | ||
- update_staging | ||
- staging_is_active |
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 |
---|---|---|
|
@@ -5,3 +5,4 @@ json | |
repo | ||
pkgdown | ||
pre | ||
POSIXlt |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,32 +1,17 @@ | ||
[ | ||
{ | ||
"package": "promote", | ||
"url": "https://github.com/owner/promote", | ||
"package": "add", | ||
"url": "https://github.com/owner/add", | ||
"branch": "*release" | ||
}, | ||
{ | ||
"package": "change", | ||
"url": "https://github.com/owner/change", | ||
"package": "freeze", | ||
"url": "https://github.com/owner/freeze", | ||
"branch": "*release" | ||
}, | ||
{ | ||
"package": "keep", | ||
"url": "https://github.com/owner/keep", | ||
"branch": "*release" | ||
}, | ||
{ | ||
"package": "checks", | ||
"url": "https://github.com/owner/checks", | ||
"branch": "*release" | ||
}, | ||
{ | ||
"package": "descriptions", | ||
"url": "https://github.com/owner/descriptions", | ||
"branch": "*release" | ||
}, | ||
{ | ||
"package": "versions", | ||
"url": "https://github.com/owner/versions", | ||
"package": "issue", | ||
"url": "https://github.com/owner/issue", | ||
"branch": "*release" | ||
} | ||
] |
File renamed without changes.
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,13 @@ | ||
{ | ||
"checks": { | ||
"_linuxdevel": ["success"], | ||
"_macbinary": ["success"], | ||
"_wasmbinary": ["none"], | ||
"_winbinary": ["success"], | ||
"_status": ["success"], | ||
"_buildurl": ["https://github.com/r-universe/r-multiverse/actions/runs/12345"] | ||
}, | ||
"date": ["1980-01-01"], | ||
"version": ["2.0.2"], | ||
"remote_hash": ["abcdef1234567890abcdef"] | ||
} |
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 |
---|---|---|
@@ -1,12 +1,22 @@ | ||
[ | ||
{ | ||
"package": "change", | ||
"url": "https://github.com/owner/change", | ||
"package": "freeze", | ||
"url": "https://github.com/owner/freeze", | ||
"branch": "original" | ||
}, | ||
{ | ||
"package": "keep", | ||
"url": "https://github.com/owner/keep", | ||
"branch": "sha-keep" | ||
"package": "issue", | ||
"url": "https://github.com/owner/issue", | ||
"branch": "original" | ||
}, | ||
{ | ||
"package": "removed-has-issue", | ||
"url": "https://github.com/owner/removed-has-issue", | ||
"branch": "original" | ||
}, | ||
{ | ||
"package": "removed-no-issue", | ||
"url": "https://github.com/owner/removed-no-issue", | ||
"branch": "original" | ||
} | ||
] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,43 @@ | ||
test_that("staging_is_active()", { | ||
start <- c("01-15", "04-15", "07-15", "10-15") | ||
active <- c( | ||
"2024-01-15", | ||
"2024-01-16", | ||
"2024-02-13", | ||
"2024-04-15", | ||
"2024-04-25", | ||
"2024-05-14", | ||
"2024-07-15", | ||
"2024-08-12", | ||
"2024-08-13", | ||
"2024-10-15", | ||
"2024-11-01", | ||
"2024-11-13" | ||
) | ||
for (today in active) { | ||
expect_true( | ||
staging_is_active( | ||
start = start, | ||
today = today | ||
) | ||
) | ||
} | ||
inactive <- c( | ||
"2024-01-12", | ||
"2024-02-15", | ||
"2024-04-14", | ||
"2024-05-15", | ||
"2024-07-12", | ||
"2024-08-15", | ||
"2024-10-14", | ||
"2024-11-15" | ||
) | ||
for (today in inactive) { | ||
expect_false( | ||
staging_is_active( | ||
start = start, | ||
today = today | ||
) | ||
) | ||
} | ||
}) |
Oops, something went wrong.