Day 3: GitHub Actions with r-lib/actions - CI/CD Setup 🚀

Automate your package testing across multiple platforms and R versions! 🔄
Quick setup: ⚡

💡 Pro Tip: The standard check runs on Windows, macOS, and Ubuntu with
multiple R versions.

📚 Resources: https://github.com/r-lib/actions

#GitHubActions #rstats #CI #RPackageAdvent2025

1/ The Trust Problem: You write a package on your Mac. A user on Windows tries it - it breaks. Another on Linux - different error. You can't test everywhere. Users lose trust. You lose sleep debugging platform-specific issues.
2/ The Manual Testing Nightmare: Before CI/CD, "testing across platforms" meant:
Begging friends with Windows machines
Spinning up VMs (if you knew how)
Hoping rhub worked
Crossing fingers for CRAN
Fixing bugs AFTER users found them
3/ Enter GitHub Actions: Every push, every pull request - your package gets tested on:
Windows (latest R, oldrel, devel)
macOS (multiple versions)
Ubuntu (multiple versions) Automatically. For free. While you sleep.

4/ One Command Setup:
usethis::use_github_action("check-standard")

That's it. You now have professional-grade CI that most companies pay thousands for. Your package is tested like tidyverse packages.

5/ What Actually Happens: When you push code:
GH Actions spins up 3+ machines
Installs R on each
Installs your dependencies
Runs R CMD check
Reports results back
All in ~5-10 minutes
You get a ✅ or ❌ immediately.
6/ Real Example: Last month I added a function using tempdir(). Worked perfectly on my Mac. GitHub Actions caught that it failed on Windows due to path separators. Found in 8 minutes, not 8 days post-CRAN submission.

7/ The Three Essential Actions:
usethis::use_github_action("check-standard") # Core testing
usethis::use_github_action("test-coverage") # Track coverage
usethis::use_github_action("pkgdown") # Auto-deploy docs

These three give you: testing, metrics, and documentation. Professional package development.

8/ Coverage Tracking: The test-coverage action pushes to https://codecov.io, giving you a badge showing % of code tested. This isn't vanity - it identifies untested functions that need attention. Public accountability drives quality.
Codecov: Code Coverage Testing & Insights Solution

Ship high-quality code & spend less time debugging. Improve developer workflow, re-run flaky tests, & track JavaScript bundle size. Learn about our code quality & coverage tool here.

Codecov
9/ Documentation Automation: The pkgdown action rebuilds your website on every push. Docs are ALWAYS current. No "oops, forgot to rebuild the site." Users always see up-to-date documentation. Zero extra work.
10/ The Confidence Factor: Before pushing to CRAN, you KNOW your package works everywhere. That ✅ on your commits means:
No platform-specific bugs
Tests pass on all versions
Documentation builds
Coverage is tracked
CRAN submission becomes routine, not stressful.
11/ The Bottom Line: GitHub Actions transforms package development from "hope it works" to "know it works." It's like having a QA team that works 24/7, for free, testing every change. This is how professionals develop packages.
@Drmowinckels these threads are very good. I have some reading to do.
@nxskok really happy you are enjoying them!