Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Mauricio “Pachá” Vargas Sepúlveda
Blog with notes about R, Shiny, SQL, Python, Linux and C++. This blog is listed on R-Bloggers.
Categories
- Armadillo
- Arrow
- BibTeX
- Blogdown
- C++
- CRAN
- D3po
- DigitalOcean
- DuckDB
- Education
- GitHub
- Google Sheets
- Inkscape
- International Trade
- Interviews
- Kubernetes
- Latex
- Linear algebra
- Linear models
- Linux
- Manjaro
- Microsoft Excel
- NLP
- Non-English datasets
- OS X
- OpenBLAS
- Pelican
- Positron
- PostGIS
- PostgreSQL
- Python
- Quarto
- R
- R Packages
- R-Universe
- R4DS
- REST API
- RStudio
- RStudio Server
- Redatam
- Rick and Morty
- SPSS
- SQL
- Selenium
- Shiny
- Spreadsheets
- Stan
- Stata
- Statistics
- Tabler
- Tidyverse
- Ubuntu
- VSCode
- Windows
- Zotero
- cpp11
- cpp4r
- ggplot2
- golem
- plotnine
- purrr
- wbstats
Add a test coverage badge to your R packages using GitHub Actions
Mauricio “Pachá” Vargas S.
October 10, 2025
If this post is useful to you I kindly ask a minimal donation on Buy Me a Coffee. It shall be used to continue my Open Source efforts.
You can send me questions for the blog using this form and subscribe to receive an email when there is a new post.
I added a new package to my GitHub profile, armadillo4r, and no matter the different paths I took, it was impossible to get Codecov to detect the new repository.
After over thirty minutes of trying different things, I gave up and decided to create a GitHub Actions workflow that would generate a test coverage badge for my R packages without needing to set up a separate service like Codecov or Coveralls.
The result is the new package ghacoveragebadge, which you can use to add a test coverage badge to your R packages using GitHub Actions. Here is the badge for the kendallknight package that I updated today:
You can install the development version of ghacoveragebadge like so:
pak::pkg_install("pachadotdev/ghacoveragebadge")
To add a badge like the previous one to your own R package, go to the package’s main directory and run:
library(ghacoveragebadge) use_github_actions_coverage()
Using this function will create a GitHub Actions workflow file in .github/workflows/coverage.yaml that will run the test coverage analysis and generate the badge every time you push to the main branch or merge a pull request into main.
I hope it’s useful!
Loading…
