From 14ea097aed4d361f07d9640889f4978818c45fce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Vitor?= Date: Sat, 2 Sep 2023 16:38:52 -0300 Subject: [PATCH] ci: Change branches in ci config (#2) * ci: Change branches in ci config * ci: Update r-cmd-check version * ci: Remove old CI * docs: Remove useless examples and redocument * refactor: Update utils-pipe --- .github/workflows/R-CMD-check.yaml | 49 ++++++++++++++++ .github/workflows/check-standard.yaml | 82 -------------------------- .github/workflows/pkgdown.yaml | 84 +++++++++++++-------------- DESCRIPTION | 2 +- R/utils-pipe.R | 4 +- R/utils.R | 7 --- README.Rmd | 2 +- README.md | 19 +++--- man/dot-collapse_as_values.Rd | 3 - man/dot-get_species_item.Rd | 3 - man/dot-remove_wdt_url.Rd | 3 - man/pipe.Rd | 20 +++++++ 12 files changed, 125 insertions(+), 153 deletions(-) create mode 100644 .github/workflows/R-CMD-check.yaml delete mode 100644 .github/workflows/check-standard.yaml create mode 100644 man/pipe.Rd 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/.github/workflows/check-standard.yaml b/.github/workflows/check-standard.yaml deleted file mode 100644 index 638bb0c..0000000 --- a/.github/workflows/check-standard.yaml +++ /dev/null @@ -1,82 +0,0 @@ -# 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: - - dev - pull_request: - branches: - - dev - -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: windows-latest, r: 'release'} - - {os: macOS-latest, r: 'release'} - - {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - - {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - - env: - R_REMOTES_NO_ERRORS_FROM_WARNINGS: true - RSPM: ${{ matrix.config.rspm }} - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - - steps: - - uses: actions/checkout@v2 - - - uses: r-lib/actions/setup-r@v1 - with: - r-version: ${{ matrix.config.r }} - - - uses: r-lib/actions/setup-pandoc@v1 - - - 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@v2 - 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' - run: | - while read -r cmd - do - eval sudo $cmd - done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') - - - name: Install dependencies - run: | - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("rcmdcheck") - shell: Rscript {0} - - - name: Check - env: - _R_CHECK_CRAN_INCOMING_REMOTE_: false - run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--no-examples","--as-cran"), error_on = "error", check_dir = "check") - shell: Rscript {0} - - - name: Upload check results - if: failure() - uses: actions/upload-artifact@main - with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 65abf83..e9edb68 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -1,47 +1,47 @@ on: - push: - branches: - - dev + push: + branches: + - master name: pkgdown jobs: - pkgdown: - runs-on: macOS-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@v1 - - - 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 - uses: actions/cache@v2 - 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 dependencies - run: | - remotes::install_deps(dependencies = TRUE) - install.packages("pkgdown", type = "binary") - shell: Rscript {0} - - - name: Install package - run: R CMD INSTALL . - - - name: Deploy package - run: | - git config --local user.email "actions@github.com" - git config --local user.name "GitHub Actions" - Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)' + pkgdown: + runs-on: macOS-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@v1 + + - 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 + uses: actions/cache@v2 + 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 dependencies + run: | + remotes::install_deps(dependencies = TRUE) + install.packages("pkgdown", type = "binary") + shell: Rscript {0} + + - name: Install package + run: R CMD INSTALL . + + - name: Deploy package + run: | + git config --local user.email "actions@github.com" + git config --local user.name "GitHub Actions" + Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)' diff --git a/DESCRIPTION b/DESCRIPTION index 908d3ff..47a4df3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -23,7 +23,7 @@ Suggests: testthat, knitr, rmarkdown -RoxygenNote: 7.1.0 +RoxygenNote: 7.2.3 Imports: magrittr, dplyr, diff --git a/R/utils-pipe.R b/R/utils-pipe.R index b6dba2e..fd0b1d1 100644 --- a/R/utils-pipe.R +++ b/R/utils-pipe.R @@ -8,5 +8,7 @@ #' @export #' @importFrom magrittr %>% #' @usage lhs \%>\% rhs -#' @noRd +#' @param lhs A value or the magrittr placeholder. +#' @param rhs A function call using the magrittr semantics. +#' @return The result of calling `rhs(lhs)`. NULL diff --git a/R/utils.R b/R/utils.R index 10e3d17..425f9f2 100644 --- a/R/utils.R +++ b/R/utils.R @@ -4,8 +4,6 @@ #' @param quotes A logical to indicate whether or not to encase in quotes #' #' @return A SPARQL-compatible string of the values -#' @examples -#' .collapse_as_values(c("GO:0006936", "GO:0008152")) .collapse_as_values <- function(item_vector, quotes = FALSE) { unique_items <- stringr::str_trim(unique(item_vector)) @@ -21,8 +19,6 @@ #' @param column The column of the dataframe to substitute #' #' @return A character vector -#' @examples -#' .remove_wdt_url("http://www.wikidata.org/entity/Q18031649") .remove_wdt_url <- function(column) { stringr::str_replace_all( column, "http://www.wikidata.org/entity/", @@ -35,9 +31,6 @@ #' @param species_name The scientific name of the species #' #' @return The Wikidata item for said species -#' -#' @examples -#' .get_species_item("Homo sapiens") .get_species_item <- function(species_name) { values <- c("Q15978631", "Q83310") names(values) <- c("Homo sapiens", "Mus musculus") diff --git a/README.Rmd b/README.Rmd index 71f1e78..2a8247e 100644 --- a/README.Rmd +++ b/README.Rmd @@ -18,8 +18,8 @@ devtools::load_all() -[![R build status](https://github.com/jvfe/go2cell/workflows/R-CMD-check/badge.svg)](https://github.com/jvfe/go2cell/actions) [![docs](https://github.com/jvfe/go2cell/workflows/pkgdown/badge.svg)](https://jvfe.github.io/go2cell/index.html) +[![R-CMD-check](https://github.com/jvfe/go2cell/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jvfe/go2cell/actions/workflows/R-CMD-check.yaml) By using [Wikidata](https://www.wikidata.org/wiki/Wikidata:Main_Page), go2cell links Gene Ontology terms to cell types, therefore enriching Omics results with open semantic knowledge. diff --git a/README.md b/README.md index b525e90..5c9cc19 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,8 @@ -[![R build -status](https://github.com/jvfe/go2cell/workflows/R-CMD-check/badge.svg)](https://github.com/jvfe/go2cell/actions) [![docs](https://github.com/jvfe/go2cell/workflows/pkgdown/badge.svg)](https://jvfe.github.io/go2cell/index.html) +[![R-CMD-check](https://github.com/jvfe/go2cell/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jvfe/go2cell/actions/workflows/R-CMD-check.yaml) By using [Wikidata](https://www.wikidata.org/wiki/Wikidata:Main_Page), @@ -36,11 +35,11 @@ go_ids <- c("GO:0006936", "GO:0009100") results <- go2cell(go_ids) ``` -| cell\_type | cell\_typeLabel | go\_ids | go\_termLabel | geneLabel | -| :------------ | :------------------ | :----------- | :----------------- | :-------- | -| wd:Q101404903 | human myocyte | | muscle contraction | ANKRD2 | -| wd:Q101404861 | human fibroblast | | muscle contraction | TBX20 | -| wd:Q101405077 | human cardiomyocyte | | muscle contraction | TBX20 | -| wd:Q101405077 | human cardiomyocyte | | muscle contraction | CKMT2 | -| wd:Q101405077 | human cardiomyocyte | | muscle contraction | MYBPC3 | -| wd:Q101404903 | human myocyte | | muscle contraction | MYH1 | +| cell_type | cell_typeLabel | go_ids | go_termLabel | geneLabel | +|:--------------|:----------------------------|:-------------|:-------------------|:----------| +| wd:Q101404903 | human myocyte | | muscle contraction | ACTN2 | +| wd:Q101405077 | human cardiomyocyte | | muscle contraction | ACTN2 | +| wd:Q101404861 | human fibroblast | | muscle contraction | TBX20 | +| wd:Q101405077 | human cardiomyocyte | | muscle contraction | TBX20 | +| wd:Q68620817 | human hepatic stellate cell | | muscle contraction | DES | +| wd:Q101404901 | human smooth muscle cell | | muscle contraction | DES | diff --git a/man/dot-collapse_as_values.Rd b/man/dot-collapse_as_values.Rd index 282d231..f5b3d2c 100644 --- a/man/dot-collapse_as_values.Rd +++ b/man/dot-collapse_as_values.Rd @@ -17,6 +17,3 @@ A SPARQL-compatible string of the values \description{ Format string or character vector as SPARQL-compatible list } -\examples{ -.collapse_as_values(c("GO:0006936", "GO:0008152")) -} diff --git a/man/dot-get_species_item.Rd b/man/dot-get_species_item.Rd index c530368..cd29a24 100644 --- a/man/dot-get_species_item.Rd +++ b/man/dot-get_species_item.Rd @@ -15,6 +15,3 @@ The Wikidata item for said species \description{ Return the item for a particular species } -\examples{ -.get_species_item("Homo sapiens") -} diff --git a/man/dot-remove_wdt_url.Rd b/man/dot-remove_wdt_url.Rd index cbb6459..c8fb8cc 100644 --- a/man/dot-remove_wdt_url.Rd +++ b/man/dot-remove_wdt_url.Rd @@ -15,6 +15,3 @@ A character vector \description{ Substitute the wikidata url for a SPARQL-friendly wd: } -\examples{ -.remove_wdt_url("http://www.wikidata.org/entity/Q18031649") -} diff --git a/man/pipe.Rd b/man/pipe.Rd new file mode 100644 index 0000000..1f8f237 --- /dev/null +++ b/man/pipe.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils-pipe.R +\name{\%>\%} +\alias{\%>\%} +\title{Pipe operator} +\usage{ +lhs \%>\% rhs +} +\arguments{ +\item{lhs}{A value or the magrittr placeholder.} + +\item{rhs}{A function call using the magrittr semantics.} +} +\value{ +The result of calling `rhs(lhs)`. +} +\description{ +See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details. +} +\keyword{internal}