diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 07053e51..724f0d53 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -23,16 +23,14 @@ # how to conduct AMR data analysis: https://msberends.github.io/AMR/ # # ==================================================================== # -# This GitHub Actions file runs without ANY dependency, so works on all versions of R since R-3.0. - on: push: branches: - - premaster - - master + - development + - main pull_request: branches: - - master + - main schedule: # run a schedule everyday at 1 AM. # this is to check that all dependencies are still available (see R/zzz.R) @@ -81,45 +79,35 @@ jobs: - {os: windows-latest, r: '3.2', allowfail: false} env: - R_REMOTES_NO_ERRORS_FROM_WARNINGS: true + R_REMOTES_NO_ERRORS_FROM_WARNINGS: false RSPM: ${{ matrix.config.rspm }} R_REPOSITORIES: "https://cran.rstudio.com" - + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes + R_CHECK_CRAN_INCOMING_: false + R_CHECK_FORCE_SUGGESTS_: false + R_CHECK_DEPENDS_ONLY_: true + 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 + steps: - uses: actions/checkout@v2 + - uses: r-lib/actions/setup-pandoc@v1 + - uses: r-lib/actions/setup-r@v1 with: r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true - - 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,ggtext,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 pandoc pandoc-citeproc libxml2-dev libicu-dev libcurl4-openssl-dev libpng-dev libudunits2-dev - - - name: Query dependencies - # this will change every day (i.e. at scheduled night run of GitHub Action), so it will cache dependency updates - run: | - writeLines(paste0(format(Sys.Date(), "%Y%m%d"), sprintf("-R-%i.%i", getRversion()$major, getRversion()$minor)), ".github/daily-R-bundle") - shell: Rscript {0} - - - name: Restore cached R packages - # this step will add the step 'Post Restore cached R packages' on a succesful run - uses: actions/cache@v2 + - uses: r-lib/actions/setup-r-dependencies@v1 with: - path: ${{ env.R_LIBS_USER }} - key: ${{ matrix.config.os }}-${{ hashFiles('.github/daily-R-bundle') }}-v4 - - - name: Unpack AMR and install R dependencies - if: always() - run: | - tar -xf data-raw/AMR_latest.tar.gz - Rscript -e "source('data-raw/_install_deps.R')" - shell: bash - + extra-packages: rcmdcheck + - name: Show session info if: always() run: | @@ -127,31 +115,17 @@ jobs: utils::sessionInfo() as.data.frame(utils::installed.packages())[, "Version", drop = FALSE] shell: Rscript {0} - - - name: Run R CMD check - if: always() - env: - _R_CHECK_CRAN_INCOMING_: false - _R_CHECK_FORCE_SUGGESTS_: false - _R_CHECK_DEPENDS_ONLY_: true - _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 - run: | - R CMD check --no-manual --run-donttest --run-dontrun AMR - shell: bash + + - uses: r-lib/actions/check-r-package@v1 - name: Show unit tests output if: always() - run: | - find . -name 'tinytest.Rout*' -exec cat '{}' \; || true + run: find check -name 'tinytest.Rout*' -exec cat '{}' \; || true shell: bash - - name: Upload artifacts + - name: Upload check results if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@main with: name: ${{ matrix.config.os }}-r-${{ matrix.config.r }}-artifacts - path: AMR.Rcheck + path: check diff --git a/.github/workflows/check.yaml.old b/.github/workflows/check.yaml.old new file mode 100644 index 00000000..07053e51 --- /dev/null +++ b/.github/workflows/check.yaml.old @@ -0,0 +1,157 @@ +# ==================================================================== # +# TITLE # +# Antimicrobial Resistance (AMR) Data Analysis for R # +# # +# SOURCE # +# https://github.com/msberends/AMR # +# # +# LICENCE # +# (c) 2018-2021 Berends MS, Luz CF et al. # +# 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/ # +# ==================================================================== # + +# This GitHub Actions file runs without ANY dependency, so works on all versions of R since R-3.0. + +on: + push: + branches: + - premaster + - master + pull_request: + branches: + - master + 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.1', allowfail: false} + - {os: macOS-latest, r: '4.0', allowfail: false} + - {os: macOS-latest, r: '3.6', allowfail: false} + - {os: macOS-latest, r: '3.5', allowfail: false} + - {os: macOS-latest, r: '3.4', allowfail: false} + - {os: macOS-latest, r: '3.3', allowfail: false} + - {os: macOS-latest, r: '3.2', allowfail: false} + - {os: ubuntu-20.04, r: 'devel', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} + - {os: ubuntu-20.04, r: '4.1', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} + - {os: ubuntu-20.04, r: '4.0', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} + - {os: ubuntu-20.04, r: '3.6', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} + - {os: ubuntu-20.04, r: '3.5', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} + - {os: ubuntu-20.04, r: '3.4', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} + - {os: ubuntu-20.04, r: '3.3', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} + - {os: ubuntu-20.04, r: '3.2', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} + - {os: ubuntu-20.04, r: '3.1', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} + - {os: ubuntu-20.04, r: '3.0', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} + - {os: windows-latest, r: 'devel', allowfail: true} + - {os: windows-latest, r: '4.1', allowfail: false} + - {os: windows-latest, r: '4.0', allowfail: false} + - {os: windows-latest, r: '3.6', allowfail: false} + - {os: windows-latest, r: '3.5', allowfail: false} + - {os: windows-latest, r: '3.4', allowfail: false} + - {os: windows-latest, r: '3.3', allowfail: false} + - {os: windows-latest, r: '3.2', allowfail: false} + + env: + R_REMOTES_NO_ERRORS_FROM_WARNINGS: true + RSPM: ${{ matrix.config.rspm }} + R_REPOSITORIES: "https://cran.rstudio.com" + + steps: + - uses: actions/checkout@v2 + + - uses: r-lib/actions/setup-r@v1 + with: + r-version: ${{ matrix.config.r }} + + - 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,ggtext,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 pandoc pandoc-citeproc libxml2-dev libicu-dev libcurl4-openssl-dev libpng-dev libudunits2-dev + + - name: Query dependencies + # this will change every day (i.e. at scheduled night run of GitHub Action), so it will cache dependency updates + run: | + writeLines(paste0(format(Sys.Date(), "%Y%m%d"), sprintf("-R-%i.%i", getRversion()$major, getRversion()$minor)), ".github/daily-R-bundle") + shell: Rscript {0} + + - 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 }}-${{ hashFiles('.github/daily-R-bundle') }}-v4 + + - name: Unpack AMR and install R dependencies + if: always() + run: | + tar -xf data-raw/AMR_latest.tar.gz + 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: Run R CMD check + if: always() + env: + _R_CHECK_CRAN_INCOMING_: false + _R_CHECK_FORCE_SUGGESTS_: false + _R_CHECK_DEPENDS_ONLY_: true + _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 + run: | + R CMD check --no-manual --run-donttest --run-dontrun AMR + shell: bash + + - name: Show unit tests output + if: always() + run: | + find . -name 'tinytest.Rout*' -exec cat '{}' \; || true + shell: bash + + - name: Upload artifacts + if: always() + uses: actions/upload-artifact@v2 + with: + name: ${{ matrix.config.os }}-r-${{ matrix.config.r }}-artifacts + path: AMR.Rcheck diff --git a/DESCRIPTION b/DESCRIPTION index 759f8514..00695030 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 1.7.1.9040 +Version: 1.7.1.9041 Date: 2021-09-29 Title: Antimicrobial Resistance Data Analysis Description: Functions to simplify and standardise antimicrobial resistance (AMR) diff --git a/NEWS.md b/NEWS.md index 1a0568d4..30cbbd0b 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# `AMR` 1.7.1.9040 +# `AMR` 1.7.1.9041 ## Last updated: 29 September 2021 ### Breaking changes diff --git a/data-raw/AMR_latest.tar.gz b/data-raw/AMR_latest.tar.gz index aa1d7515..fc4f27c6 100644 Binary files a/data-raw/AMR_latest.tar.gz and b/data-raw/AMR_latest.tar.gz differ diff --git a/data-raw/_install_deps.R b/data-raw/_install_deps.R index 68882353..a49e2511 100644 --- a/data-raw/_install_deps.R +++ b/data-raw/_install_deps.R @@ -31,7 +31,10 @@ pkg_suggests <- gsub("[^a-zA-Z0-9]+", "", unlist(strsplit(unlist(packageDescription("AMR", fields = c("Suggests", "Enhances", "LinkingTo"))), split = ", ?"))) +pkg_suggests <- unname(pkg_suggests[!is.na(pkg_suggests)]) +cat("################################################\n") cat("Packages listed in Suggests/Enhances:", paste(pkg_suggests, collapse = ", "), "\n") +cat("################################################\n") if (.Platform$OS.type != "unix") { # no compiling on Windows here @@ -52,6 +55,16 @@ for (i in seq_len(length(to_install))) { # message = function(m) invisible(), warning = function(w) message(w$message), error = function(e) message(e$message)) + if (.Platform$OS.type != "unix" && !to_install[i] %in% rownames(utils::installed.packages())) { + tryCatch(install.packages(to_install[i], + type = "binary", + repos = "https://cran.rstudio.com/", + dependencies = c("Depends", "Imports", "LinkingTo"), + quiet = FALSE), + # message = function(m) invisible(), + warning = function(w) message(w$message), + error = function(e) message(e$message)) + } } to_update <- as.data.frame(utils::old.packages(repos = "https://cran.rstudio.com/"), stringsAsFactors = FALSE) diff --git a/docs/articles/datasets.html b/docs/articles/datasets.html index d97b3ebb..0ff18c37 100644 --- a/docs/articles/datasets.html +++ b/docs/articles/datasets.html @@ -44,7 +44,7 @@ AMR (for R) - 1.7.1.9040 + 1.7.1.9041 diff --git a/docs/news/index.html b/docs/news/index.html index 6c61d3a7..7aee29e5 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -92,7 +92,7 @@ AMR (for R) - 1.7.1.9040 + 1.7.1.9041 @@ -240,9 +240,9 @@ Source: NEWS.md -
-

