Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI testing branch only, do not merge #93

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 45 additions & 63 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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")'
58 changes: 58 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# 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:
pull_request:

name: test-coverage.yaml

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

2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ output: github_document

<!-- badges: start -->
[![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)
<!-- badges: end -->

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
<!-- badges: end -->

Expand Down
9 changes: 4 additions & 5 deletions tests/testthat/test_statistical_tests_and_estimates.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion vignettes/Overview.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ output:
number_sections: true
keep_tex: true
header-includes:
- \hypersetup{colorlinks=true, linkcolor=blue}
- \usepackage{booktabs}
- \usepackage{longtable}
- \usepackage{array}
Expand All @@ -32,6 +31,8 @@ vignette: >
%\VignetteEncoding{UTF-8}
---

\hypersetup{colorlinks=true, linkcolor=blue}

\listoftables

\clearpage
Expand Down