Skip to content

Commit

Permalink
Merge pull request #83 from NIEHS/isong-hucvars
Browse files Browse the repository at this point in the history
0.2.0 dev
  • Loading branch information
sigmafelix authored Jun 20, 2024
2 parents 6f211a4 + bc5c58e commit 971ef31
Show file tree
Hide file tree
Showing 77 changed files with 3,369 additions and 1,862 deletions.
48 changes: 47 additions & 1 deletion .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,47 @@ on:
name: pkgdown

jobs:
test-covr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
any::pak
any::covr
any::devtools
any::DT
any::htmltools
needs: coverage

- name: Cache C++ and R dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/R
~/.local/share/R
key: dependencies-${{ runner.os }}-${{ hashFiles('**/DESCRIPTION') }}
restore-keys: |
dependencies-${{ runner.os }}-
- name: Run tests and generate covr report
run: |
Rscript -e 'covr::report(file = "coverage_report.html")'
- name: Upload covr report as artifact
uses: actions/upload-artifact@v4
with:
name: covr-report
path: coverage_report.html

pkgdown:
needs: test-covr
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
Expand All @@ -24,6 +64,12 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Download covr report
uses: actions/download-artifact@v4
with:
name: covr-report
path: .

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
Expand All @@ -41,7 +87,7 @@ jobs:

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.4.1
uses: JamesIves/github-pages-deploy-action@v4.6.1
with:
clean: false
branch: gh-pages
Expand Down
27 changes: 19 additions & 8 deletions .github/workflows/test-coverage-local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr
needs: coverage
extra-packages: |
any::pak
any::covr
needs: coverage

- name: Cache C++ and R dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
~/.cache/R
Expand All @@ -38,10 +40,15 @@ jobs:
dependencies-${{ runner.os }}-
- name: Test coverage
run: >
Rscript -e
"covd<-covr::coverage_to_list()$totalcoverage;
write.table(covd[length(covd)], file = '${{ github.workspace }}/local_cov.Rout', row.names = F, col.names = F)"
run: |
Rscript ${{ github.workspace }}/.github/workflows/test-coverage.R ${{ runner.temp }} ${{ github.workspace }}
shell: bash

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Get Values
Expand All @@ -61,6 +68,10 @@ jobs:
id: patch-comparison
shell: bash
run: |
if ( ! test -f cov_current.Rout ); then
echo "0" >> cov_current.Rout
fi
cov_patch="${{ steps.get-values.outputs.coverage }}"
cov_current=$(cat cov_current.Rout)
echo "Current coverage: $cov_current"
Expand All @@ -86,7 +97,7 @@ jobs:
run: |
npm i -g badgen-cli
export COV=${{ steps.get-values.outputs.coverage }}
COLOR=$(node -p '+process.env.COV >= 95 ? `green` : `orange`')
COLOR=$(node -p '+process.env.COV >= 95 ? `green` : `yellow`')
mkdir -p badges
badgen -j coverage -s $COV% -c $COLOR > badges/coverage.svg
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/test-coverage.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
args <- commandArgs(trailingOnly = TRUE)
runnertemp <- args[[1]]
ghworkspace <- args[[2]]

