From e5b0cfef60e02bdce49bc79800d4930700be262f Mon Sep 17 00:00:00 2001 From: Ryan Patrick Kyle Date: Mon, 3 Aug 2020 13:27:16 -0400 Subject: [PATCH 1/3] contribute test script --- .Rbuildignore | 2 ++ tests/circleci/fixup_metadata.R | 39 +++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 tests/circleci/fixup_metadata.R diff --git a/.Rbuildignore b/.Rbuildignore index bc905639..c687d3d2 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -5,3 +5,5 @@ Makefile announcement\.Rmd todo\.txt .github +tests/integration +tests/circleci diff --git a/tests/circleci/fixup_metadata.R b/tests/circleci/fixup_metadata.R new file mode 100644 index 00000000..fe04276a --- /dev/null +++ b/tests/circleci/fixup_metadata.R @@ -0,0 +1,39 @@ +# this script uses regex to edit the DESCRIPTION file within each of the Dash core +# packages as required to test bleeding edge builds +# +# to avoid spurious versioning errors, we loosen the version restriction here so +# that it is >= rather than the == format currently applied to release packages for +# testing purposes only + +# capture DESCRIPTION data for dash, dashTable, dashCoreComponents, dashHtmlComponents +dash_desc <- read.dcf("dashR/DESCRIPTION") +dt_version <- read.dcf("dash-table/DESCRIPTION")[,"Version"] +dcc_version <- read.dcf("dash-core-components/DESCRIPTION")[,"Version"] +dhc_version <- read.dcf("dash-html-components/DESCRIPTION")[,"Version"] + +# capture Imports data for dashTable, dashCoreComponents, dashHtmlComponents, +# edit the Imports section of dash's DESCRIPTION as required, update dash_desc +imports <- dash_desc[,"Imports"][[1]] +imports <- gsub("((?<=dashHtmlComponents )(\\\\(.*?\\\\)))", paste0("(= ", dhc_version, ")"), imports, perl = TRUE) +imports <- gsub("((?<=dashCoreComponents )(\\\\(.*?\\\\)))", paste0("(= ", dcc_version, ")"), imports, perl = TRUE) +imports <- gsub("((?<=dashTable )(\\\\(.*?\\\\)))", paste0("(= ", dt_version, ")"), imports, perl = TRUE) + +# loosen version restriction to prevent versioning errors at release time +imports <- gsub("==", ">=", imports, perl=TRUE) + +dash_desc[,"Imports"][[1]] <- imports + +# obtain the latest commit hash for dashTable, dashCoreComponents, dashHtmlComponents, and save +dhc_hash <- system("cd dash-html-components; git rev-parse HEAD | tr -d '\''\n'\''", intern=TRUE) +dcc_hash <- system("cd dash-core-components; git rev-parse HEAD | tr -d '\''\n'\''", intern=TRUE) +dt_hash <- system("cd dash-table; git rev-parse HEAD | tr -d '\''\n'\''", intern=TRUE) +remotes <- dash_desc[,"Remotes"][[1]] + +# edit the Remotes section of dash's DESCRIPTION as required to update hashes, update dash_desc +remotes <- gsub("((?<=plotly\\\\/dash-html-components@)([a-zA-Z0-9]+))", dhc_hash, remotes, perl=TRUE) +remotes <- gsub("((?<=plotly\\\\/dash-core-components@)([a-zA-Z0-9]+))", dcc_hash, remotes, perl=TRUE) +remotes <- gsub("((?<=plotly\\\\/dash-table@)([a-zA-Z0-9]+))", dt_hash, remotes, perl=TRUE) +dash_desc[,"Remotes"][[1]] <- remotes + +# write the updated DESCRIPTION back to the dash package directory for installation +write.dcf(dash_desc, "dashR/DESCRIPTION") \ No newline at end of file From a242d4983ea38e825bc4e848906987f2a7c37f73 Mon Sep 17 00:00:00 2001 From: Ryan Patrick Kyle Date: Mon, 3 Aug 2020 13:31:31 -0400 Subject: [PATCH 2/3] remove version updating in DESCRIPTION --- tests/circleci/fixup_metadata.R | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/circleci/fixup_metadata.R b/tests/circleci/fixup_metadata.R index fe04276a..d236ebb3 100644 --- a/tests/circleci/fixup_metadata.R +++ b/tests/circleci/fixup_metadata.R @@ -11,14 +11,11 @@ dt_version <- read.dcf("dash-table/DESCRIPTION")[,"Version"] dcc_version <- read.dcf("dash-core-components/DESCRIPTION")[,"Version"] dhc_version <- read.dcf("dash-html-components/DESCRIPTION")[,"Version"] -# capture Imports data for dashTable, dashCoreComponents, dashHtmlComponents, -# edit the Imports section of dash's DESCRIPTION as required, update dash_desc +# capture Imports data for dashTable, dashCoreComponents, dashHtmlComponents imports <- dash_desc[,"Imports"][[1]] -imports <- gsub("((?<=dashHtmlComponents )(\\\\(.*?\\\\)))", paste0("(= ", dhc_version, ")"), imports, perl = TRUE) -imports <- gsub("((?<=dashCoreComponents )(\\\\(.*?\\\\)))", paste0("(= ", dcc_version, ")"), imports, perl = TRUE) -imports <- gsub("((?<=dashTable )(\\\\(.*?\\\\)))", paste0("(= ", dt_version, ")"), imports, perl = TRUE) -# loosen version restriction to prevent versioning errors at release time +# loosen version restriction to prevent versioning errors at release time, +# edit the Imports section of dash's DESCRIPTION as required, then update dash_desc imports <- gsub("==", ">=", imports, perl=TRUE) dash_desc[,"Imports"][[1]] <- imports From f1b81d6907775a167d5aee3cee0068b276712f35 Mon Sep 17 00:00:00 2001 From: Ryan Patrick Kyle Date: Mon, 3 Aug 2020 21:05:53 -0400 Subject: [PATCH 3/3] fix EOL Co-authored-by: HammadTheOne <30986043+HammadTheOne@users.noreply.github.com> --- tests/circleci/fixup_metadata.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/circleci/fixup_metadata.R b/tests/circleci/fixup_metadata.R index d236ebb3..2b95340a 100644 --- a/tests/circleci/fixup_metadata.R +++ b/tests/circleci/fixup_metadata.R @@ -33,4 +33,4 @@ remotes <- gsub("((?<=plotly\\\\/dash-table@)([a-zA-Z0-9]+))", dt_hash, remotes, dash_desc[,"Remotes"][[1]] <- remotes # write the updated DESCRIPTION back to the dash package directory for installation -write.dcf(dash_desc, "dashR/DESCRIPTION") \ No newline at end of file +write.dcf(dash_desc, "dashR/DESCRIPTION")