From b96e284b02d6475f7ccd3bb1b0f1e68e14218a5b Mon Sep 17 00:00:00 2001 From: Dave Slager Date: Sun, 11 Aug 2024 21:47:42 -0700 Subject: [PATCH 01/13] update t.test test expectations for new error in R >= 4.4 --- tests/testthat/test_statistical_tests_and_estimates.R | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/testthat/test_statistical_tests_and_estimates.R b/tests/testthat/test_statistical_tests_and_estimates.R index 76ba987..84eed41 100644 --- a/tests/testthat/test_statistical_tests_and_estimates.R +++ b/tests/testthat/test_statistical_tests_and_estimates.R @@ -81,20 +81,19 @@ test_that("two_samp_cont_test testing various options (no errors)", { # T-Test Unpaired #t.test(x[1:10], x[13:22], paired=F, var.equal = F)$p.value expect_equal(object = two_samp_cont_test(x = x, y = y, method = 't', paired = FALSE, verbose = T), - expected = t.test(x~factor(y), paired = F, var.equal = F)$p.value, + expected = t.test(x~factor(y), var.equal = F)$p.value, tolerance = 1e-8) # T-Test Paired - #Note the list also works: t.test(x[1:10], x[13:22], paired=T, var.equal = F)$p.value expect_equal(object = two_samp_cont_test(x = x[-(11:12)], y = y[-(11:12)], method = 't', paired = TRUE, verbose = T), - expected = t.test(x[-c(1,10:13,22)]~factor(y[-c(1,10:13,22)]), paired = T, var.equal = F)$p.value, + expected = t.test(x[1:10], x[13:22], paired = T, var.equal = F)$p.value, tolerance = 1e-8) #Testing var.equal = T option in T-Test Unpaired expect_equal(object = two_samp_cont_test(x = x, y = y, method = 't', paired = FALSE, verbose = T, var.equal = T), - expected = t.test(x~factor(y), paired = F, var.equal = T)$p.value, + expected = t.test(x~factor(y), var.equal = T)$p.value, tolerance = 1e-8) #Testing alternative param can be used expect_equal(object = two_samp_cont_test(x = x, y = y, method = 't', paired = FALSE, verbose = T, alternative = 'less'), - expected = t.test(x~factor(y), paired = F, alternative = 'less')$p.value, + expected = t.test(x~factor(y), alternative = 'less')$p.value, tolerance = 1e-8) #Testing t.test where both levels of y have a single x value From c3d9f507772a787689a521ff1541a5579b2e2077 Mon Sep 17 00:00:00 2001 From: Dave Slager Date: Sun, 11 Aug 2024 22:44:54 -0700 Subject: [PATCH 02/13] copy GHA workflow from VISCtemplates --- .github/workflows/R-CMD-check.yaml | 108 ++++++++++++----------------- 1 file changed, 45 insertions(+), 63 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index c6e51cb..e790e81 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -1,16 +1,10 @@ -# 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 +# 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 - - develop + branches: [main, master, develop] pull_request: - branches: - - main - - master - - develop + branches: [main, master, develop] name: R-CMD-check @@ -24,73 +18,61 @@ jobs: fail-fast: false matrix: config: + - {os: macos-latest, r: 'release'} - {os: windows-latest, r: 'release'} - - {os: windows-latest, r: '3.6'} - - {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"} - - {os: ubuntu-20.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'oldrel-1'} + - {os: ubuntu-latest, r: '4.0.4', pandoc-version: '2.11.4'} env: - R_REMOTES_NO_ERRORS_FROM_WARNINGS: true - RSPM: ${{ matrix.config.rspm }} GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - uses: r-lib/actions/setup-r@v1 + - name: Setup statsrv pandoc + if: ${{ matrix.config.r == '4.0.4' }} + uses: r-lib/actions/setup-pandoc@v2 with: - r-version: ${{ matrix.config.r }} + pandoc-version: ${{ matrix.config.pandoc-version }} - - uses: r-lib/actions/setup-pandoc@v1 + - name: Setup default pandoc + if: ${{ matrix.config.r != '4.0.4' }} + uses: r-lib/actions/setup-pandoc@v2 - - 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: Set up tinytex + uses: r-lib/actions/setup-tinytex@v2 - - 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: Preinstall required latex packages + run: > + tlmgr install + lastpage morefloats parskip pdflscape textpos multirow lipsum + fancyhdr colortbl soul setspace relsize makecell threeparttable + threeparttablex environ trimspaces - - 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"))') + - 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 dependencies + - name: Install statsrv packages + if: ${{ matrix.config.r == '4.0.4' }} run: | - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("rcmdcheck") - remotes::install_cran("covr") - install.packages("tinytex") - library(tinytex) - install_tinytex() - shell: Rscript {0} + R -q -e 'utils::install.packages("remotes")' + R -q -e 'remotes::install_version("Hmisc", "4.5-0")' + R -q -e 'remotes::install_github("FredHutch/VISCfunctions", dependencies = TRUE)' + R -q -e 'utils::install.packages("rcmdcheck")' - - name: Check - env: - _R_CHECK_CRAN_INCOMING_REMOTE_: false - run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") - shell: Rscript {0} - - - name: Upload check results - if: failure() - uses: actions/upload-artifact@main + - uses: r-lib/actions/setup-r-dependencies@v2 + if: ${{ matrix.config.r != '4.0.4' }} with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check + extra-packages: any::rcmdcheck + needs: check - - name: Test coverage - run: covr::codecov() - shell: Rscript {0} + - uses: r-lib/actions/check-r-package@v2 + with: + upload-snapshots: true + build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' From 09a6a9019b70b5d29776d66d3a4222c845f243ce Mon Sep 17 00:00:00 2001 From: Dave Slager Date: Sun, 11 Aug 2024 22:51:44 -0700 Subject: [PATCH 03/13] mv hypersetup to document body --- vignettes/Overview.Rmd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vignettes/Overview.Rmd b/vignettes/Overview.Rmd index fcef1e2..0ea3cd9 100644 --- a/vignettes/Overview.Rmd +++ b/vignettes/Overview.Rmd @@ -11,7 +11,6 @@ output: number_sections: true keep_tex: true header-includes: - - \hypersetup{colorlinks=true, linkcolor=blue} - \usepackage{booktabs} - \usepackage{longtable} - \usepackage{array} @@ -32,6 +31,8 @@ vignette: > %\VignetteEncoding{UTF-8} --- +\hypersetup{colorlinks=true, linkcolor=blue} + \listoftables \clearpage From 6180b8562b1fcca0128edfe14c9c7dcf75cd5148 Mon Sep 17 00:00:00 2001 From: Dave Slager Date: Thu, 15 Aug 2024 14:44:20 -0700 Subject: [PATCH 04/13] add default test coverage yml --- .github/workflows/test-coverage.yaml | 61 ++++++++++++++++++++++++++++ README.Rmd | 2 +- README.md | 2 +- 3 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/test-coverage.yaml diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml new file mode 100644 index 0000000..9882260 --- /dev/null +++ b/.github/workflows/test-coverage.yaml @@ -0,0 +1,61 @@ +# 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: test-coverage.yaml + +permissions: read-all + +jobs: + test-coverage: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + + 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::covr, any::xml2 + needs: coverage + + - name: Test coverage + run: | + cov <- covr::package_coverage( + quiet = FALSE, + clean = FALSE, + install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") + ) + covr::to_cobertura(cov) + shell: Rscript {0} + + - uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }} + file: ./cobertura.xml + plugin: noop + disable_search: true + token: ${{ secrets.CODECOV_TOKEN }} + + - name: Show testthat output + if: always() + run: | + ## -------------------------------------------------------------------- + find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true + shell: bash + + - name: Upload test results + if: failure() + uses: actions/upload-artifact@v4 + with: + name: coverage-test-failures + path: ${{ runner.temp }}/package diff --git a/README.Rmd b/README.Rmd index d00d633..75a163e 100644 --- a/README.Rmd +++ b/README.Rmd @@ -4,7 +4,7 @@ output: github_document [![R build status](https://github.com/FredHutch/VISCfunctions/workflows/R-CMD-check/badge.svg)](https://github.com/FredHutch/VISCfunctions/actions) - [![Codecov test coverage](https://codecov.io/gh/FredHutch/VISCfunctions/branch/main/graph/badge.svg)](https://codecov.io/gh/FredHutch/VISCfunctions?branch=main) +[![Codecov test coverage](https://codecov.io/gh/FredHutch/VISCfunctions/graph/badge.svg)](https://app.codecov.io/gh/FredHutch/VISCfunctions) [![License:MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) diff --git a/README.md b/README.md index 6f7ddfd..2efc784 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![R build status](https://github.com/FredHutch/VISCfunctions/workflows/R-CMD-check/badge.svg)](https://github.com/FredHutch/VISCfunctions/actions) [![Codecov test -coverage](https://codecov.io/gh/FredHutch/VISCfunctions/branch/main/graph/badge.svg)](https://codecov.io/gh/FredHutch/VISCfunctions?branch=main) +coverage](https://codecov.io/gh/FredHutch/VISCfunctions/graph/badge.svg)](https://app.codecov.io/gh/FredHutch/VISCfunctions) [![License:MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) From 3b6e3c9d40b0c4090ddc458fdce3d46272894244 Mon Sep 17 00:00:00 2001 From: Dave Slager Date: Thu, 15 Aug 2024 14:48:30 -0700 Subject: [PATCH 05/13] customize workflow installs, following R CMD check --- .github/workflows/test-coverage.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 9882260..0656558 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -19,6 +19,19 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Setup pandoc + uses: r-lib/actions/setup-pandoc@v2 + + - name: Set up tinytex + uses: r-lib/actions/setup-tinytex@v2 + + - name: Preinstall required latex packages + run: > + tlmgr install + lastpage morefloats parskip pdflscape textpos multirow lipsum + fancyhdr colortbl soul setspace relsize makecell threeparttable + threeparttablex environ trimspaces + - uses: r-lib/actions/setup-r@v2 with: use-public-rspm: true From 6b07a4fbcfc9cdeeaa3ac0fd852a2aa683f573fb Mon Sep 17 00:00:00 2001 From: Dave Slager Date: Thu, 15 Aug 2024 14:50:47 -0700 Subject: [PATCH 06/13] also run workflow on develop branch --- .github/workflows/test-coverage.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 0656558..ed3c7c8 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -2,9 +2,9 @@ # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: [main, master] + branches: [main, master, develop] pull_request: - branches: [main, master] + branches: [main, master, develop] name: test-coverage.yaml From 01631b18e6b1cd0d77820fbba3cf4647e6fea25e Mon Sep 17 00:00:00 2001 From: Dave Slager Date: Sat, 17 Aug 2024 08:23:12 -0700 Subject: [PATCH 07/13] try removing .yaml extension like R-CMD-check workflow --- .github/workflows/test-coverage.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index ed3c7c8..54b6177 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -6,7 +6,7 @@ on: pull_request: branches: [main, master, develop] -name: test-coverage.yaml +name: test-coverage permissions: read-all From fd777ba93ac5424aecf05e16ad27bfa84eb3fd52 Mon Sep 17 00:00:00 2001 From: Dave Slager Date: Sat, 17 Aug 2024 08:31:11 -0700 Subject: [PATCH 08/13] test adding active branch to on: to simulate once merged into develop --- .github/workflows/test-coverage.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 54b6177..c12d25a 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -2,9 +2,9 @@ # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: [main, master, develop] + branches: [main, master, develop, test] pull_request: - branches: [main, master, develop] + branches: [main, master, develop, test] name: test-coverage From 5b158747f91b66307c7803b1837d5c55dbf540dd Mon Sep 17 00:00:00 2001 From: Dave Slager Date: Sat, 17 Aug 2024 08:34:24 -0700 Subject: [PATCH 09/13] Revert "test adding active branch to on: to simulate once merged into develop" This reverts commit fd777ba93ac5424aecf05e16ad27bfa84eb3fd52. --- .github/workflows/test-coverage.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index c12d25a..54b6177 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -2,9 +2,9 @@ # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: [main, master, develop, test] + branches: [main, master, develop] pull_request: - branches: [main, master, develop, test] + branches: [main, master, develop] name: test-coverage From d8b180a1b3c64ef938bd3aec45d0e502a49576d1 Mon Sep 17 00:00:00 2001 From: Dave Slager Date: Sat, 17 Aug 2024 08:37:25 -0700 Subject: [PATCH 10/13] back to default test-coverage yml, except develop branch added --- .github/workflows/test-coverage.yaml | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 54b6177..dd98321 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -6,7 +6,7 @@ on: pull_request: branches: [main, master, develop] -name: test-coverage +name: test-coverage.yaml permissions: read-all @@ -19,19 +19,6 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup pandoc - uses: r-lib/actions/setup-pandoc@v2 - - - name: Set up tinytex - uses: r-lib/actions/setup-tinytex@v2 - - - name: Preinstall required latex packages - run: > - tlmgr install - lastpage morefloats parskip pdflscape textpos multirow lipsum - fancyhdr colortbl soul setspace relsize makecell threeparttable - threeparttablex environ trimspaces - - uses: r-lib/actions/setup-r@v2 with: use-public-rspm: true From 8e7b861f5dcdc42da749bb260c81e546418f29c2 Mon Sep 17 00:00:00 2001 From: Dave Slager Date: Sat, 17 Aug 2024 09:03:43 -0700 Subject: [PATCH 11/13] try rerunning with a (bad) repo-level CODECOV_TOKEN --- .github/workflows/test-coverage.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index dd98321..e818d26 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -59,3 +59,4 @@ jobs: with: name: coverage-test-failures path: ${{ runner.temp }}/package + From d59f1214dd85cc30e02d1123bd2f4d32fa3db7d8 Mon Sep 17 00:00:00 2001 From: Dave Slager Date: Sat, 17 Aug 2024 09:20:33 -0700 Subject: [PATCH 12/13] try without specifying branch names --- .github/workflows/test-coverage.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index e818d26..50bfb2d 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -2,9 +2,7 @@ # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: [main, master, develop] pull_request: - branches: [main, master, develop] name: test-coverage.yaml From e177dbc81f52ffd4bad4f4054b9c14c5b1d20b21 Mon Sep 17 00:00:00 2001 From: Dave Slager Date: Sat, 17 Aug 2024 09:21:19 -0700 Subject: [PATCH 13/13] try without specifying permissions --- .github/workflows/test-coverage.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 50bfb2d..1760836 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -6,8 +6,6 @@ on: name: test-coverage.yaml -permissions: read-all - jobs: test-coverage: runs-on: ubuntu-latest