- Unreleased AMR 1.7.1.9040

+
+

+ Unreleased AMR 1.7.1.9041

Last updated: 29 September 2021 diff --git a/git_premaster.sh b/git_development.sh similarity index 93% rename from git_premaster.sh rename to git_development.sh index 48b645a7..9f7bd22c 100755 --- a/git_premaster.sh +++ b/git_development.sh @@ -24,26 +24,26 @@ # ==================================================================== # ######################################################################## -# `git_premaster.sh` takes 3 parameters: # +# `git_development.sh` takes 3 parameters: # # 1. Commit message (character) [mandatory] # # 2. Lazy website generation (logical), with TRUE only changed # # files will be processed [defaults to TRUE] # # 3. Version number to be used in DESCRIPTION and NEWS.md # # [defaults to current tag and last commit number + 9000] # # # -# To push new commits to the premaster branch, run: # -# bash git_premaster.sh "commit message" # +# To push new commits to the development branch, run: # +# bash git_development.sh "commit message" # # This creates auto version numbering in DESCRIPTION and NEWS.md. # # # -# After successful test checks, merge it to the master branch with: # +# After successful test checks, merge it to the main branch with: # # bash git_merge.sh # # # # To prerelease a new version number, run: # -# bash git_premaster.sh "v1.x.x" FALSE "1.x.x" # +# bash git_development.sh "v1.x.x" FALSE "1.x.x" # # # # To only update the website, run: # # bash git_siteonly.sh # -# (which is short for 'bash git_premaster.sh "website update" FALSE') # +# (which is short for 'bash git_development.sh "website update" FALSE')# ######################################################################## if [ -z "$1" ]; then @@ -56,8 +56,8 @@ else lazy=$2 fi -# be sure to be on premaster branch -git checkout premaster --quiet +# be sure to be on development branch +git checkout development --quiet echo "••••••••••••••••••••••••••••••••••••••••••••" echo "• Updating package date and version number •" @@ -127,7 +127,7 @@ echo "••••••••••••••••••••" echo "• Building package •" echo "••••••••••••••••••••" echo "• Building 'data-raw/AMR_latest.tar.gz'..." -Rscript -e "x <- devtools::build(path = 'data-raw', vignettes = FALSE, manual = FALSE, binary = FALSE, quiet = TRUE)" +Rscript -e "x <- devtools::build(path = 'data-raw', vignettes = TRUE, manual = TRUE, binary = FALSE, quiet = TRUE)" rm data-raw/AMR_latest.tar.gz mv data-raw/AMR_*.tar.gz data-raw/AMR_latest.tar.gz @@ -193,7 +193,7 @@ git add . git commit -a -m "(v${new_version}) $1" --quiet git push --quiet echo "Comparison:" -echo "https://github.com/msberends/AMR/compare/master...premaster?view=inline" +echo "https://github.com/msberends/AMR/compare/main...development?view=inline" echo echo "•••••••••" diff --git a/git_merge.sh b/git_merge.sh index f0c04c46..340bf74a 100755 --- a/git_merge.sh +++ b/git_merge.sh @@ -24,44 +24,44 @@ # ==================================================================== # ######################################################################## -# `git_premaster.sh` takes 3 parameters: # +# `git_development.sh` takes 3 parameters: # # 1. Commit message (character) [mandatory] # # 2. Lazy website generation (logical), with TRUE only changed # # files will be processed [defaults to TRUE] # # 3. Version number to be used in DESCRIPTION and NEWS.md # # [defaults to current tag and last commit number + 9000] # # # -# To push new commits to the premaster branch, run: # -# bash git_premaster.sh "commit message" # +# To push new commits to the development branch, run: # +# bash git_development.sh "commit message" # # This creates auto version numbering in DESCRIPTION and NEWS.md. # # # -# After successful test checks, merge it to the master branch with: # +# After successful test checks, merge it to the main branch with: # # bash git_merge.sh # # # # To prerelease a new version number, run: # -# bash git_premaster.sh "v1.x.x" FALSE "1.x.x" # +# bash git_development.sh "v1.x.x" FALSE "1.x.x" # # # # To only update the website, run: # # bash git_siteonly.sh # -# (which is short for 'bash git_premaster.sh "website update" FALSE') # +# (which is short for 'bash git_development.sh "website update" FALSE')# ######################################################################## # stash current changes # git stash --quiet -# go to master -git checkout master --quiet -echo "• changed branch to master" +# go to main +git checkout main --quiet +echo "• changed branch to main" -# import everything from premaster -git merge premaster --quiet +# import everything from development +git merge development --quiet # and send it to git git push --quiet -echo "• pushed changes to master" +echo "• pushed changes to main" -# return to premaster -git checkout premaster --quiet -echo "• changed branch back to premaster" +# return to development +git checkout development --quiet +echo "• changed branch back to development" git status --short echo diff --git a/git_siteonly.sh b/git_siteonly.sh index b060753f..c1dabab7 100755 --- a/git_siteonly.sh +++ b/git_siteonly.sh @@ -24,35 +24,35 @@ # ==================================================================== # ######################################################################## -# `git_premaster.sh` takes 3 parameters: # +# `git_development.sh` takes 3 parameters: # # 1. Commit message (character) [mandatory] # # 2. Lazy website generation (logical), with TRUE only changed # # files will be processed [defaults to TRUE] # # 3. Version number to be used in DESCRIPTION and NEWS.md # # [defaults to current tag and last commit number + 9000] # # # -# To push new commits to the premaster branch, run: # -# bash git_premaster.sh "commit message" # +# To push new commits to the development branch, run: # +# bash git_development.sh "commit message" # # This creates auto version numbering in DESCRIPTION and NEWS.md. # # # -# After successful test checks, merge it to the master branch with: # +# After successful test checks, merge it to the main branch with: # # bash git_merge.sh # # # # To prerelease a new version number, run: # -# bash git_premaster.sh "v1.x.x" FALSE "1.x.x" # +# bash git_development.sh "v1.x.x" FALSE "1.x.x" # # # # To only update the website, run: # # bash git_siteonly.sh # -# (which is short for 'bash git_premaster.sh "website update" FALSE') # +# (which is short for 'bash git_development.sh "website update" FALSE')# ######################################################################## -bash git_premaster.sh "website update" FALSE +bash git_development.sh "website update" FALSE echo -echo "••••••••••••••••••••••••••••••" -echo "• Uploading to master branch •" -echo "••••••••••••••••••••••••••••••" -git checkout master -git merge premaster +echo "••••••••••••••••••••••••••••" +echo "• Uploading to main branch •" +echo "••••••••••••••••••••••••••••" +git checkout main +git merge development git push --quiet -git checkout premaster +git checkout development