dir.create(file.path(runnertemp, "package"), showWarnings = FALSE, recursive = TRUE)
sink(paste0(runnertemp, '/package/testthat.Rout.res'))
cov <- covr::package_coverage()
sink()
covd <- covr::coverage_to_list(cov)$totalcoverage
write.table(
covd[length(covd)],
file = file.path(ghworkspace, 'local_cov.Rout'),
row.names = FALSE,
col.names = FALSE
)
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: amadeus
Title: AMADEUS: A Machine for Data, Environments, and User Setup for common environmental and climate health datasets
Version: 0.1.7
Version: 0.2.0
Authors@R: c(
person("Kyle", "Messier", , "[email protected]", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-9508-9623")),
person("Mitchell", "Manware", role = c("aut", "ctb"), comment = c(ORCID = "0009-0003-6440-6106")),
Expand All @@ -12,7 +12,7 @@ Authors@R: c(
)
Description: A Mechanism/Machine for Data, Environments, and User Setup package for health and climate research. It is fully tested, versioned, and open source and open access.
Depends: R (>= 4.1.0)
Imports: dplyr, sf, sftime, stats, terra, methods, data.table, httr, rvest, exactextractr, utils, stringi, testthat (>= 3.0.0), doParallel, parallelly, stars, foreach, future, tidyr, rlang, rstac, nhdplusTools, archive
Imports: dplyr, sf, sftime, stats, terra, methods, data.table, httr, rvest, exactextractr, utils, stringi, testthat (>= 3.0.0), parallelly, stars, future, future.apply, tidyr, rlang, rstac, nhdplusTools, archive, collapse, devtools
Suggests: covr, withr, knitr, rmarkdown, lwgeom, FNN, doRNG
Encoding: UTF-8
VignetteBuilder: knitr, rmarkdown
Expand Down
62 changes: 36 additions & 26 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generated by roxygen2: do not edit by hand

export(as_mysftime)
export(calc_check_time)
export(calc_covariates)
export(calc_ecoregion)
export(calc_geos)
Expand Down Expand Up @@ -31,36 +32,36 @@ export(check_mysf)
export(check_mysftime)
export(check_url_status)
export(check_urls)
export(download_aqs_data)
export(download_cropscape_data)
export(download_aqs)
export(download_cropscape)
export(download_data)
export(download_ecoregion_data)
export(download_ecoregion)
export(download_epa_certificate)
export(download_geos_data)
export(download_gmted_data)
export(download_gridmet_data)
export(download_hms_data)
export(download_huc_data)
export(download_koppen_geiger_data)
export(download_merra2_data)
export(download_modis_data)
export(download_narr_monolevel_data)
export(download_narr_p_levels_data)
export(download_nei_data)
export(download_nlcd_data)
export(download_olm_data)
export(download_geos)
export(download_gmted)
export(download_gridmet)
export(download_hms)
export(download_huc)
export(download_koppen_geiger)
export(download_merra2)
export(download_modis)
export(download_narr_monolevel)
export(download_narr_p_levels)
export(download_nei)
export(download_nlcd)
export(download_olm)
export(download_permit)
export(download_prism_data)
export(download_prism)
export(download_remove_command)
export(download_remove_zips)
export(download_run)
export(download_sanitize_path)
export(download_sedac_groads_data)
export(download_sedac_population_data)
export(download_sedac_groads)
export(download_sedac_population)
export(download_setup_dir)
export(download_sink)
export(download_terraclimate_data)
export(download_tri_data)
export(download_terraclimate)
export(download_tri)
export(download_unzip)
export(dt_as_mysftime)
export(extract_urls)
Expand Down Expand Up @@ -122,30 +123,34 @@ import(sf)
import(sftime)
import(stars)
importFrom(archive,archive_extract)
importFrom(collapse,rowbind)
importFrom(data.table,.SD)
importFrom(data.table,as.data.table)
importFrom(data.table,fread)
importFrom(data.table,month)
importFrom(data.table,rbindlist)
importFrom(data.table,year)
importFrom(doParallel,registerDoParallel)
importFrom(dplyr,across)
importFrom(dplyr,all_of)
importFrom(dplyr,as_tibble)
importFrom(dplyr,bind_rows)
importFrom(dplyr,distinct)
importFrom(dplyr,ends_with)
importFrom(dplyr,filter)
importFrom(dplyr,group_by)
importFrom(dplyr,lag)
importFrom(dplyr,left_join)
importFrom(dplyr,mutate)
importFrom(dplyr,select)
importFrom(dplyr,summarize)
importFrom(dplyr,ungroup)
importFrom(exactextractr,exact_extract)
importFrom(foreach,"%dopar%")
importFrom(foreach,foreach)
importFrom(future,cluster)
importFrom(future,multicore)
importFrom(future,plan)
importFrom(future,sequential)
importFrom(future.apply,future_Map)
importFrom(future.apply,future_lapply)
importFrom(httr,GET)
importFrom(httr,HEAD)
importFrom(methods,is)
Expand All @@ -159,10 +164,16 @@ importFrom(rstac,read_collections)
importFrom(rstac,read_items)
importFrom(rstac,read_stac)
importFrom(sf,st_as_sf)
importFrom(sf,st_as_sfc)
importFrom(sf,st_crs)
importFrom(sf,st_drop_geometry)
importFrom(sf,st_geometry)
importFrom(sf,st_intersects)
importFrom(sf,st_read)
importFrom(sf,st_transform)
importFrom(sf,st_union)
importFrom(stars,read_stars)
importFrom(stars,st_mosaic)
importFrom(stars,st_warp)
importFrom(stats,aggregate)
importFrom(stats,setNames)
Expand Down Expand Up @@ -190,8 +201,7 @@ importFrom(terra,nlyr)
importFrom(terra,perim)
importFrom(terra,project)
importFrom(terra,rast)
importFrom(terra,same.crs)
importFrom(terra,snap)
importFrom(terra,set.crs)
importFrom(terra,sprc)
importFrom(terra,subset)
importFrom(terra,tapp)
Expand Down
Loading

0 comments on commit 971ef31

Please sign in to comment.