Skip to content

Commit

Permalink
feature: use test coverage for current git-branch
Browse files Browse the repository at this point in the history
- to clearly show what the testing coverage is on each branch via the
  badge
- `README.Rmd` is altered to programatically retrieve the current git
  branch which automatically uses the correct coverage results from https://about.codecov.io/

Refs: #1086
  • Loading branch information
ilyaZar authored and ColinFay committed Feb 28, 2024
1 parent 210be98 commit 4eaacb2
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,23 @@ knitr::opts_chunk$set(

<!-- badges: start -->

[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html) [![R-CMD-check](https://github.com/ThinkR-open/golem/workflows/R-CMD-check/badge.svg)](https://github.com/ThinkR-open/golem/actions) [![Coverage status](https://codecov.io/gh/ThinkR-open/golem/branch/master/graph/badge.svg)](https://codecov.io/github/ThinkR-open/golem?branch=master) [![CRAN status](https://www.r-pkg.org/badges/version/golem)](https://cran.r-project.org/package=golem)
```{r echo = FALSE}
name_branch <- system("git symbolic-ref --short HEAD", intern = TRUE)
link_to_branch_svg <- paste0(
"https://codecov.io/gh/ThinkR-open/golem/branch/",
name_branch,
"/graph/badge.svg")
link_to_branch_html <- paste0(
"https://app.codecov.io/github/ThinkR-open/golem/tree/",
name_branch)
```

```{r, echo = FALSE, results = "asis"}
cat('[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html)')
cat('[![R-CMD-check](https://github.com/ThinkR-open/golem/workflows/R-CMD-check/badge.svg)](https://github.com/ThinkR-open/golem/actions)')
cat(paste0("\n[![Coverage status](", link_to_branch_svg, ")](", link_to_branch_html, ")"))
cat('[![CRAN status](https://www.r-pkg.org/badges/version/golem)](https://cran.r-project.org/package=golem)')
```

<!-- badges: end -->

Expand Down

0 comments on commit 4eaacb2

Please sign in to comment.