Get notified of failing CRAN checks

A GitHub Action for package developers

cran
r
pkg-dev
Author

Josiah Parry

Published

September 1, 2024

Background

  • CRAN performs checks on all CRAN packages quite frequently.
  • If a package has a warning or an error you have a week or two to fix it.
  • Unfixed packages get removed.
  • If your package depends on the removed package it also gets removed.
  • You will not be notified if your package is removed.
  • That sucks.

Get informed: CRAN checks GitHub Action

There is a new GitHub Action that you can use with your CRAN package. It will run once a day. If there are any WARN or ERROR statuses in any of the check flavors, then the GitHub Action will fail.

Add the action

usethis::use_github_action(
  url = "https://github.com/flrsh-dev/cran-checks/blob/main/check-pkg/cran-checks.yaml",
  open = TRUE
)

This will open a yaml file for you with the following:

name: Check CRAN status

on:
  schedule:
    # Runs daily at 4:00 PM UTC (9:00 AM PST)
    - cron: '0 16 * * *'  
  # allows for manually running of the check
  workflow_dispatch:

jobs:
  check_cran_status:
    runs-on: ubuntu-latest

    steps:
      - name: Get CRAN checks
        uses: flrsh-dev/cran-checks/check-pkg@main
        with:
          pkg: YOUR-PKG-NAME

Replace YOUR-PKG-NAME with the name of your package (no quotes). Commit the file to GitHub and voilá.

How this works

Since CRAN can’t be bothered to email us when they remove a package, we can utilized GitHub Actions to be our messenger.

Whenever a GitHub Action fails, an email is sent to you so you know. Isn’t that nice?

The flrsh-dev/cran-checks repository fetches the status of all packages daily. Then stores them as a json file that is hosted on GitHub pages. They can be accessed from url https://flrsh-dev.github.io/cran-checks/b64.json.

The GitHub Action checks for your package’s json file and looks at all of the statuses. If the package isn’t found or if there is a single warning or error, it fails.

Motivation: packages removed without warning

On August 19th, 2024, CRAN removed 3 of my packages without so much as an email. I was notified by a colleague who was giving a live workshop to the US Forest Service on August 21st. When the attendants tried to install the packages, they weren’t on CRAN. It was a very bad look.

How were they supposed to know the packages we’re gone? They were there when they tested. I didn’t get any warning so I couldn’t help them find a way to provide a work around.

Solution: always check your CRAN checks

I’ve been told that I should check the status of my CRAN package checks on every flavor every day. CRAN tests on r-devel, so frequently there are false positives. Also, I’ve got a lot going on and I can hardly remember to talk myself on a walk some days. Other package managers will let you know if your package is failing, why doesn’t CRAN?

A future of CRAN check messaging?

Ideally, I would like to have an opt-in service that provides these checks daily and will email you directly if any of your R packages are failing. However, this would require funding which I don’t have.

If you are interested in sponsoring this project further, email me at josiah.parry at gmail dot com and we can discuss this. I think the R community could benefit quite greatly.