From f963a273be71a134c8c3d4cb9bd5f42089987434 Mon Sep 17 00:00:00 2001 From: Mengqi Zhao Date: Sun, 4 Aug 2024 17:37:42 -0700 Subject: [PATCH] Fix the CITATION location and update test_coverage to download test data --- .github/workflows/test_coverage.yml | 4 ++++ inst/CITATION/CITATION.cff => CITATION.cff | 0 man/get_example_data.Rd | 2 ++ tests/download_example_data.R | 18 ++++++++++++++++++ 4 files changed, 24 insertions(+) rename inst/CITATION/CITATION.cff => CITATION.cff (100%) create mode 100644 tests/download_example_data.R diff --git a/.github/workflows/test_coverage.yml b/.github/workflows/test_coverage.yml index 76e4802..89a2c22 100644 --- a/.github/workflows/test_coverage.yml +++ b/.github/workflows/test_coverage.yml @@ -40,6 +40,10 @@ jobs: remotes::install_deps(dependencies = TRUE, upgrade = "never") shell: Rscript {0} + - name: Download example data + run: | + Rscript tests/download_example_data.R + - name: Test coverage run: | remotes::install_cran("covr") diff --git a/inst/CITATION/CITATION.cff b/CITATION.cff similarity index 100% rename from inst/CITATION/CITATION.cff rename to CITATION.cff diff --git a/man/get_example_data.Rd b/man/get_example_data.Rd index f1309cd..5b839fe 100644 --- a/man/get_example_data.Rd +++ b/man/get_example_data.Rd @@ -13,6 +13,8 @@ get_example_data( \arguments{ \item{download_url}{Link to the downloadable dataset} +\item{file_extension}{String of file extension without "."} + \item{data_dir}{Path of desired location to download data} } \description{ diff --git a/tests/download_example_data.R b/tests/download_example_data.R new file mode 100644 index 0000000..4952774 --- /dev/null +++ b/tests/download_example_data.R @@ -0,0 +1,18 @@ + + + +download_test_data <- function() { + + # download test data + output_dir_i <- file.path(getwd(), 'output') + + data_dir_i <- gaea::get_example_data( + download_url = 'https://zenodo.org/records/13179630/files/weighted_climate.zip?download=1', + data_dir = output_dir_i) + +} + +# Run the function if this script is being sourced +if (!interactive()) { + download_test_data() +}