Skip to content

Commit

Permalink
🔀 Merge pull request #28 from cnr-ibba/devel
Browse files Browse the repository at this point in the history
🔖 release v0.2.0
  • Loading branch information
bunop authored Jun 28, 2024
2 parents 4f23ac6 + 9b71e0c commit 1cb0f86
Show file tree
Hide file tree
Showing 42 changed files with 4,220 additions and 1,443 deletions.
33 changes: 12 additions & 21 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# 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: [master, devel]
branches: [master]
pull_request:
branches: [master, devel]

Expand All @@ -16,41 +16,32 @@ env:

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'release'}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install dependencies on Linux
if: runner.os == 'Linux'
run: sudo apt-get update -y && sudo apt-get install -y libcurl4-openssl-dev
libgdal-dev libudunits2-dev libharfbuzz-dev libfribidi-dev

- name: Install dependencies on MacOS
if: runner.os == 'macOS'
run: brew install gdal

- 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 }}
r-version: 'release'
http-user-agent: 'default'
use-public-rspm: true

- uses: r-lib/actions/setup-renv@v2
with:
cache-version: 2
cache-version: 1
profile: '"dev"'

- uses: r-lib/actions/check-r-package@v2
with:
Expand All @@ -65,5 +56,5 @@ jobs:
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
name: Linux-rrelease-results
path: check
60 changes: 60 additions & 0 deletions .github/workflows/install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# 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: [master]
pull_request:
branches: [master, devel]

name: install

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
SMARTER_API_USERNAME: ${{ secrets.SMARTER_API_USERNAME }}
SMARTER_API_PASSWORD: ${{ secrets.SMARTER_API_PASSWORD }}

jobs:
install:
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:

- name: Install dependencies on Linux
if: runner.os == 'Linux'
run: sudo apt-get update -y && sudo apt-get install -y libcurl4-openssl-dev
libgdal-dev libudunits2-dev libharfbuzz-dev libfribidi-dev

- name: Install dependencies on MacOS
if: runner.os == 'macOS'
run: brew install gdal

- 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

- name: Install devtools dependency
run: install.packages("devtools")
shell: Rscript {0}

- name: Install package with devtools
run: devtools::install_github("cnr-ibba/r-smarter-api")
shell: Rscript {0}
7 changes: 4 additions & 3 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [master, devel]
branches: [master]
pull_request:
branches: [master, devel]

Expand All @@ -16,7 +16,7 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install dependencies on Linux
run: sudo apt-get update -y && sudo apt-get install -y libcurl4-openssl-dev
Expand All @@ -28,7 +28,8 @@ jobs:

- uses: r-lib/actions/setup-renv@v2
with:
cache-version: 2
cache-version: 1
profile: '"dev"'

- name: Lint
run: lintr::lint_package()
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
SMARTER_API_PASSWORD: ${{ secrets.SMARTER_API_PASSWORD }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install dependencies on Linux
run: sudo apt-get update -y && sudo apt-get install -y libcurl4-openssl-dev
Expand All @@ -34,7 +34,8 @@ jobs:

- uses: r-lib/actions/setup-renv@v2
with:
cache-version: 2
cache-version: 1
profile: '"dev"'

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = TRUE)
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
docs
inst/doc
vignettes/*.txt
*.zip
44 changes: 29 additions & 15 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
Package: smarterapi
Title: Fetch SMARTER data through REST API
Version: 0.1.2
Authors@R:
person("Paolo", "Cozzi", , "[email protected]",
role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-0388-6874"))
Description: smarterapi is an interface which interacts with SMARTER REST API
by querying data using token authentication and providing results into
dataframes.
Title: Fetch SMARTER Data Through REST API
Version: 0.2.0.9000
Authors@R:
person(
"Paolo", "Cozzi",
email = "[email protected]",
role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-0388-6874")
)
Description:
Provides functions to fetch data from the SMARTER API, a RESTful
web service that provides access to data from the SMARTER database.
License: GPL (>= 3)
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.1
Suggests:
RoxygenNote: 7.3.1
Suggests:
lintr,
styler,
testthat (>= 3.0.0),
rcmdcheck,
roxygen2,
utils,
usethis,
leaflet,
knitr,
rmarkdown,
yaml,
pander,
ggplot2,
ggspatial,
Expand All @@ -33,15 +36,26 @@ Suggests:
rnaturalearth,
rnaturalearthdata
Config/testthat/edition: 3
Imports:
Config/renv/profiles/dev/dependencies:
lintr,
rcmdcheck,
roxygen2,
styler,
testthat,
usethis,
devtools
Imports:
jsonlite,
httr,
urltools,
lubridate,
RCurl,
fs,
utils,
logger,
dplyr,
tidyr,
sf
sf,
geojsonsf
URL: https://cnr-ibba.github.io/r-smarter-api/
BugReports: https://github.com/cnr-ibba/r-smarter-api/issues
VignetteBuilder: knitr
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
export(get_smarter_breeds)
export(get_smarter_countries)
export(get_smarter_datasets)
export(get_smarter_genotypes)
export(get_smarter_geojson)
export(get_smarter_info)
export(get_smarter_samples)
export(get_smarter_supportedchips)
export(get_smarter_token)
export(get_smarter_variants)
72 changes: 0 additions & 72 deletions R/auth.R

This file was deleted.

13 changes: 2 additions & 11 deletions R/breeds.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
#' Get SMARTER Breeds
#'
#' Fetch SMARTER REST API breeds endpoint and returns results in a dataframe.
#' Cached token is used or a new token is generated if not provided when calling
#' this function (see \code{\link{get_smarter_token}} for more information)
#'
#' @param query a \code{list} of query arguments
#' @param token a string with a valid token
#'
#' @return Returns a dataframe with selected breeds
#' @export
Expand All @@ -26,16 +23,10 @@
#'
#' selected_breeds <- get_smarter_breeds(query = list(search = "mer"))
#' \dontrun{
#'
#' all_breeds <- get_smarter_breeds()
#'
#' sheep_breeds <- get_smarter_breeds(query = list(species = "Sheep"))
#' }
get_smarter_breeds <- function(query = list(), token = NULL) {
if (is.null(token)) {
token <- smarterapi::get_smarter_token()
}

get_smarter_breeds <- function(query = list()) {
logger::log_info("Get data from breeds endpoint")

# setting the URL endpoint
Expand All @@ -45,7 +36,7 @@ get_smarter_breeds <- function(query = list(), token = NULL) {
)

# reading our data
data <- get_smarter_data(url, token, query)
data <- get_smarter_data(url, query)

Check warning on line 39 in R/breeds.R

View workflow job for this annotation

GitHub Actions / lint

file=R/breeds.R,line=39,col=11,[object_usage_linter] no visible global function definition for 'get_smarter_data'

logger::log_info("Done!")

Expand Down
Loading

0 comments on commit 1cb0f86

Please sign in to comment.