From e3c880a6be16b5fd11d5b3ab3b2ce7dc20fef325 Mon Sep 17 00:00:00 2001 From: Shiro Kuriwaki Date: Mon, 12 Apr 2021 17:13:04 -0400 Subject: [PATCH 01/22] Make dataverse example (under dontrun) more realistic --- R/get_dataverse.R | 13 +++++-------- man/get_dataverse.Rd | 13 +++++-------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/R/get_dataverse.R b/R/get_dataverse.R index 9519d78..5d1f07e 100644 --- a/R/get_dataverse.R +++ b/R/get_dataverse.R @@ -12,19 +12,16 @@ #' #' @examples #' \dontrun{ -#' # view the root dataverse for a server -#' get_dataverse(":root") -#' dataverse_contents(":root") -#' -#' Sys.setenv("DATAVERSE_SERVER" = "dataverse.harvard.edu") #' # download file from: -#' # https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/ARKOTI -#' dv <- get_dataverse("monogan") +#' # https://demo.dataverse.org/dataverse/dataverse-client-r +#' Sys.setenv("DATAVERSE_SERVER" = "demo.dataverse.org") +#' # download file from: +#' dv <- get_dataverse("dataverse-client-r") #' (contents <- dataverse_contents(dv)) #' #' # get a dataset from the dataverse #' d1 <- get_dataset(contents[[1]]) -#' f <- get_file(d1$files$id[3]) +#' f <- get_file(d1$files$id[1]) #' } #' @seealso To manage Dataverses: #' \code{\link{create_dataverse}}, diff --git a/man/get_dataverse.Rd b/man/get_dataverse.Rd index 832df18..a9a4057 100644 --- a/man/get_dataverse.Rd +++ b/man/get_dataverse.Rd @@ -50,19 +50,16 @@ Retrieve details of a Dataverse } \examples{ \dontrun{ -# view the root dataverse for a server -get_dataverse(":root") -dataverse_contents(":root") - -Sys.setenv("DATAVERSE_SERVER" = "dataverse.harvard.edu") # download file from: -# https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/ARKOTI -dv <- get_dataverse("monogan") +# https://demo.dataverse.org/dataverse/dataverse-client-r +Sys.setenv("DATAVERSE_SERVER" = "demo.dataverse.org") +# download file from: +dv <- get_dataverse("dataverse-client-r") (contents <- dataverse_contents(dv)) # get a dataset from the dataverse d1 <- get_dataset(contents[[1]]) -f <- get_file(d1$files$id[3]) +f <- get_file(d1$files$id[1]) } } \seealso{ From 0758fe7e2c1353fddc9a50620433fe9880ef161f Mon Sep 17 00:00:00 2001 From: Will Beasley Date: Tue, 13 Apr 2021 00:14:07 -0500 Subject: [PATCH 02/22] testthat::skip_on_cran() for all server tests ref #96 --- DESCRIPTION | 2 +- NEWS.md | 4 ++++ tests/testthat/tests-dataset_files.R | 3 ++- tests/testthat/tests-dataset_metadata.R | 6 +++-- tests/testthat/tests-dataverse_contents.R | 6 +++-- ...tests-get_dataframe-dataframe-basketball.R | 9 ++++--- .../tests-get_dataframe-original-basketball.R | 18 +++++++++----- tests/testthat/tests-get_dataset.R | 3 ++- tests/testthat/tests-get_dataverse.R | 6 +++-- tests/testthat/tests-get_file.R | 12 ++++++---- tests/testthat/tests-get_file_metadata.R | 6 +++-- tests/testthat/tests-list_datasets.R | 6 +++-- tests/testthat/tests-search.R | 24 +++++++++---------- 13 files changed, 67 insertions(+), 38 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 614870e..77f0f7b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: dataverse -Version: 0.3.7 +Version: 0.3.8 Title: Client for Dataverse 4+ Repositories Authors@R: c(person(given = "Will", diff --git a/NEWS.md b/NEWS.md index b102466..789a393 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# CHANGES in dataverse 0.3.8 +* Adapt to Dataverse 5.4.1 (#94 @kuriwaki) +* Doesn't rely on CRAN for daily tests of API functions (#96) + # CHANGES in dataverse 0.3.3 * More verbose error messages returned on httr failure. (#31 @EdJeeOnGithub) diff --git a/tests/testthat/tests-dataset_files.R b/tests/testthat/tests-dataset_files.R index 9a91831..6da8dd3 100644 --- a/tests/testthat/tests-dataset_files.R +++ b/tests/testthat/tests-dataset_files.R @@ -2,7 +2,8 @@ # https://doi.org/10.70122/FK2/HXJVJU test_that("download tab from DOI and filename", { - testthat::skip_if_offline("demo.dataverse.org") + # testthat::skip_if_offline("demo.dataverse.org") + testthat::skip_on_cran() dv <- get_dataverse("dataverse-client-r") contents <- dataverse_contents(dv) ds_index <- which(sapply(contents, function(x) x$identifier) == "FK2/HXJVJU") diff --git a/tests/testthat/tests-dataset_metadata.R b/tests/testthat/tests-dataset_metadata.R index 1665b48..174c083 100644 --- a/tests/testthat/tests-dataset_metadata.R +++ b/tests/testthat/tests-dataset_metadata.R @@ -2,7 +2,8 @@ # https://doi.org/10.70122/FK2/HXJVJU test_that("check metadata format", { - testthat::skip_if_offline("demo.dataverse.org") + # testthat::skip_if_offline("demo.dataverse.org") + testthat::skip_on_cran() dv <- get_dataverse("dataverse-client-r") contents <- dataverse_contents(dv) ds_index <- which(sapply(contents, function(x) x$identifier) == "FK2/HXJVJU") @@ -14,7 +15,8 @@ test_that("check metadata format", { }) test_that("check versions format", { - testthat::skip_if_offline("demo.dataverse.org") + # testthat::skip_if_offline("demo.dataverse.org") + testthat::skip_on_cran() dv <- get_dataverse("dataverse-client-r") contents <- dataverse_contents(dv) ds_index <- which(sapply(contents, function(x) x$identifier) == "FK2/HXJVJU") diff --git a/tests/testthat/tests-dataverse_contents.R b/tests/testthat/tests-dataverse_contents.R index 05d23f3..a9664d1 100644 --- a/tests/testthat/tests-dataverse_contents.R +++ b/tests/testthat/tests-dataverse_contents.R @@ -1,7 +1,8 @@ # See https://demo.dataverse.org/dataverse/dataverse-client-r test_that("dataverse root", { - testthat::skip_if_offline("demo.dataverse.org") + # testthat::skip_if_offline("demo.dataverse.org") + testthat::skip_on_cran() expected_length_minimum <- 300 # 397 as of Feb 2020 dv <- get_dataverse(dataverse = ":root") @@ -10,7 +11,8 @@ test_that("dataverse root", { }) test_that("dataverse for 'dataverse-client-r'", { - testthat::skip_if_offline("demo.dataverse.org") + # testthat::skip_if_offline("demo.dataverse.org") + testthat::skip_on_cran() expected <- structure( list( id = 1734004L, diff --git a/tests/testthat/tests-get_dataframe-dataframe-basketball.R b/tests/testthat/tests-get_dataframe-dataframe-basketball.R index d435ef2..43b5e62 100644 --- a/tests/testthat/tests-get_dataframe-dataframe-basketball.R +++ b/tests/testthat/tests-get_dataframe-dataframe-basketball.R @@ -2,7 +2,8 @@ # https://doi.org/10.70122/FK2/HXJVJU test_that("roster-by-name", { - testthat::skip_if_offline("demo.dataverse.org") + # testthat::skip_if_offline("demo.dataverse.org") + testthat::skip_on_cran() expected_ds <- retrieve_info_dataset("dataset-basketball/expected-metadata.yml") expected_file <- readr::read_rds(system.file("dataset-basketball/dataframe-from-tab.rds", package = "dataverse")) @@ -16,7 +17,8 @@ test_that("roster-by-name", { }) test_that("roster-by-doi", { - testthat::skip_if_offline("demo.dataverse.org") + # testthat::skip_if_offline("demo.dataverse.org") + testthat::skip_on_cran() expected_ds <- retrieve_info_dataset("dataset-basketball/expected-metadata.yml") expected_file <- readr::read_rds(system.file("dataset-basketball/dataframe-from-tab.rds", package = "dataverse")) @@ -29,7 +31,8 @@ test_that("roster-by-doi", { }) test_that("roster-by-id", { - testthat::skip_if_offline("demo.dataverse.org") + # testthat::skip_if_offline("demo.dataverse.org") + testthat::skip_on_cran() expected_ds <- retrieve_info_dataset("dataset-basketball/expected-metadata.yml") expected_file <- readr::read_rds(system.file("dataset-basketball/dataframe-from-tab.rds", package = "dataverse")) diff --git a/tests/testthat/tests-get_dataframe-original-basketball.R b/tests/testthat/tests-get_dataframe-original-basketball.R index af06a13..df91f6a 100644 --- a/tests/testthat/tests-get_dataframe-original-basketball.R +++ b/tests/testthat/tests-get_dataframe-original-basketball.R @@ -17,7 +17,8 @@ standarize_string <- function (x, start = 1, stop = nchar(x)) { } test_that("roster-by-name", { - testthat::skip_if_offline("demo.dataverse.org") + # testthat::skip_if_offline("demo.dataverse.org") + testthat::skip_on_cran() expected_ds <- retrieve_info_dataset("dataset-basketball/expected-metadata.yml") expected_file <- expected_ds$roster$raw_value @@ -52,7 +53,8 @@ test_that("roster-by-name", { }) test_that("roster-by-doi", { - testthat::skip_if_offline("demo.dataverse.org") + # testthat::skip_if_offline("demo.dataverse.org") + testthat::skip_on_cran() expected_ds <- retrieve_info_dataset("dataset-basketball/expected-metadata.yml") expected_file <- expected_ds$roster$raw_value @@ -73,7 +75,8 @@ test_that("roster-by-doi", { }) test_that("roster-by-id", { - testthat::skip_if_offline("demo.dataverse.org") + # testthat::skip_if_offline("demo.dataverse.org") + testthat::skip_on_cran() expected_ds <- retrieve_info_dataset("dataset-basketball/expected-metadata.yml") expected_file <- expected_ds$roster$raw_value @@ -94,7 +97,8 @@ test_that("roster-by-id", { }) test_that("image-by-name", { - testthat::skip_if_offline("demo.dataverse.org") + # testthat::skip_if_offline("demo.dataverse.org") + testthat::skip_on_cran() expected_ds <- retrieve_info_dataset("dataset-basketball/expected-metadata.yml") expected_file <- expected_ds$image$raw_value @@ -113,7 +117,8 @@ test_that("image-by-name", { }) test_that("image-by-doi", { - testthat::skip_if_offline("demo.dataverse.org") + # testthat::skip_if_offline("demo.dataverse.org") + testthat::skip_on_cran() expected_ds <- retrieve_info_dataset("dataset-basketball/expected-metadata.yml") expected_file <- expected_ds$image$raw_value @@ -131,7 +136,8 @@ test_that("image-by-doi", { }) test_that("image-by-id", { - testthat::skip_if_offline("demo.dataverse.org") + # testthat::skip_if_offline("demo.dataverse.org") + testthat::skip_on_cran() expected_ds <- retrieve_info_dataset("dataset-basketball/expected-metadata.yml") expected_file <- expected_ds$image$raw_value diff --git a/tests/testthat/tests-get_dataset.R b/tests/testthat/tests-get_dataset.R index cd17883..9d7f977 100644 --- a/tests/testthat/tests-get_dataset.R +++ b/tests/testthat/tests-get_dataset.R @@ -2,7 +2,8 @@ # https://doi.org/10.70122/FK2/HXJVJU test_that("download tab from DOI and filename", { - testthat::skip_if_offline("demo.dataverse.org") + # testthat::skip_if_offline("demo.dataverse.org") + testthat::skip_on_cran() dv <- get_dataverse("dataverse-client-r") contents <- dataverse_contents(dv) ds_index <- which(sapply(contents, function(x) x$identifier) == "FK2/HXJVJU") diff --git a/tests/testthat/tests-get_dataverse.R b/tests/testthat/tests-get_dataverse.R index 3d76b5e..734cc82 100644 --- a/tests/testthat/tests-get_dataverse.R +++ b/tests/testthat/tests-get_dataverse.R @@ -1,7 +1,8 @@ # See https://demo.dataverse.org/dataverse/dataverse-client-r test_that("dataverse root", { - testthat::skip_if_offline("demo.dataverse.org") + # testthat::skip_if_offline("demo.dataverse.org") + testthat::skip_on_cran() expected <- retrieve_info_dataverse("expected-dataverse-root.yml") # The code below can be encapsulated in a separate function, if many dataverses are tested. @@ -15,7 +16,8 @@ test_that("dataverse root", { }) test_that("dataverse for 'dataverse-client-r'", { - testthat::skip_if_offline("demo.dataverse.org") + # testthat::skip_if_offline("demo.dataverse.org") + testthat::skip_on_cran() expected <- retrieve_info_dataverse("expected-dataverse.yml") # The code below can be encapsulated in a separate function, if many dataverses are tested. diff --git a/tests/testthat/tests-get_file.R b/tests/testthat/tests-get_file.R index 383e4ed..9188ec1 100644 --- a/tests/testthat/tests-get_file.R +++ b/tests/testthat/tests-get_file.R @@ -4,7 +4,8 @@ context("Data Access API") # https://doi.org/10.70122/FK2/HXJVJU test_that("download tab from DOI and filename", { - testthat::skip_if_offline("demo.dataverse.org") + # testthat::skip_if_offline("demo.dataverse.org") + testthat::skip_on_cran() actual <- get_file( file = "roster-bulls-1996.tab", dataset = "doi:10.70122/FK2/HXJVJU" @@ -14,7 +15,8 @@ test_that("download tab from DOI and filename", { }) test_that("download tab from file id", { - testthat::skip_if_offline("demo.dataverse.org") + # testthat::skip_if_offline("demo.dataverse.org") + testthat::skip_on_cran() actual <- get_file( file = 1734005L ) @@ -23,7 +25,8 @@ test_that("download tab from file id", { }) test_that("download multiple files with file id - no folder", { - testthat::skip_if_offline("demo.dataverse.org") + # testthat::skip_if_offline("demo.dataverse.org") + testthat::skip_on_cran() # file_ids <- get_dataset("doi:10.70122/FK2/LZAJEQ", server = "demo.dataverse.org")[['files']]$id file_ids <- get_dataset("doi:10.70122/FK2/HXJVJU", server = "demo.dataverse.org")[['files']]$id actual <- get_file( @@ -37,7 +40,8 @@ test_that("download multiple files with file id - no folder", { }) test_that("download multiple files with file id - with folders", { - testthat::skip_if_offline("demo.dataverse.org") + # testthat::skip_if_offline("demo.dataverse.org") + testthat::skip_on_cran() # file_ids <- get_dataset("doi:10.70122/FK2/V54HGA", server = "demo.dataverse.org")[['files']]$id file_ids <- get_dataset("doi:10.70122/FK2/HXJVJU", server = "demo.dataverse.org")[['files']]$id actual <- get_file(file_ids, format="original", server = "demo.dataverse.org") diff --git a/tests/testthat/tests-get_file_metadata.R b/tests/testthat/tests-get_file_metadata.R index 29efd19..a97aa6e 100644 --- a/tests/testthat/tests-get_file_metadata.R +++ b/tests/testthat/tests-get_file_metadata.R @@ -4,7 +4,8 @@ context("Data Access API") # https://doi.org/10.70122/FK2/HXJVJU test_that("get file metadata from DOI and filename", { - testthat::skip_if_offline("demo.dataverse.org") + # testthat::skip_if_offline("demo.dataverse.org") + testthat::skip_on_cran() actual <- get_file_metadata( file = "roster-bulls-1996.tab", dataset = "doi:10.70122/FK2/HXJVJU" @@ -14,7 +15,8 @@ test_that("get file metadata from DOI and filename", { }) test_that("get file metadata from file id", { - testthat::skip_if_offline("demo.dataverse.org") + # testthat::skip_if_offline("demo.dataverse.org") + testthat::skip_on_cran() actual <- get_file_metadata( file = 1734005 ) diff --git a/tests/testthat/tests-list_datasets.R b/tests/testthat/tests-list_datasets.R index 4a341ef..ff27ba4 100644 --- a/tests/testthat/tests-list_datasets.R +++ b/tests/testthat/tests-list_datasets.R @@ -1,7 +1,8 @@ # See https://demo.dataverse.org/dataverse/dataverse-client-r test_that("dataverse root", { - testthat::skip_if_offline("demo.dataverse.org") + # testthat::skip_if_offline("demo.dataverse.org") + testthat::skip_on_cran() expected <- structure( list( @@ -29,7 +30,8 @@ test_that("dataverse root", { }) test_that("dataverse for 'dataverse-client-r'", { - testthat::skip_if_offline("demo.dataverse.org") + # testthat::skip_if_offline("demo.dataverse.org") + testthat::skip_on_cran() expected <- structure( list( diff --git a/tests/testthat/tests-search.R b/tests/testthat/tests-search.R index 7144b8c..0a35628 100644 --- a/tests/testthat/tests-search.R +++ b/tests/testthat/tests-search.R @@ -1,8 +1,8 @@ context("Search API") test_that("simple search query", { - testthat::skip_if_offline("dataverse.harvard.edu") - expect_true(is.data.frame(dataverse_search("Gary King", key = "", server = "dataverse.harvard.edu"))) + testthat::skip_on_cran() + expect_true(is.data.frame(dataverse_search("Gary King", key = "", server = "dataverse.harvard.edu"))) }) test_that("named argument search", { @@ -11,26 +11,26 @@ test_that("named argument search", { }) test_that("simple search w/type argument", { - testthat::skip_if_offline("dataverse.harvard.edu") - expect_true(is.data.frame(dataverse_search(author = "Gary King", type = "dataset", key = "", server = "dataverse.harvard.edu"))) + testthat::skip_on_cran() + expect_true(is.data.frame(dataverse_search(author = "Gary King", type = "dataset", key = "", server = "dataverse.harvard.edu"))) }) test_that("date range search using fq", { - testthat::skip_if_offline("dataverse.harvard.edu") - expect_true(is.data.frame(dataverse_search("*", fq = "dateSort:[2018-01-01T00:00:00Z+TO+2019-01-01T00:00:00Z]", type = "dataset", key = "", server = "dataverse.harvard.edu"))) + testthat::skip_on_cran() + expect_true(is.data.frame(dataverse_search("*", fq = "dateSort:[2018-01-01T00:00:00Z+TO+2019-01-01T00:00:00Z]", type = "dataset", key = "", server = "dataverse.harvard.edu"))) }) test_that("publication year using fq", { - testthat::skip_if_offline("dataverse.harvard.edu") - expect_true(is.data.frame(dataverse_search("*", fq = "publicationDate:2018", type = "dataset", key = "", server = "dataverse.harvard.edu"))) + testthat::skip_on_cran() + expect_true(is.data.frame(dataverse_search("*", fq = "publicationDate:2018", type = "dataset", key = "", server = "dataverse.harvard.edu"))) }) test_that("filter dataverses by subject using fq", { - testthat::skip_if_offline("dataverse.harvard.edu") - expect_true(is.data.frame(dataverse_search("*", fq = "subject_ss:Social+Sciences", type = "dataverse", key = "", server = "dataverse.harvard.edu"))) + testthat::skip_on_cran() + expect_true(is.data.frame(dataverse_search("*", fq = "subject_ss:Social+Sciences", type = "dataverse", key = "", server = "dataverse.harvard.edu"))) }) test_that("empty fq search", { - testthat::skip_if_offline("dataverse.harvard.edu") - expect_length(dataverse_search("*", fq = "dateSort:[2019-02-01T00:00:00Z+TO+2019-01-01T00:00:00Z]", type = "dataset", key = "", server = "dataverse.harvard.edu"), 0) + testthat::skip_on_cran() + expect_length(dataverse_search("*", fq = "dateSort:[2019-02-01T00:00:00Z+TO+2019-01-01T00:00:00Z]", type = "dataset", key = "", server = "dataverse.harvard.edu"), 0) }) From b0f2410a46e5942cf3758224e8acba76c80ef9fc Mon Sep 17 00:00:00 2001 From: Will Beasley Date: Tue, 13 Apr 2021 00:25:15 -0500 Subject: [PATCH 03/22] remove deprecated `testthat::context()` https://testthat.r-lib.org/reference/context.html --- tests/testthat/tests-get_file.R | 2 -- tests/testthat/tests-get_file_metadata.R | 2 -- tests/testthat/tests-native-api.R | 12 ++++-------- tests/testthat/tests-search.R | 6 ++---- tests/testthat/tests-sword.R | 6 +----- 5 files changed, 7 insertions(+), 21 deletions(-) diff --git a/tests/testthat/tests-get_file.R b/tests/testthat/tests-get_file.R index 9188ec1..cf51af4 100644 --- a/tests/testthat/tests-get_file.R +++ b/tests/testthat/tests-get_file.R @@ -1,5 +1,3 @@ -context("Data Access API") - # See https://demo.dataverse.org/dataverse/dataverse-client-r # https://doi.org/10.70122/FK2/HXJVJU diff --git a/tests/testthat/tests-get_file_metadata.R b/tests/testthat/tests-get_file_metadata.R index a97aa6e..582990b 100644 --- a/tests/testthat/tests-get_file_metadata.R +++ b/tests/testthat/tests-get_file_metadata.R @@ -1,5 +1,3 @@ -context("Data Access API") - # See https://demo.dataverse.org/dataverse/dataverse-client-r # https://doi.org/10.70122/FK2/HXJVJU diff --git a/tests/testthat/tests-native-api.R b/tests/testthat/tests-native-api.R index 99e4517..ff4e267 100644 --- a/tests/testthat/tests-native-api.R +++ b/tests/testthat/tests-native-api.R @@ -1,11 +1,7 @@ -context("Native API (authenticated functions)") - -test_that("placeholder", { - expect_true(TRUE) +test_that("Native API (authenticated functions)", { + expect_true(TRUE) }) -context("Native API (unauthenticated functions)") - -test_that("placeholder", { - expect_true(TRUE) +test_that("Native API (unauthenticated functions)", { + expect_true(TRUE) }) diff --git a/tests/testthat/tests-search.R b/tests/testthat/tests-search.R index 0a35628..11dfccd 100644 --- a/tests/testthat/tests-search.R +++ b/tests/testthat/tests-search.R @@ -1,13 +1,11 @@ -context("Search API") - test_that("simple search query", { testthat::skip_on_cran() expect_true(is.data.frame(dataverse_search("Gary King", key = "", server = "dataverse.harvard.edu"))) }) test_that("named argument search", { - testthat::skip_if_offline("dataverse.harvard.edu") - expect_true(is.data.frame(dataverse_search(author = "Gary King", title = "Ecological Inference", key = "", server = "dataverse.harvard.edu"))) + testthat::skip_on_cran() + expect_true(is.data.frame(dataverse_search(author = "Gary King", title = "Ecological Inference", key = "", server = "dataverse.harvard.edu"))) }) test_that("simple search w/type argument", { diff --git a/tests/testthat/tests-sword.R b/tests/testthat/tests-sword.R index f549c5d..5c826b6 100644 --- a/tests/testthat/tests-sword.R +++ b/tests/testthat/tests-sword.R @@ -1,7 +1,3 @@ -context("SWORD API") - -# use demo server: demo.dataverse.org - -test_that("placeholder", { +test_that("SWORD API", { expect_true(TRUE) }) From 310156bf35c1e14dadd1204ac797458972317691 Mon Sep 17 00:00:00 2001 From: Will Beasley Date: Tue, 13 Apr 2021 00:49:44 -0500 Subject: [PATCH 04/22] upgrade testthat to 3.0 edition close #97 --- DESCRIPTION | 1 + NEWS.md | 1 + 2 files changed, 2 insertions(+) diff --git a/DESCRIPTION b/DESCRIPTION index 77f0f7b..e66bd3d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -61,3 +61,4 @@ VignetteBuilder: knitr Encoding: UTF-8 RoxygenNote: 7.1.1 Roxygen: list(markdown = TRUE) +Config/testthat/edition: 3 diff --git a/NEWS.md b/NEWS.md index 789a393..ed82714 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,7 @@ # CHANGES in dataverse 0.3.8 * Adapt to Dataverse 5.4.1 (#94 @kuriwaki) * Doesn't rely on CRAN for daily tests of API functions (#96) +* Upgrade testthat to 3.0 edition (#97) # CHANGES in dataverse 0.3.3 * More verbose error messages returned on httr failure. (#31 @EdJeeOnGithub) From 9635551a06647b484c847ef09714bbe3004ee0ab Mon Sep 17 00:00:00 2001 From: Will Beasley Date: Tue, 13 Apr 2021 01:04:58 -0500 Subject: [PATCH 05/22] Starting GitHub Actions ref #98 --- .github/workflows/R-CMD-check.yaml | 107 +++++++++++++++++++++++++++++ NEWS.md | 1 + README.Rmd | 5 +- README.md | 5 +- 4 files changed, 115 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/R-CMD-check.yaml diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml new file mode 100644 index 0000000..1b29a42 --- /dev/null +++ b/.github/workflows/R-CMD-check.yaml @@ -0,0 +1,107 @@ +# NOTE: This workflow is overkill for most R packages +# check-standard.yaml is likely a better choice +# usethis::use_github_action("check-standard") will install it. +# +# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. +# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions +on: + push: + branches: + - main + - master + pull_request: + branches: + - main + - master + +name: R-CMD-check + +jobs: + R-CMD-check: + runs-on: ${{ matrix.config.os }} + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + + strategy: + fail-fast: false + matrix: + config: + - {os: macOS-latest, r: 'release'} + - {os: windows-latest, r: 'release'} + - {os: windows-latest, r: '3.6'} + - {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.0.0 (ubuntu-18.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" } + - {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} + - {os: ubuntu-18.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} + - {os: ubuntu-18.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} + - {os: ubuntu-18.04, r: '3.4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} + - {os: ubuntu-18.04, r: '3.3', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} + + env: + RSPM: ${{ matrix.config.rspm }} + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + + steps: + - uses: actions/checkout@v2 + + - uses: r-lib/actions/setup-r@v1 + id: install-r + with: + r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + + - uses: r-lib/actions/setup-pandoc@v1 + + - name: Install pak and query dependencies + run: | + install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/") + saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds") + shell: Rscript {0} + + - name: Restore R package cache + uses: actions/cache@v2 + with: + path: | + ${{ env.R_LIBS_USER }} + !${{ env.R_LIBS_USER }}/pak + key: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }} + restore-keys: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1- + + - name: Install system dependencies + if: runner.os == 'Linux' + run: | + pak::local_system_requirements(execute = TRUE) + pak::pkg_system_requirements("rcmdcheck", execute = TRUE) + shell: Rscript {0} + + - name: Install dependencies + run: | + pak::local_install_dev_deps(upgrade = TRUE) + pak::pkg_install("rcmdcheck") + shell: Rscript {0} + + - name: Session info + run: | + options(width = 100) + pkgs <- installed.packages()[, "Package"] + sessioninfo::session_info(pkgs, include_base = TRUE) + shell: Rscript {0} + + - name: Check + env: + _R_CHECK_CRAN_INCOMING_: false + run: | + options(crayon.enabled = TRUE) + rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") + shell: Rscript {0} + + - name: Show testthat output + if: always() + run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true + shell: bash + + - name: Upload check results + if: failure() + uses: actions/upload-artifact@main + with: + name: ${{ matrix.config.os }}-r${{ matrix.config.r }}-results + path: check diff --git a/NEWS.md b/NEWS.md index ed82714..e2c2e18 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,7 @@ * Adapt to Dataverse 5.4.1 (#94 @kuriwaki) * Doesn't rely on CRAN for daily tests of API functions (#96) * Upgrade testthat to 3.0 edition (#97) +* Move to GitHub Actions (#98) # CHANGES in dataverse 0.3.3 * More verbose error messages returned on httr failure. (#31 @EdJeeOnGithub) diff --git a/README.Rmd b/README.Rmd index 8a0b42d..f4a7e1b 100644 --- a/README.Rmd +++ b/README.Rmd @@ -9,7 +9,10 @@ knitr::opts_chunk$set(results = "hold") Sys.setenv("DATAVERSE_SERVER" = "dataverse.harvard.edu") ``` -[![CRAN Version](https://www.r-pkg.org/badges/version/dataverse)](https://cran.r-project.org/package=dataverse) ![Downloads](https://cranlogs.r-pkg.org/badges/dataverse) [![Travis-CI Build Status](https://travis-ci.org/IQSS/dataverse-client-r.png?branch=master)](https://travis-ci.org/IQSS/dataverse-client-r) [![codecov.io](https://codecov.io/github/IQSS/dataverse-client-r/coverage.svg?branch=master)](https://codecov.io/github/IQSS/dataverse-client-r?branch=master) +[![CRAN Version](https://www.r-pkg.org/badges/version/dataverse)](https://cran.r-project.org/package=dataverse) +![Downloads](https://cranlogs.r-pkg.org/badges/dataverse) +[![R-CMD-check](https://github.com/IQSS/dataverse-client-r/workflows/R-CMD-check/badge.svg)](https://github.com/IQSS/dataverse-client-r/actions) +[![Travis-CI Build Status](https://travis-ci.org/IQSS/dataverse-client-r.png?branch=master)](https://travis-ci.org/IQSS/dataverse-client-r) [![codecov.io](https://codecov.io/github/IQSS/dataverse-client-r/coverage.svg?branch=master)](https://codecov.io/github/IQSS/dataverse-client-r?branch=master) [![Dataverse Project logo](https://dataverse.org/files/dataverseorg/files/dataverse_project_logo-hp.png)](https://dataverse.org) diff --git a/README.md b/README.md index 43285f2..018efca 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,9 @@ R Client for Dataverse Repositories [![CRAN Version](https://www.r-pkg.org/badges/version/dataverse)](https://cran.r-project.org/package=dataverse) -![Downloads](https://cranlogs.r-pkg.org/badges/dataverse) [![Travis-CI -Build +![Downloads](https://cranlogs.r-pkg.org/badges/dataverse) +[![R-CMD-check](https://github.com/IQSS/dataverse-client-r/workflows/R-CMD-check/badge.svg)](https://github.com/IQSS/dataverse-client-r/actions) +[![Travis-CI Build Status](https://travis-ci.org/IQSS/dataverse-client-r.png?branch=master)](https://travis-ci.org/IQSS/dataverse-client-r) [![codecov.io](https://codecov.io/github/IQSS/dataverse-client-r/coverage.svg?branch=master)](https://codecov.io/github/IQSS/dataverse-client-r?branch=master) From b73b4a692f461f4ce3161a0f638e50419a4a43e5 Mon Sep 17 00:00:00 2001 From: Will Beasley Date: Tue, 13 Apr 2021 01:19:41 -0500 Subject: [PATCH 06/22] check on dev branch ref #98 --- .github/workflows/R-CMD-check.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 1b29a42..4e0c79f 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -9,6 +9,7 @@ on: branches: - main - master + - dev pull_request: branches: - main From d6b1a6d95f247bbeb786951f560589b5b0a8ee02 Mon Sep 17 00:00:00 2001 From: Will Beasley Date: Tue, 13 Apr 2021 08:58:11 -0500 Subject: [PATCH 07/22] remove tests for older versions of R --- .github/workflows/R-CMD-check.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 4e0c79f..f8bd650 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -28,14 +28,15 @@ jobs: matrix: config: - {os: macOS-latest, r: 'release'} + - {os: windows-latest, r: 'devel'} - {os: windows-latest, r: 'release'} - - {os: windows-latest, r: '3.6'} + # - {os: windows-latest, r: '3.6'} - {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.0.0 (ubuntu-18.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" } - {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - - {os: ubuntu-18.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - - {os: ubuntu-18.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - - {os: ubuntu-18.04, r: '3.4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - - {os: ubuntu-18.04, r: '3.3', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} + # - {os: ubuntu-18.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} + # - {os: ubuntu-18.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} + # - {os: ubuntu-18.04, r: '3.4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} + # - {os: ubuntu-18.04, r: '3.3', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} env: RSPM: ${{ matrix.config.rspm }} From 0818e4442993d76f3832831e57697f010c611e2f Mon Sep 17 00:00:00 2001 From: Will Beasley Date: Tue, 13 Apr 2021 10:18:18 -0500 Subject: [PATCH 08/22] ignore vignett's `doc/` --- .gitignore | 2 ++ CRAN-RELEASE | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 CRAN-RELEASE diff --git a/.gitignore b/.gitignore index 9326638..572b3cb 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ doc Meta .Rproj.user docs +/doc/ +/Meta/ diff --git a/CRAN-RELEASE b/CRAN-RELEASE deleted file mode 100644 index 6f916b4..0000000 --- a/CRAN-RELEASE +++ /dev/null @@ -1,2 +0,0 @@ -This package was submitted to CRAN on 2021-02-23. -Once it is accepted, delete this file and tag the release (commit 45dc66d). From 8606004a374a57499ccf6d71c48b86c1141b2bca Mon Sep 17 00:00:00 2001 From: Will Beasley Date: Tue, 13 Apr 2021 11:31:50 -0500 Subject: [PATCH 09/22] havea simple & a thorough GitHub Action ref #98 --- .github/workflows/R-CMD-check-thorough.yaml | 109 ++++++++++++++++++++ .github/workflows/R-CMD-check.yaml | 96 ++--------------- 2 files changed, 119 insertions(+), 86 deletions(-) create mode 100644 .github/workflows/R-CMD-check-thorough.yaml diff --git a/.github/workflows/R-CMD-check-thorough.yaml b/.github/workflows/R-CMD-check-thorough.yaml new file mode 100644 index 0000000..8b560d0 --- /dev/null +++ b/.github/workflows/R-CMD-check-thorough.yaml @@ -0,0 +1,109 @@ +# NOTE: This workflow is overkill for most R packages +# check-standard.yaml is likely a better choice +# usethis::use_github_action("check-standard") will install it. +# +# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. +# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions +on: + push: + branches: + - main + - master + + pull_request: + branches: + - main + - master + +name: R-CMD-check + +jobs: + R-CMD-check: + runs-on: ${{ matrix.config.os }} + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + + strategy: + fail-fast: false + matrix: + config: + - {os: macOS-latest, r: 'release'} + - {os: windows-latest, r: 'devel'} + - {os: windows-latest, r: 'release'} + # - {os: windows-latest, r: '3.6'} + - {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.0.0 (ubuntu-18.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" } + - {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} + # - {os: ubuntu-18.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} + # - {os: ubuntu-18.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} + # - {os: ubuntu-18.04, r: '3.4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} + # - {os: ubuntu-18.04, r: '3.3', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} + + env: + RSPM: ${{ matrix.config.rspm }} + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + + steps: + - uses: actions/checkout@v2 + + - uses: r-lib/actions/setup-r@v1 + id: install-r + with: + r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + + - uses: r-lib/actions/setup-pandoc@v1 + + - name: Install pak and query dependencies + run: | + install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/") + saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds") + shell: Rscript {0} + + - name: Restore R package cache + uses: actions/cache@v2 + with: + path: | + ${{ env.R_LIBS_USER }} + !${{ env.R_LIBS_USER }}/pak + key: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }} + restore-keys: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1- + + - name: Install system dependencies + if: runner.os == 'Linux' + run: | + pak::local_system_requirements(execute = TRUE) + pak::pkg_system_requirements("rcmdcheck", execute = TRUE) + shell: Rscript {0} + + - name: Install dependencies + run: | + pak::local_install_dev_deps(upgrade = TRUE) + pak::pkg_install("rcmdcheck") + shell: Rscript {0} + + - name: Session info + run: | + options(width = 100) + pkgs <- installed.packages()[, "Package"] + sessioninfo::session_info(pkgs, include_base = TRUE) + shell: Rscript {0} + + - name: Check + env: + _R_CHECK_CRAN_INCOMING_: false + run: | + options(crayon.enabled = TRUE) + rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") + shell: Rscript {0} + + - name: Show testthat output + if: always() + run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true + shell: bash + + - name: Upload check results + if: failure() + uses: actions/upload-artifact@main + with: + name: ${{ matrix.config.os }}-r${{ matrix.config.r }}-results + path: check diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index f8bd650..e8b4462 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -1,109 +1,33 @@ -# NOTE: This workflow is overkill for most R packages -# check-standard.yaml is likely a better choice -# usethis::use_github_action("check-standard") will install it. -# # For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. # https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions on: push: branches: - - main - - master - dev - pull_request: - branches: - - main - - master + # - main + # - master + # pull_request: + # branches: + # - main + # - master name: R-CMD-check jobs: R-CMD-check: - runs-on: ${{ matrix.config.os }} - - name: ${{ matrix.config.os }} (${{ matrix.config.r }}) - - strategy: - fail-fast: false - matrix: - config: - - {os: macOS-latest, r: 'release'} - - {os: windows-latest, r: 'devel'} - - {os: windows-latest, r: 'release'} - # - {os: windows-latest, r: '3.6'} - - {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.0.0 (ubuntu-18.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" } - - {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - # - {os: ubuntu-18.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - # - {os: ubuntu-18.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - # - {os: ubuntu-18.04, r: '3.4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - # - {os: ubuntu-18.04, r: '3.3', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - + runs-on: macOS-latest env: - RSPM: ${{ matrix.config.rspm }} GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - steps: - uses: actions/checkout@v2 - - uses: r-lib/actions/setup-r@v1 - id: install-r - with: - r-version: ${{ matrix.config.r }} - http-user-agent: ${{ matrix.config.http-user-agent }} - - - uses: r-lib/actions/setup-pandoc@v1 - - - name: Install pak and query dependencies - run: | - install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/") - saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds") - shell: Rscript {0} - - - name: Restore R package cache - uses: actions/cache@v2 - with: - path: | - ${{ env.R_LIBS_USER }} - !${{ env.R_LIBS_USER }}/pak - key: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }} - restore-keys: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1- - - - name: Install system dependencies - if: runner.os == 'Linux' - run: | - pak::local_system_requirements(execute = TRUE) - pak::pkg_system_requirements("rcmdcheck", execute = TRUE) - shell: Rscript {0} - - name: Install dependencies run: | - pak::local_install_dev_deps(upgrade = TRUE) - pak::pkg_install("rcmdcheck") - shell: Rscript {0} - - - name: Session info - run: | - options(width = 100) - pkgs <- installed.packages()[, "Package"] - sessioninfo::session_info(pkgs, include_base = TRUE) + install.packages(c("remotes", "rcmdcheck")) + remotes::install_deps(dependencies = TRUE) shell: Rscript {0} - - name: Check - env: - _R_CHECK_CRAN_INCOMING_: false run: | options(crayon.enabled = TRUE) - rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") + rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "error") shell: Rscript {0} - - - name: Show testthat output - if: always() - run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true - shell: bash - - - name: Upload check results - if: failure() - uses: actions/upload-artifact@main - with: - name: ${{ matrix.config.os }}-r${{ matrix.config.r }}-results - path: check From 903b40ddd8ca34f4fd012f98a562c115e175eb50 Mon Sep 17 00:00:00 2001 From: Will Beasley Date: Tue, 13 Apr 2021 13:30:51 -0500 Subject: [PATCH 10/22] daily tests run 3:07am ref #98 --- .github/workflows/R-CMD-check-daily.yaml | 26 +++++++++++++++++++ ...{R-CMD-check.yaml => R-CMD-check-dev.yaml} | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/R-CMD-check-daily.yaml rename .github/workflows/{R-CMD-check.yaml => R-CMD-check-dev.yaml} (97%) diff --git a/.github/workflows/R-CMD-check-daily.yaml b/.github/workflows/R-CMD-check-daily.yaml new file mode 100644 index 0000000..a871e1a --- /dev/null +++ b/.github/workflows/R-CMD-check-daily.yaml @@ -0,0 +1,26 @@ +# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. +# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions +on: + schedule: + - cron: "0 7 3 * 0" # Run every morning at 3:07am + +name: R-CMD-check + +jobs: + R-CMD-check: + runs-on: ubuntu-18.04, + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v2 + - uses: r-lib/actions/setup-r@v1 + - name: Install dependencies + run: | + install.packages(c("remotes", "rcmdcheck")) + remotes::install_deps(dependencies = TRUE) + shell: Rscript {0} + - name: Check + run: | + options(crayon.enabled = TRUE) + rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "error") + shell: Rscript {0} diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check-dev.yaml similarity index 97% rename from .github/workflows/R-CMD-check.yaml rename to .github/workflows/R-CMD-check-dev.yaml index e8b4462..a11f069 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check-dev.yaml @@ -15,7 +15,7 @@ name: R-CMD-check jobs: R-CMD-check: - runs-on: macOS-latest + runs-on: ubuntu-18.04 env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: From e688515e57fc5abf9f7598480f2b984700563b74 Mon Sep 17 00:00:00 2001 From: Will Beasley Date: Tue, 13 Apr 2021 14:25:20 -0500 Subject: [PATCH 11/22] changing name of tests ref #98 --- .github/workflows/R-CMD-check-daily.yaml | 2 +- .github/workflows/R-CMD-check-dev.yaml | 2 +- .github/workflows/R-CMD-check-thorough.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/R-CMD-check-daily.yaml b/.github/workflows/R-CMD-check-daily.yaml index a871e1a..2197d49 100644 --- a/.github/workflows/R-CMD-check-daily.yaml +++ b/.github/workflows/R-CMD-check-daily.yaml @@ -4,7 +4,7 @@ on: schedule: - cron: "0 7 3 * 0" # Run every morning at 3:07am -name: R-CMD-check +name: R-CMD-check-daily jobs: R-CMD-check: diff --git a/.github/workflows/R-CMD-check-dev.yaml b/.github/workflows/R-CMD-check-dev.yaml index a11f069..cc949a6 100644 --- a/.github/workflows/R-CMD-check-dev.yaml +++ b/.github/workflows/R-CMD-check-dev.yaml @@ -11,7 +11,7 @@ on: # - main # - master -name: R-CMD-check +name: R-CMD-check-dev jobs: R-CMD-check: diff --git a/.github/workflows/R-CMD-check-thorough.yaml b/.github/workflows/R-CMD-check-thorough.yaml index 8b560d0..6c0e8bc 100644 --- a/.github/workflows/R-CMD-check-thorough.yaml +++ b/.github/workflows/R-CMD-check-thorough.yaml @@ -15,7 +15,7 @@ on: - main - master -name: R-CMD-check +name: R-CMD-check-thorough jobs: R-CMD-check: From 9c4b3bbc170ac763d93bc5354bc114fddba121ed Mon Sep 17 00:00:00 2001 From: Will Beasley Date: Tue, 13 Apr 2021 15:03:39 -0500 Subject: [PATCH 12/22] trying to figure out why httr isn't available see https://github.com/IQSS/dataverse-client-r/actions/runs/745908113 ref #98 --- .github/workflows/R-CMD-check-thorough.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/R-CMD-check-thorough.yaml b/.github/workflows/R-CMD-check-thorough.yaml index 6c0e8bc..ac2a411 100644 --- a/.github/workflows/R-CMD-check-thorough.yaml +++ b/.github/workflows/R-CMD-check-thorough.yaml @@ -7,6 +7,7 @@ on: push: branches: + - dev - main - master From 151b560e4d7f2bcb6c8b4c14c64521d4e14a6189 Mon Sep 17 00:00:00 2001 From: Will Beasley Date: Tue, 13 Apr 2021 15:31:11 -0500 Subject: [PATCH 13/22] as cran; error on warnings ref #98 --- .github/workflows/R-CMD-check-daily.yaml | 4 ++-- .github/workflows/R-CMD-check-dev.yaml | 4 ++-- .github/workflows/R-CMD-check-thorough.yaml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/R-CMD-check-daily.yaml b/.github/workflows/R-CMD-check-daily.yaml index 2197d49..f05017f 100644 --- a/.github/workflows/R-CMD-check-daily.yaml +++ b/.github/workflows/R-CMD-check-daily.yaml @@ -7,7 +7,7 @@ on: name: R-CMD-check-daily jobs: - R-CMD-check: + R-CMD-check-daily: runs-on: ubuntu-18.04, env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} @@ -22,5 +22,5 @@ jobs: - name: Check run: | options(crayon.enabled = TRUE) - rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "error") + rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") shell: Rscript {0} diff --git a/.github/workflows/R-CMD-check-dev.yaml b/.github/workflows/R-CMD-check-dev.yaml index cc949a6..2440a04 100644 --- a/.github/workflows/R-CMD-check-dev.yaml +++ b/.github/workflows/R-CMD-check-dev.yaml @@ -14,7 +14,7 @@ on: name: R-CMD-check-dev jobs: - R-CMD-check: + R-CMD-check-dev: runs-on: ubuntu-18.04 env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} @@ -29,5 +29,5 @@ jobs: - name: Check run: | options(crayon.enabled = TRUE) - rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "error") + rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") shell: Rscript {0} diff --git a/.github/workflows/R-CMD-check-thorough.yaml b/.github/workflows/R-CMD-check-thorough.yaml index ac2a411..12944ca 100644 --- a/.github/workflows/R-CMD-check-thorough.yaml +++ b/.github/workflows/R-CMD-check-thorough.yaml @@ -19,7 +19,7 @@ on: name: R-CMD-check-thorough jobs: - R-CMD-check: + R-CMD-check-thorough: runs-on: ${{ matrix.config.os }} name: ${{ matrix.config.os }} (${{ matrix.config.r }}) From 42e5cc097d0a2c3a5320595192603a670918e11f Mon Sep 17 00:00:00 2001 From: Will Beasley Date: Tue, 13 Apr 2021 16:07:20 -0500 Subject: [PATCH 14/22] copy from REDCapR see https://github.com/OuhscBbmc/REDCapR/blob/master/.github/workflows/check-release.yaml ref #98 Trying to fix a missing httr error: https://github.com/IQSS/dataverse-client-r/runs/2337223042?check_suite_focus=true#step:5:17 --- .github/workflows/R-CMD-check-daily.yaml | 34 +++++++++++++++++++++++- .github/workflows/R-CMD-check-dev.yaml | 34 +++++++++++++++++++++++- 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/.github/workflows/R-CMD-check-daily.yaml b/.github/workflows/R-CMD-check-daily.yaml index f05017f..a1d84c9 100644 --- a/.github/workflows/R-CMD-check-daily.yaml +++ b/.github/workflows/R-CMD-check-daily.yaml @@ -8,19 +8,51 @@ name: R-CMD-check-daily jobs: R-CMD-check-daily: - runs-on: ubuntu-18.04, + runs-on: ubuntu-latest env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v2 - uses: r-lib/actions/setup-r@v1 + - uses: r-lib/actions/setup-pandoc@master + + - name: Query dependencies + run: | + install.packages('remotes') + saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) + writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") + shell: Rscript {0} + + - name: Cache R packages + if: runner.os != 'Windows' + uses: actions/cache@v1 + with: + path: ${{ env.R_LIBS_USER }} + key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} + restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- + + - name: Install system dependencies + if: runner.os == 'Linux' + env: + RHUB_PLATFORM: linux-x86_64-ubuntu-gcc + run: | + Rscript -e "remotes::install_github('r-hub/sysreqs')" + sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))") + sudo -s eval "$sysreqs" + - name: Install dependencies run: | install.packages(c("remotes", "rcmdcheck")) remotes::install_deps(dependencies = TRUE) + remotes::install_cran("covr") shell: Rscript {0} + - name: Check run: | options(crayon.enabled = TRUE) rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") shell: Rscript {0} + + - name: Test coverage + run: covr::codecov() + shell: Rscript {0} diff --git a/.github/workflows/R-CMD-check-dev.yaml b/.github/workflows/R-CMD-check-dev.yaml index 2440a04..7c08cac 100644 --- a/.github/workflows/R-CMD-check-dev.yaml +++ b/.github/workflows/R-CMD-check-dev.yaml @@ -15,19 +15,51 @@ name: R-CMD-check-dev jobs: R-CMD-check-dev: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v2 - uses: r-lib/actions/setup-r@v1 + - uses: r-lib/actions/setup-pandoc@master + + - name: Query dependencies + run: | + install.packages('remotes') + saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) + writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") + shell: Rscript {0} + + - name: Cache R packages + if: runner.os != 'Windows' + uses: actions/cache@v1 + with: + path: ${{ env.R_LIBS_USER }} + key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} + restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- + + - name: Install system dependencies + if: runner.os == 'Linux' + env: + RHUB_PLATFORM: linux-x86_64-ubuntu-gcc + run: | + Rscript -e "remotes::install_github('r-hub/sysreqs')" + sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))") + sudo -s eval "$sysreqs" + - name: Install dependencies run: | install.packages(c("remotes", "rcmdcheck")) remotes::install_deps(dependencies = TRUE) + remotes::install_cran("covr") shell: Rscript {0} + - name: Check run: | options(crayon.enabled = TRUE) rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") shell: Rscript {0} + + - name: Test coverage + run: covr::codecov() + shell: Rscript {0} From d4bda51c60b1a8c3abac85c07cc01fdeb879dd87 Mon Sep 17 00:00:00 2001 From: Will Beasley Date: Tue, 13 Apr 2021 17:14:47 -0500 Subject: [PATCH 15/22] ubuntu latest instead of hard coding 18.04 ref #98 --- .github/workflows/R-CMD-check-dev.yaml | 2 +- .github/workflows/R-CMD-check-thorough.yaml | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/R-CMD-check-dev.yaml b/.github/workflows/R-CMD-check-dev.yaml index 7c08cac..a6869a5 100644 --- a/.github/workflows/R-CMD-check-dev.yaml +++ b/.github/workflows/R-CMD-check-dev.yaml @@ -46,7 +46,7 @@ jobs: Rscript -e "remotes::install_github('r-hub/sysreqs')" sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))") sudo -s eval "$sysreqs" - + - name: Install dependencies run: | install.packages(c("remotes", "rcmdcheck")) diff --git a/.github/workflows/R-CMD-check-thorough.yaml b/.github/workflows/R-CMD-check-thorough.yaml index 12944ca..91dca73 100644 --- a/.github/workflows/R-CMD-check-thorough.yaml +++ b/.github/workflows/R-CMD-check-thorough.yaml @@ -32,12 +32,11 @@ jobs: - {os: windows-latest, r: 'devel'} - {os: windows-latest, r: 'release'} # - {os: windows-latest, r: '3.6'} - - {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.0.0 (ubuntu-18.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" } - - {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - # - {os: ubuntu-18.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - # - {os: ubuntu-18.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - # - {os: ubuntu-18.04, r: '3.4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - # - {os: ubuntu-18.04, r: '3.3', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} + - {os: ubuntu-latest, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} + - {os: ubuntu-latest, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} + # - {os: ubuntu-latest, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.0.0 (ubuntu-18.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" } + # - {os: ubuntu-latest, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} + # - {os: ubuntu-latest, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} env: RSPM: ${{ matrix.config.rspm }} From ccde16e93aada619c18b75d6c0741bef5019391d Mon Sep 17 00:00:00 2001 From: Will Beasley Date: Tue, 13 Apr 2021 17:37:13 -0500 Subject: [PATCH 16/22] delete travis yaml file ref #98 --- .travis.yml | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5c15d2f..0000000 --- a/.travis.yml +++ /dev/null @@ -1,37 +0,0 @@ -# Travis's native R Image (http://docs.travis-ci.com/user/languages/r/) -language: r -cache: packages -warnings_are_errors: true -os: - - linux - # - windows -dist: focal - -jobs: - include: - - name: linux-focal - os: linux - dist: focal - env: R_CODECOV=true - # - name: windows-focal - # os: windows - # dist: focal - # env: R_CODECOV=false - # - name: osx-current - # os: osx - # # addons: - # # homebrew: - # # packages: curl - # # before_install: - # # - brew install curl - # # - brew link --force curl - # latex: false - # r_build_args: '--no-build-vignettes' - # r_check_args: '--ignore-vignettes --no-examples' - -r_github_packages: - - r-lib/covr - -after_success: - - if [[ "${R_CODECOV}" ]]; then Rscript -e 'covr::codecov()'; fi - # - Rscript -e 'covr::coveralls()' From 032976bee153bdd385543e551c80a8d24f62dec5 Mon Sep 17 00:00:00 2001 From: Will Beasley Date: Tue, 13 Apr 2021 17:37:46 -0500 Subject: [PATCH 17/22] try to avoid hard-coded rspms ref #98 --- .github/workflows/R-CMD-check-thorough.yaml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/R-CMD-check-thorough.yaml b/.github/workflows/R-CMD-check-thorough.yaml index 91dca73..0c11605 100644 --- a/.github/workflows/R-CMD-check-thorough.yaml +++ b/.github/workflows/R-CMD-check-thorough.yaml @@ -7,9 +7,9 @@ on: push: branches: - - dev - main - master + - dev pull_request: branches: @@ -32,11 +32,13 @@ jobs: - {os: windows-latest, r: 'devel'} - {os: windows-latest, r: 'release'} # - {os: windows-latest, r: '3.6'} - - {os: ubuntu-latest, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - - {os: ubuntu-latest, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - # - {os: ubuntu-latest, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.0.0 (ubuntu-18.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" } - # - {os: ubuntu-latest, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - # - {os: ubuntu-latest, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} + - {os: ubuntu-latest, r: 'devel'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.0.0 (ubuntu-18.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" } + - {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} + # - {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.0.0 (ubuntu-18.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" } + # - {os: ubuntu-18.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} + # - {os: ubuntu-18.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} env: RSPM: ${{ matrix.config.rspm }} From d32225a7ed2b06a1d30e36378c073d8f87270556 Mon Sep 17 00:00:00 2001 From: Will Beasley Date: Tue, 13 Apr 2021 17:56:22 -0500 Subject: [PATCH 18/22] remove rspms ref #98 --- .github/workflows/R-CMD-check-thorough.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/R-CMD-check-thorough.yaml b/.github/workflows/R-CMD-check-thorough.yaml index 0c11605..73854bc 100644 --- a/.github/workflows/R-CMD-check-thorough.yaml +++ b/.github/workflows/R-CMD-check-thorough.yaml @@ -9,7 +9,7 @@ on: branches: - main - master - - dev + # - dev pull_request: branches: @@ -34,8 +34,6 @@ jobs: # - {os: windows-latest, r: '3.6'} - {os: ubuntu-latest, r: 'devel'} - {os: ubuntu-latest, r: 'release'} - - {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.0.0 (ubuntu-18.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" } - - {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} # - {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.0.0 (ubuntu-18.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" } # - {os: ubuntu-18.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} # - {os: ubuntu-18.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} From 6b0dfa7f675dcf1595f567af873abb569abebf25 Mon Sep 17 00:00:00 2001 From: Will Beasley Date: Tue, 13 Apr 2021 18:02:45 -0500 Subject: [PATCH 19/22] update news & readme close #98; close #96 --- DESCRIPTION | 2 +- NEWS.md | 18 ++++++++++++++---- README.Rmd | 11 +++++++---- README.md | 9 +++++---- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index e66bd3d..867dc78 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: dataverse -Version: 0.3.8 +Version: 0.4.0 Title: Client for Dataverse 4+ Repositories Authors@R: c(person(given = "Will", diff --git a/NEWS.md b/NEWS.md index e2c2e18..b2ecbcb 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,10 +1,20 @@ -# CHANGES in dataverse 0.3.8 +# CHANGES in dataverse 0.4.0 (2021-04-14 CRAN) + +Core Features + * Adapt to Dataverse 5.4.1 (#94 @kuriwaki) + +Testing + * Doesn't rely on CRAN for daily tests of API functions (#96) * Upgrade testthat to 3.0 edition (#97) -* Move to GitHub Actions (#98) +* Move to GitHub Actions, and away from Travis-CI. (#98) Three GitHub Actions are defined for testing: + * thorough testing related to PRs and the main branch, + * straight-forward tests for each push to the dev branch, and + * straight-forward tests run daily at 3am # CHANGES in dataverse 0.3.3 + * More verbose error messages returned on httr failure. (#31 @EdJeeOnGithub) # CHANGES in dataverse 0.3.1 @@ -12,7 +22,7 @@ * Avoids tests in R Check if the dataverse server is not available (#77) * Avoids potential mixup of dataset ordering within a retrieved dataverse (#83) -# CHANGES in dataverse 0.3.0 (2021-01-17, CRAN) +# CHANGES in dataverse 0.3.0 (2021-01-17 CRAN) New Methods @@ -28,7 +38,7 @@ Small updates * Fix getting multiple files by id in `get_file()` (#47 @adam3smith) * Temporary files created by `get_file()` are automatically deleted. -# CHANGES dataverse 0.2.1 (2018-03-05) +# CHANGES dataverse 0.2.1 (2018-03-05 CRAN) * Export `initiate_sword_dataset()`. (h/t Justin de Benedictis-Kessner) * Pass `key`, `server`, and `...` arguments to internal `get_dataverse()` and `get_dataset()` calls. diff --git a/README.Rmd b/README.Rmd index f4a7e1b..6d46036 100644 --- a/README.Rmd +++ b/README.Rmd @@ -9,10 +9,13 @@ knitr::opts_chunk$set(results = "hold") Sys.setenv("DATAVERSE_SERVER" = "dataverse.harvard.edu") ``` -[![CRAN Version](https://www.r-pkg.org/badges/version/dataverse)](https://cran.r-project.org/package=dataverse) -![Downloads](https://cranlogs.r-pkg.org/badges/dataverse) -[![R-CMD-check](https://github.com/IQSS/dataverse-client-r/workflows/R-CMD-check/badge.svg)](https://github.com/IQSS/dataverse-client-r/actions) -[![Travis-CI Build Status](https://travis-ci.org/IQSS/dataverse-client-r.png?branch=master)](https://travis-ci.org/IQSS/dataverse-client-r) [![codecov.io](https://codecov.io/github/IQSS/dataverse-client-r/coverage.svg?branch=master)](https://codecov.io/github/IQSS/dataverse-client-r?branch=master) +[![CRAN Version](https://www.r-pkg.org/badges/version/dataverse)](https://cran.r-project.org/package=dataverse) +![Downloads](https://cranlogs.r-pkg.org/badges/dataverse) + +[![R-CMD-check-thorough](https://github.com/IQSS/dataverse-client-r/actions/workflows/R-CMD-check-thorough.yaml/badge.svg?branch=master)](https://github.com/IQSS/dataverse-client-r/actions/workflows/R-CMD-check-thorough.yaml) +[![R-CMD-check-daily](https://github.com/IQSS/dataverse-client-r/actions/workflows/R-CMD-check-daily.yaml/badge.svg?branch=master)](https://github.com/IQSS/dataverse-client-r/actions/workflows/R-CMD-check-daily.yaml) +[![R-CMD-check-dev](https://github.com/IQSS/dataverse-client-r/actions/workflows/R-CMD-check-dev.yaml/badge.svg)](https://github.com/IQSS/dataverse-client-r/actions/workflows/R-CMD-check-dev.yaml) +[![codecov.io](https://codecov.io/github/IQSS/dataverse-client-r/coverage.svg?branch=master)](https://codecov.io/github/IQSS/dataverse-client-r?branch=master) [![Dataverse Project logo](https://dataverse.org/files/dataverseorg/files/dataverse_project_logo-hp.png)](https://dataverse.org) diff --git a/README.md b/README.md index 018efca..fe41821 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,10 @@ R Client for Dataverse Repositories [![CRAN Version](https://www.r-pkg.org/badges/version/dataverse)](https://cran.r-project.org/package=dataverse) ![Downloads](https://cranlogs.r-pkg.org/badges/dataverse) -[![R-CMD-check](https://github.com/IQSS/dataverse-client-r/workflows/R-CMD-check/badge.svg)](https://github.com/IQSS/dataverse-client-r/actions) -[![Travis-CI Build -Status](https://travis-ci.org/IQSS/dataverse-client-r.png?branch=master)](https://travis-ci.org/IQSS/dataverse-client-r) + +[![R-CMD-check-thorough](https://github.com/IQSS/dataverse-client-r/actions/workflows/R-CMD-check-thorough.yaml/badge.svg?branch=master)](https://github.com/IQSS/dataverse-client-r/actions/workflows/R-CMD-check-thorough.yaml) +[![R-CMD-check-daily](https://github.com/IQSS/dataverse-client-r/actions/workflows/R-CMD-check-daily.yaml/badge.svg?branch=master)](https://github.com/IQSS/dataverse-client-r/actions/workflows/R-CMD-check-daily.yaml) +[![R-CMD-check-dev](https://github.com/IQSS/dataverse-client-r/actions/workflows/R-CMD-check-dev.yaml/badge.svg)](https://github.com/IQSS/dataverse-client-r/actions/workflows/R-CMD-check-dev.yaml) [![codecov.io](https://codecov.io/github/IQSS/dataverse-client-r/coverage.svg?branch=master)](https://codecov.io/github/IQSS/dataverse-client-r?branch=master) [![Dataverse Project @@ -107,7 +108,7 @@ nlsw <- ## Downloading ingested version of data with readr::read_tsv. To download the original version and remove this message, set original = TRUE. ## - ## ── Column specification ──────────────────────────────────────────────────────────────────────────────────────────────── + ## -- Column specification ------------------------------------------------------------------------------------------------ ## cols( ## idcode = col_double(), ## age = col_double(), From 98ffa8d7f9a15917adbc74923bf97c36c6d0ef8d Mon Sep 17 00:00:00 2001 From: Shiro Kuriwaki Date: Tue, 13 Apr 2021 22:42:47 -0400 Subject: [PATCH 20/22] Clean up metadata function examples, even though they don't get run --- R/get_dataset.R | 31 +++++++++++-------------------- R/get_dataverse.R | 20 +++++--------------- man/get_dataset.Rd | 31 +++++++++++-------------------- man/get_dataverse.Rd | 21 +++++---------------- 4 files changed, 32 insertions(+), 71 deletions(-) diff --git a/R/get_dataset.R b/R/get_dataset.R index 39b571a..6a2e1cf 100644 --- a/R/get_dataset.R +++ b/R/get_dataset.R @@ -1,6 +1,6 @@ #' @rdname get_dataset #' @title Get dataset -#' @description Retrieve a Dataverse dataset or its metadata +#' @description Retrieve a Dataverse dataset metadata #' #' @details #' \code{get_dataset} retrieves details about a Dataverse dataset. @@ -14,6 +14,8 @@ #' \dQuote{dataverse_dataset} objects, whereas \code{\link{get_dataset}} returns #' metadata and a data.frame of files (rather than a list of file objects). #' +#' To download actual datafiles, see \code{\link{get_file}} or \code{\link{get_dataframe_by_name}}. +#' #' @template ds #' @template version #' @template envvars @@ -21,30 +23,19 @@ #' @return A list of class \dQuote{dataverse_dataset} or a list of a form dependent on the specific metadata block retrieved. \code{dataset_files} returns a list of objects of class \dQuote{dataverse_file}. #' @examples #' \dontrun{ +#' # https://demo.dataverse.org/dataverse/dataverse-client-r #' Sys.setenv("DATAVERSE_SERVER" = "demo.dataverse.org") -#' Sys.setenv("DATAVERSE_KEY" = "c7208dd2-6ec5-469a-bec5-f57e164888d4") -#' -#' # Download file from: https://demo.dataverse.org/file.xhtml?fileId=769385 -#' dv <- get_dataverse("dataverse-client-r") -#' contents <- dataverse_contents(dv) -#' -#' dataset_files(contents[[1]]) # Dataset contains 2 files -#' dataset_metadata(contents[[1]]) # Easier to query later #' -#' set <- get_dataset(contents[[1]]) # 1st dataset w/n dataverse -#' f <- get_file(set$files$id[2]) # 2nd file w/n dataset +#' # download file from: +#' dv <- get_dataverse("dataverse-client-r") +#' contents <- dataverse_contents(dv)[[1]] #' -#' # Check the *binary* representation of the file. -#' length(f) -#' head(f) +#' dataset_files(contents[[1]]) +#' get_dataset(contents[[1]]) +#' dataset_metadata(contents[[1]]) #' -#' # Examine the plain-text representation. -#' tmp <- tempfile(fileext = "svg") -#' writeBin(as.vector(f), tmp) -#' svg_lines <- readLines(tmp) -#' head(svg_lines) #' } -#' @seealso \code{\link{create_dataset}}, \code{\link{update_dataset}}, \code{\link{delete_dataset}}, \code{\link{publish_dataset}}, \code{\link{dataset_files}}, \code{\link{dataset_metadata}} +#' @seealso \code{\link{get_file}} #' @export get_dataset <- function( dataset, diff --git a/R/get_dataverse.R b/R/get_dataverse.R index 5d1f07e..ff51744 100644 --- a/R/get_dataverse.R +++ b/R/get_dataverse.R @@ -12,28 +12,18 @@ #' #' @examples #' \dontrun{ -#' # download file from: #' # https://demo.dataverse.org/dataverse/dataverse-client-r #' Sys.setenv("DATAVERSE_SERVER" = "demo.dataverse.org") +#' #' # download file from: #' dv <- get_dataverse("dataverse-client-r") -#' (contents <- dataverse_contents(dv)) #' #' # get a dataset from the dataverse -#' d1 <- get_dataset(contents[[1]]) -#' f <- get_file(d1$files$id[1]) -#' } -#' @seealso To manage Dataverses: -#' \code{\link{create_dataverse}}, -#' \code{\link{delete_dataverse}}, -#' \code{\link{publish_dataverse}}, -#' \code{\link{dataverse_contents}}; +#' (d1 <- get_dataset(dataverse_contents(dv)[[1]])) #' -#' To get datasets: -#' \code{\link{get_dataset}}; -#' -#' To search for Dataverses, datasets, or files: -#' \code{\link{dataverse_search}} +#' # download a file using the metadata +#' get_dataframe_by_name("roster-bulls-1996.tab", d1$datasetPersistentId) +#' } #' #' @export get_dataverse <- function(dataverse, key = Sys.getenv("DATAVERSE_KEY"), server = Sys.getenv("DATAVERSE_SERVER"), check = TRUE, ...) { diff --git a/man/get_dataset.Rd b/man/get_dataset.Rd index 2611456..f030489 100644 --- a/man/get_dataset.Rd +++ b/man/get_dataset.Rd @@ -58,7 +58,7 @@ or globally using \code{Sys.setenv("DATAVERSE_SERVER" = "dataverse.example.com") A list of class \dQuote{dataverse_dataset} or a list of a form dependent on the specific metadata block retrieved. \code{dataset_files} returns a list of objects of class \dQuote{dataverse_file}. } \description{ -Retrieve a Dataverse dataset or its metadata +Retrieve a Dataverse dataset metadata } \details{ \code{get_dataset} retrieves details about a Dataverse dataset. @@ -71,33 +71,24 @@ you to retrieve just a specific block of metadata, such as citation information. \code{\link{get_dataset}}. The difference is that this returns only a list of \dQuote{dataverse_dataset} objects, whereas \code{\link{get_dataset}} returns metadata and a data.frame of files (rather than a list of file objects). + +To download actual datafiles, see \code{\link{get_file}} or \code{\link{get_dataframe_by_name}}. } \examples{ \dontrun{ +# https://demo.dataverse.org/dataverse/dataverse-client-r Sys.setenv("DATAVERSE_SERVER" = "demo.dataverse.org") -Sys.setenv("DATAVERSE_KEY" = "c7208dd2-6ec5-469a-bec5-f57e164888d4") - -# Download file from: https://demo.dataverse.org/file.xhtml?fileId=769385 -dv <- get_dataverse("dataverse-client-r") -contents <- dataverse_contents(dv) - -dataset_files(contents[[1]]) # Dataset contains 2 files -dataset_metadata(contents[[1]]) # Easier to query later -set <- get_dataset(contents[[1]]) # 1st dataset w/n dataverse -f <- get_file(set$files$id[2]) # 2nd file w/n dataset +# download file from: +dv <- get_dataverse("dataverse-client-r") +contents <- dataverse_contents(dv)[[1]] -# Check the *binary* representation of the file. -length(f) -head(f) +dataset_files(contents[[1]]) +get_dataset(contents[[1]]) +dataset_metadata(contents[[1]]) -# Examine the plain-text representation. -tmp <- tempfile(fileext = "svg") -writeBin(as.vector(f), tmp) -svg_lines <- readLines(tmp) -head(svg_lines) } } \seealso{ -\code{\link{create_dataset}}, \code{\link{update_dataset}}, \code{\link{delete_dataset}}, \code{\link{publish_dataset}}, \code{\link{dataset_files}}, \code{\link{dataset_metadata}} +\code{\link{get_file}} } diff --git a/man/get_dataverse.Rd b/man/get_dataverse.Rd index a9a4057..6d0de88 100644 --- a/man/get_dataverse.Rd +++ b/man/get_dataverse.Rd @@ -50,28 +50,17 @@ Retrieve details of a Dataverse } \examples{ \dontrun{ -# download file from: # https://demo.dataverse.org/dataverse/dataverse-client-r Sys.setenv("DATAVERSE_SERVER" = "demo.dataverse.org") + # download file from: dv <- get_dataverse("dataverse-client-r") -(contents <- dataverse_contents(dv)) # get a dataset from the dataverse -d1 <- get_dataset(contents[[1]]) -f <- get_file(d1$files$id[1]) -} -} -\seealso{ -To manage Dataverses: -\code{\link{create_dataverse}}, -\code{\link{delete_dataverse}}, -\code{\link{publish_dataverse}}, -\code{\link{dataverse_contents}}; +(d1 <- get_dataset(dataverse_contents(dv)[[1]])) -To get datasets: -\code{\link{get_dataset}}; +# download a file using the metadata +get_dataframe_by_name("roster-bulls-1996.tab", d1$datasetPersistentId) +} -To search for Dataverses, datasets, or files: -\code{\link{dataverse_search}} } From 04020ddb25459b2ea264d2354712bc35e4f5c4f1 Mon Sep 17 00:00:00 2001 From: Shiro Kuriwaki Date: Tue, 13 Apr 2021 22:46:46 -0400 Subject: [PATCH 21/22] minor style --- tests/testthat/tests-get_file.R | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/testthat/tests-get_file.R b/tests/testthat/tests-get_file.R index cf51af4..fa90e6c 100644 --- a/tests/testthat/tests-get_file.R +++ b/tests/testthat/tests-get_file.R @@ -40,9 +40,8 @@ test_that("download multiple files with file id - no folder", { test_that("download multiple files with file id - with folders", { # testthat::skip_if_offline("demo.dataverse.org") testthat::skip_on_cran() - # file_ids <- get_dataset("doi:10.70122/FK2/V54HGA", server = "demo.dataverse.org")[['files']]$id file_ids <- get_dataset("doi:10.70122/FK2/HXJVJU", server = "demo.dataverse.org")[['files']]$id - actual <- get_file(file_ids, format="original", server = "demo.dataverse.org") + actual <- get_file(file_ids, format = "original", server = "demo.dataverse.org") expect_true(length(actual) == 2) # two files in the dataset expect_true(is.raw(actual[[2]])) expect_true(object.size(actual[[2]]) > 70) # Should be >70 B From 30c33d04bd80c116dced19a78d97889cd58b0141 Mon Sep 17 00:00:00 2001 From: Will Beasley Date: Tue, 13 Apr 2021 23:15:45 -0500 Subject: [PATCH 22/22] rename to v3.8 ref #99, @kuriwaki --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index b2ecbcb..3228fde 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# CHANGES in dataverse 0.4.0 (2021-04-14 CRAN) +# CHANGES in dataverse 0.3.8 (2021-04-14 CRAN) Core Features