From df495b35ccbbb5bd459a05bee6342258f6cc5c73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Sch=C3=B6bitz?= Date: Tue, 19 Sep 2023 21:41:32 +0200 Subject: [PATCH] Fix citation; add R-CMD-check --- .Rbuildignore | 1 + .github/.gitignore | 1 + .github/workflows/R-CMD-check.yaml | 49 ++++++++++++++++++++++++++++++ CITATION.cff | 18 ----------- README.Rmd | 2 +- data-raw/data_processing.R | 28 ----------------- data-raw/package_processing.R | 32 +++++++++++++++++++ inst/CITATION | 6 ++-- 8 files changed, 87 insertions(+), 50 deletions(-) create mode 100644 .github/.gitignore create mode 100644 .github/workflows/R-CMD-check.yaml diff --git a/.Rbuildignore b/.Rbuildignore index 615c15b..acc0ce8 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -10,3 +10,4 @@ ^_pkgdown\.yml$ ^docs$ ^pkgdown$ +^\.github$ diff --git a/.github/.gitignore b/.github/.gitignore new file mode 100644 index 0000000..2d19fc7 --- /dev/null +++ b/.github/.gitignore @@ -0,0 +1 @@ +*.html diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml new file mode 100644 index 0000000..a3ac618 --- /dev/null +++ b/.github/workflows/R-CMD-check.yaml @@ -0,0 +1,49 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +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: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'oldrel-1'} + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes + + steps: + - uses: actions/checkout@v3 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck + needs: check + + - uses: r-lib/actions/check-r-package@v2 + with: + upload-snapshots: true diff --git a/CITATION.cff b/CITATION.cff index d9b9c69..ffb10e6 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -23,24 +23,6 @@ authors: - family-names: Kramer given-names: Sasha email: skramer@oursoil.org -preferred-citation: - type: generic - title: 'cbssuitabilityhaiti: The Package contains data from the Soil projects in - Haiti' - authors: - - family-names: Loos - given-names: Sebastian Camilo - email: seba.loos@hotmail.com - orcid: https://orcid.org/0000-0003-2196-5015 - - family-names: Lubeck-Schricker - given-names: Maya - email: mlubeck-schricker@oursoil.org - - family-names: Kramer - given-names: Sasha - email: skramer@oursoil.org - year: '2023' - abstract: What the package does (one paragraph). - version: 0.0.0.9000 date-released: '2023-09-19' contact: - family-names: Loos diff --git a/README.Rmd b/README.Rmd index 64ee8ee..7f660f2 100644 --- a/README.Rmd +++ b/README.Rmd @@ -35,7 +35,7 @@ library(cbssuitabilityhaiti) [![DOI](ZENODO_DOI_URL.svg)](ZENODO_DOI_URL) [![R-CMD-check](https://github.com/openwashdata/cbssuitabilityhaiti/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/openwashdata/cbs suitabilityhaiti/actions/workflows/R-CMD-check.yaml) [![License: CC BY 4.0](https://img.shields.io/badge/License-CC_BY_4.0-lightgrey.svg)](https://creativecommons.org/licenses/by/4.0/) - +[![R-CMD-check](https://github.com/openwashdata/cbssuitabilityhaiti/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/openwashdata/cbssuitabilityhaiti/actions/workflows/R-CMD-check.yaml) The goal of `cbssuitabiility` is to provide datasets for research and diff --git a/data-raw/data_processing.R b/data-raw/data_processing.R index f3aefff..e3fffb0 100644 --- a/data-raw/data_processing.R +++ b/data-raw/data_processing.R @@ -146,31 +146,3 @@ dictionary <- get_variable_info(data = list(okap, mwater), # dictionary |> # openxlsx::write.xlsx("data-raw/dictionary.xlsx") -# install.packages("cffr") -library(cffr) - -packageVersion("cffr") - -# Hard code doi -# doi <- "10.5281/zenodo.6470427" - -# creates CFF with all author roles -mod_cff <- cff_create("DESCRIPTION", - dependencies = FALSE, - keys = list(#"doi" = doi, - "date-released" = Sys.Date())) - -# writes the CFF file -cff_write(mod_cff) - -# Now write a CITATION file from the CITATION.cff file -# Use inst/CITATION instead (the default if not provided) -path_cit <- file.path("inst/CITATION") - -write_citation("CITATION.cff", file = path_cit) - -# By last, read the citation -cat(readLines(path_cit), sep = "\n") - -# Start of inst/CITATION -utils::readCitationFile("inst/CITATION") diff --git a/data-raw/package_processing.R b/data-raw/package_processing.R index 7cb8f46..89ac54f 100644 --- a/data-raw/package_processing.R +++ b/data-raw/package_processing.R @@ -191,3 +191,35 @@ usethis::use_pkgdown() # Build pkgdown website pkgdown::build_site() + +# install.packages("cffr") +library(cffr) + +packageVersion("cffr") + +# Hard code doi +# doi <- "10.5281/zenodo.6470427" + +# creates CFF with all author roles +mod_cff <- cff_create("DESCRIPTION", + dependencies = FALSE, + keys = list(#"doi" = doi, + "date-released" = Sys.Date())) + +# Remove the preferred-citation key +mod_cff$`preferred-citation` <- NULL + +# writes the CFF file +cff_write(mod_cff) + +# Now write a CITATION file from the CITATION.cff file +# Use inst/CITATION instead (the default if not provided) +path_cit <- file.path("inst/CITATION") + +write_citation("CITATION.cff", file = path_cit) + +# By last, read the citation +cat(readLines(path_cit), sep = "\n") + +# Start of inst/CITATION +utils::readCitationFile("inst/CITATION") diff --git a/inst/CITATION b/inst/CITATION index 941e2ce..3d669fd 100644 --- a/inst/CITATION +++ b/inst/CITATION @@ -1,7 +1,7 @@ bibentry(bibtype = "Misc", - key = "looslubeckschricker:2023", - title = "cbssuitabilityhaiti: The Package contains data from the Soil projects in Haiti", + key = "looslubeckschricker", + title = "cbssuitabilityhaiti: This package contains data for a sanitation zoning assessment done for the city of Cap Haitien, Haiti. It combines two datasets used for an analysis of the suitability of container-based sanitation (CBS).", author = c(person(given = "Sebastian Camilo", family = "Loos"), person(given = "Maya", @@ -10,4 +10,4 @@ bibentry(bibtype = "Misc", family = "Kramer")), year = "2023", abstract = "What the package does (one paragraph).", - version = "0.0.0.9000") + version = "0.0.1")