Skip to content

Commit

Permalink
add code coverage workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Irina Gaynanova committed Nov 3, 2023
1 parent fd7a6e6 commit ef6d16e
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 12 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
^cran-comments\.md$
^CRAN-RELEASE$
^\.github$
^codecov\.yml$
50 changes: 50 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# 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

jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3

- 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
needs: coverage

- name: Test coverage
run: |
covr::codecov(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
shell: Rscript {0}

- 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@v3
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
1 change: 1 addition & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ knitr::opts_chunk$set(
[![CRAN\_Status\_Badge](https://www.r-pkg.org/badges/version/iglu)](https://cran.r-project.org/package=iglu)[![](https://cranlogs.r-pkg.org/badges/iglu)](https://CRAN.R-project.org/package=iglu)
[![R-CMD-check](https://github.com/irinagain/iglu/workflows/R-CMD-check/badge.svg)](https://github.com/irinagain/iglu/actions)
[![R-CMD-check](https://github.com/irinagain/iglu/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/irinagain/iglu/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/irinagain/iglu/branch/master/graph/badge.svg)](https://app.codecov.io/gh/irinagain/iglu?branch=master)
<!-- badges: end -->

iglu: Interpreting data from Continuous Glucose Monitors (CGMs)
Expand Down
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/iglu)](https://cran.r-project.org/package=iglu)[![](https://cranlogs.r-pkg.org/badges/iglu)](https://CRAN.R-project.org/package=iglu)
[![R-CMD-check](https://github.com/irinagain/iglu/workflows/R-CMD-check/badge.svg)](https://github.com/irinagain/iglu/actions)
[![R-CMD-check](https://github.com/irinagain/iglu/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/irinagain/iglu/actions/workflows/R-CMD-check.yaml)
[![Codecov test
coverage](https://codecov.io/gh/irinagain/iglu/branch/master/graph/badge.svg)](https://app.codecov.io/gh/irinagain/iglu?branch=master)
<!-- badges: end -->

# iglu: Interpreting data from Continuous Glucose Monitors (CGMs)
Expand All @@ -20,18 +23,17 @@ the package, see [package website](https://irinagain.github.io/iglu/).

To cite:

- Broll S, Urbanek J, Buchanan D, Chun E, Muschelli J, Punjabi N and
Gaynanova I (2021). [Interpreting blood glucose data with R package
iglu.](https://doi.org/10.1371/journal.pone.0248560) *PLoS One*,
Vol. 16, No. 4, e0248560.
- Broll S, Urbanek J, Buchanan D, Chun E, Muschelli J, Punjabi N and
Gaynanova I (2021). [Interpreting blood glucose data with R package
iglu.](https://doi.org/10.1371/journal.pone.0248560) *PLoS One*, Vol.
16, No. 4, e0248560.

- Broll S, Buchanan D, Chun E, Muschelli J, Fernandes N, Seo J, Shih
J, Urbanek J, Schwenck J, Gaynanova I (2021). iglu: Interpreting
Glucose Data from Continuous Glucose Monitors. R package version
3.0.0.
- Broll S, Buchanan D, Chun E, Muschelli J, Fernandes N, Seo J, Shih J,
Urbanek J, Schwenck J, Gaynanova I (2021). iglu: Interpreting Glucose
Data from Continuous Glucose Monitors. R package version 3.0.0.

iglu comes with two example datasets: example_data_1\_subject and
example_data_5\_subject. These data are collected using Dexcom G4 CGM on
iglu comes with two example datasets: example_data_1_subject and
example_data_5_subject. These data are collected using Dexcom G4 CGM on
subjects with Type II diabetes. Each dataset follows the structure
iglu’s functions are designed around. Note that the 1 subject data is a
subset of the 5 subject data. See the examples below for loading and
Expand All @@ -54,8 +56,6 @@ devtools::install_github("irinagain/iglu", build_vignettes = TRUE)

``` r
library(iglu)
#> Warning in register(): Can't find generic `scale_type` in package ggplot2 to
#> register S3 method.
data(example_data_1_subject) # Load single subject data
## Plot data

Expand All @@ -66,6 +66,7 @@ plot_glu(example_data_1_subject)
<img src="man/figures/README-unnamed-chunk-3-1.png" width="100%" />

``` r

# Summary statistics and some metrics
summary_glu(example_data_1_subject)
#> # A tibble: 1 × 7
Expand Down Expand Up @@ -102,11 +103,13 @@ conga(example_data_1_subject)
data(example_data_5_subject)

plot_glu(example_data_5_subject, plottype = 'lasagna', datatype = 'average')
#> Warning: Removed 5 rows containing missing values (`geom_tile()`).
```

<img src="man/figures/README-unnamed-chunk-3-2.png" width="100%" />

``` r

below_percent(example_data_5_subject, targets = c(80,170,260))
#> # A tibble: 5 × 4
#> id below_170 below_260 below_80
Expand Down
14 changes: 14 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
comment: false

coverage:
status:
project:
default:
target: auto
threshold: 1%
informational: true
patch:
default:
target: auto
threshold: 1%
informational: true
Binary file modified man/figures/README-unnamed-chunk-3-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-unnamed-chunk-3-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ef6d16e

Please sign in to comment.