mirror of
https://github.com/msberends/AMR.git
synced 2025-01-15 22:01:39 +01:00
unit test split
This commit is contained in:
parent
b089f7a5d7
commit
d2252b1062
82
.github/workflows/check-pr.yaml
vendored
82
.github/workflows/check-pr.yaml
vendored
@ -1,82 +0,0 @@
|
|||||||
# ==================================================================== #
|
|
||||||
# TITLE #
|
|
||||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
|
||||||
# #
|
|
||||||
# SOURCE #
|
|
||||||
# https://github.com/msberends/AMR #
|
|
||||||
# #
|
|
||||||
# CITE AS #
|
|
||||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
|
||||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
|
||||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
|
||||||
# doi:10.18637/jss.v104.i03 #
|
|
||||||
# #
|
|
||||||
# Developed at the University of Groningen, the Netherlands, in #
|
|
||||||
# collaboration with non-profit organisations Certe Medical #
|
|
||||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
|
||||||
# #
|
|
||||||
# This R package is free software; you can freely use and distribute #
|
|
||||||
# it for both personal and commercial purposes under the terms of the #
|
|
||||||
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
|
|
||||||
# the Free Software Foundation. #
|
|
||||||
# We created this package for both routine data analysis and academic #
|
|
||||||
# research and it was publicly released in the hope that it will be #
|
|
||||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
|
||||||
# #
|
|
||||||
# Visit our website for the full manual and a complete tutorial about #
|
|
||||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
|
||||||
# ==================================================================== #
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
# run in each PR in this repo
|
|
||||||
branches: '**'
|
|
||||||
|
|
||||||
name: R-code-check-PR
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
R-code-check-PR:
|
|
||||||
runs-on: ${{ matrix.config.os }}
|
|
||||||
|
|
||||||
continue-on-error: ${{ matrix.config.allowfail }}
|
|
||||||
|
|
||||||
name: ${{ matrix.config.os }} (R-${{ matrix.config.r }})
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
config:
|
|
||||||
- {os: macOS-latest, r: 'devel', allowfail: true}
|
|
||||||
- {os: macOS-latest, r: 'release', allowfail: false}
|
|
||||||
- {os: ubuntu-latest, r: 'devel', allowfail: true}
|
|
||||||
- {os: ubuntu-latest, r: 'release', allowfail: false}
|
|
||||||
- {os: windows-latest, r: 'devel', allowfail: true}
|
|
||||||
- {os: windows-latest, r: 'release', allowfail: false}
|
|
||||||
|
|
||||||
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 }}
|
|
||||||
# use RStudio Package Manager to quickly install packages
|
|
||||||
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
|
|
||||||
env:
|
|
||||||
_R_CHECK_LENGTH_1_CONDITION_: verbose
|
|
||||||
_R_CHECK_LENGTH_1_LOGIC2_: verbose
|
|
||||||
# during 'R CMD check', R_LIBS_USER will be overwritten, so:
|
|
||||||
R_LIBS_USER_GH_ACTIONS: ${{ env.R_LIBS_USER }}
|
|
||||||
R_RUN_TINYTEST: true
|
|
163
.github/workflows/check.yaml
vendored
163
.github/workflows/check.yaml
vendored
@ -1,163 +0,0 @@
|
|||||||
# ==================================================================== #
|
|
||||||
# TITLE #
|
|
||||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
|
||||||
# #
|
|
||||||
# SOURCE #
|
|
||||||
# https://github.com/msberends/AMR #
|
|
||||||
# #
|
|
||||||
# CITE AS #
|
|
||||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
|
||||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
|
||||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
|
||||||
# doi:10.18637/jss.v104.i03 #
|
|
||||||
# #
|
|
||||||
# Developed at the University of Groningen, the Netherlands, in #
|
|
||||||
# collaboration with non-profit organisations Certe Medical #
|
|
||||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
|
||||||
# #
|
|
||||||
# This R package is free software; you can freely use and distribute #
|
|
||||||
# it for both personal and commercial purposes under the terms of the #
|
|
||||||
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
|
|
||||||
# the Free Software Foundation. #
|
|
||||||
# We created this package for both routine data analysis and academic #
|
|
||||||
# research and it was publicly released in the hope that it will be #
|
|
||||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
|
||||||
# #
|
|
||||||
# Visit our website for the full manual and a complete tutorial about #
|
|
||||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
|
||||||
# ==================================================================== #
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
# run after a git push on any branch in this repo
|
|
||||||
branches: '**'
|
|
||||||
schedule:
|
|
||||||
# run a schedule everyday at 1 AM.
|
|
||||||
# this is to check that all dependencies are still available (see R/zzz.R)
|
|
||||||
- cron: '0 1 * * *'
|
|
||||||
|
|
||||||
name: R-code-check
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
R-code-check:
|
|
||||||
runs-on: ${{ matrix.config.os }}
|
|
||||||
|
|
||||||
continue-on-error: ${{ matrix.config.allowfail }}
|
|
||||||
|
|
||||||
name: ${{ matrix.config.os }} (R-${{ matrix.config.r }})
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
config:
|
|
||||||
# test all systems against all released versions of R >= 3.0, we support them all!
|
|
||||||
- {os: macOS-latest, r: 'devel', allowfail: true}
|
|
||||||
- {os: macOS-latest, r: '4.2', allowfail: false}
|
|
||||||
- {os: macOS-latest, r: '4.1', allowfail: false}
|
|
||||||
- {os: macOS-latest, r: '4.0', allowfail: false}
|
|
||||||
- {os: macOS-latest, r: '3.6', allowfail: false}
|
|
||||||
- {os: ubuntu-22.04, r: 'devel', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
|
|
||||||
- {os: ubuntu-22.04, r: '4.2', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
|
|
||||||
- {os: ubuntu-22.04, r: '4.1', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
|
|
||||||
- {os: ubuntu-22.04, r: '4.0', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
|
|
||||||
- {os: ubuntu-22.04, r: '3.6', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
|
|
||||||
- {os: ubuntu-22.04, r: '3.5.0', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
|
|
||||||
- {os: ubuntu-22.04, r: '3.4', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
|
|
||||||
- {os: ubuntu-22.04, r: '3.3', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
|
|
||||||
- {os: ubuntu-22.04, r: '3.2', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
|
|
||||||
- {os: ubuntu-22.04, r: '3.1', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
|
|
||||||
- {os: ubuntu-22.04, r: '3.0', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
|
|
||||||
- {os: windows-latest, r: 'devel', allowfail: true}
|
|
||||||
- {os: windows-latest, r: '4.2', allowfail: false}
|
|
||||||
- {os: windows-latest, r: '4.1', allowfail: false}
|
|
||||||
- {os: windows-latest, r: '4.0', allowfail: false}
|
|
||||||
- {os: windows-latest, r: '3.6', allowfail: false}
|
|
||||||
env:
|
|
||||||
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
|
|
||||||
RSPM: ${{ matrix.config.rspm }}
|
|
||||||
R_REPOSITORIES: "https://cran.rstudio.com"
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- uses: r-lib/actions/setup-r@v2
|
|
||||||
with:
|
|
||||||
r-version: ${{ matrix.config.r }}
|
|
||||||
|
|
||||||
- uses: r-lib/actions/setup-pandoc@v2
|
|
||||||
|
|
||||||
- name: Install Linux dependencies
|
|
||||||
if: runner.os == 'Linux'
|
|
||||||
# update the below with sysreqs::sysreqs("DESCRIPTION") and check the "DEB" entries (for Ubuntu).
|
|
||||||
# we don't want to depend on the sysreqs pkg here, as it requires quite a recent R version
|
|
||||||
# as of May 2021: https://sysreqs.r-hub.io/pkg/AMR,R,cleaner,curl,dplyr,ggplot2,knitr,microbenchmark,pillar,readxl,rmarkdown,rstudioapi,rvest,skimr,tidyr,tinytest,xml2,backports,crayon,rlang,vctrs,evaluate,highr,markdown,stringr,yaml,xfun,cli,ellipsis,fansi,lifecycle,utf8,glue,mime,magrittr,stringi,generics,R6,tibble,tidyselect,pkgconfig,purrr,digest,gtable,isoband,MASS,mgcv,scales,withr,nlme,Matrix,farver,labeling,munsell,RColorBrewer,viridisLite,lattice,colorspace,gridtext,Rcpp,RCurl,png,jpeg,bitops,cellranger,progress,rematch,hms,prettyunits,htmltools,jsonlite,tinytex,base64enc,httr,selectr,openssl,askpass,sys,repr,cpp11
|
|
||||||
run: |
|
|
||||||
sudo apt install -y libssl-dev libxml2-dev libcurl4-openssl-dev
|
|
||||||
|
|
||||||
- name: Restore cached R packages
|
|
||||||
# this step will add the step 'Post Restore cached R packages' on a succesful run
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ${{ env.R_LIBS_USER }}
|
|
||||||
key: ${{ matrix.config.os }}-r-${{ matrix.config.r }}-v4
|
|
||||||
|
|
||||||
- name: Install R dependencies
|
|
||||||
if: always()
|
|
||||||
run: |
|
|
||||||
Rscript -e "source('data-raw/_install_deps.R')"
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Show session info
|
|
||||||
if: always()
|
|
||||||
run: |
|
|
||||||
options(width = 100)
|
|
||||||
utils::sessionInfo()
|
|
||||||
as.data.frame(utils::installed.packages())[, "Version", drop = FALSE]
|
|
||||||
shell: Rscript {0}
|
|
||||||
|
|
||||||
- name: Remove vignettes on R without knitr support
|
|
||||||
if: matrix.config.r == '3.0' || matrix.config.r == '3.1' || matrix.config.r == '3.2' || matrix.config.r == '3.3'
|
|
||||||
# writing to DESCRIPTION2 and then moving to DESCRIPTION is required for R <= 3.3 as writeLines() cannot overwrite
|
|
||||||
run: |
|
|
||||||
rm -rf vignettes
|
|
||||||
Rscript -e "writeLines(readLines('DESCRIPTION')[!grepl('VignetteBuilder', readLines('DESCRIPTION'))], 'DESCRIPTION2')"
|
|
||||||
rm DESCRIPTION
|
|
||||||
mv DESCRIPTION2 DESCRIPTION
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Run R CMD check
|
|
||||||
if: always()
|
|
||||||
env:
|
|
||||||
# see https://rstudio.github.io/r-manuals/r-ints/Tools.html for an overview
|
|
||||||
_R_CHECK_CRAN_INCOMING_: false
|
|
||||||
_R_CHECK_DEPENDS_ONLY_: true
|
|
||||||
_R_CHECK_LENGTH_1_CONDITION_: verbose
|
|
||||||
_R_CHECK_LENGTH_1_LOGIC2_: verbose
|
|
||||||
# no check for old R versions - these packages require higher R versions
|
|
||||||
_R_CHECK_RD_XREFS_: ${{ matrix.config.r != '3.0' && matrix.config.r != '3.1' && matrix.config.r != '3.2' && matrix.config.r != '3.3' && matrix.config.r != '3.4' }}
|
|
||||||
_R_CHECK_FORCE_SUGGESTS_: false
|
|
||||||
R_CHECK_CONSTANTS: 5
|
|
||||||
R_JIT_STRATEGY: 3
|
|
||||||
# during 'R CMD check', R_LIBS_USER will be overwritten, so:
|
|
||||||
R_LIBS_USER_GH_ACTIONS: ${{ env.R_LIBS_USER }}
|
|
||||||
# this is a required value to run the unit tests:
|
|
||||||
R_RUN_TINYTEST: true
|
|
||||||
run: |
|
|
||||||
cd ..
|
|
||||||
R CMD build AMR
|
|
||||||
R CMD check --as-cran --no-manual --run-donttest --run-dontrun AMR_*.tar.gz
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Show unit tests output
|
|
||||||
if: always()
|
|
||||||
run: |
|
|
||||||
cd ../AMR.Rcheck
|
|
||||||
find . -name 'tinytest.Rout*' -exec cat '{}' \; || true
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Upload artifacts
|
|
||||||
if: always()
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: artifacts-${{ matrix.config.os }}-r${{ matrix.config.r }}
|
|
||||||
path: ${GITHUB_WORKSPACE}.Rcheck
|
|
@ -1,5 +1,5 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 1.8.2.9031
|
Version: 1.8.2.9032
|
||||||
Date: 2022-10-05
|
Date: 2022-10-05
|
||||||
Title: Antimicrobial Resistance Data Analysis
|
Title: Antimicrobial Resistance Data Analysis
|
||||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||||
|
2
NEWS.md
2
NEWS.md
@ -1,4 +1,4 @@
|
|||||||
# AMR 1.8.2.9031
|
# AMR 1.8.2.9032
|
||||||
|
|
||||||
This version will eventually become v2.0! We're happy to reach a new major milestone soon!
|
This version will eventually become v2.0! We're happy to reach a new major milestone soon!
|
||||||
|
|
||||||
|
2
R/rsi.R
2
R/rsi.R
@ -164,7 +164,7 @@
|
|||||||
#' as.rsi() # automatically determines urine isolates
|
#' as.rsi() # automatically determines urine isolates
|
||||||
#'
|
#'
|
||||||
#' df %>%
|
#' df %>%
|
||||||
#' mutate_at(vars(AMP:NIT), as.rsi, mo = "E. coli", uti = TRUE)
|
#' mutate_at(vars(AMP:TOB), as.rsi, mo = "E. coli", uti = TRUE)
|
||||||
#' }
|
#' }
|
||||||
#'
|
#'
|
||||||
#' # For CLEANING existing R/SI values ------------------------------------
|
#' # For CLEANING existing R/SI values ------------------------------------
|
||||||
|
@ -229,7 +229,7 @@ if (require("dplyr")) {
|
|||||||
as.rsi() # automatically determines urine isolates
|
as.rsi() # automatically determines urine isolates
|
||||||
|
|
||||||
df \%>\%
|
df \%>\%
|
||||||
mutate_at(vars(AMP:NIT), as.rsi, mo = "E. coli", uti = TRUE)
|
mutate_at(vars(AMP:TOB), as.rsi, mo = "E. coli", uti = TRUE)
|
||||||
}
|
}
|
||||||
|
|
||||||
# For CLEANING existing R/SI values ------------------------------------
|
# For CLEANING existing R/SI values ------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user