R-hub v2

R-hub v2 uses GitHub Actions to run R CMD check and similar package checks. The rhub package helps you set up R-hub v2 for your R package, and start running checks.


Installation

Install rhub from CRAN:

pak::pkg_install("rhub")

Usage

Requirements

  • A Github account.
  • Your R package must be in a GitHub repository.
  • You need a GitHub Personal Access Token. You can use the gitcreds package to add the token to the git credential store.

See the R Consortium runners section for using rhub if your package is not on GitHub.

Private repositories

rhub uses GitHub Actions, which is free for public repositories. For private repositories you also get some minutes for free, depending on the GitHub subscription you have. See About billing for GitHub Actions for details.

Setup

  1. Switch to the directory of your package, and call rhub::rhub_setup() to add the R-hub workflow file to your package.
rhub::rhub_setup()
#> Setting up R-hub v2.                                                            
#>  Found R package at /tmp/cli.                                                  
#>  Found git repository at /tmp/cli.                                             
#>  Created workflow file /tmp/cli/.github/workflows/rhub.yaml.                   
#>                                                                                 
#> Notes:                                                                          
#>  The workflow file must be added to the default branch of the GitHub           
#>   repository.                                                                   
#>  GitHub actions must be enabled for the repository. They are disabled for      
#>   forked repositories by default.                                               
#>                                                                                 
#> Next steps:                                                                     
#>  Add the workflow file to git using `git add <filename>`.                      
#>  Commit it to git using `git commit`.                                          
#>  Push the commit to GitHub using `git push`.                                   
#>  Call `rhub::rhub_doctor()` to check that you have set up R-hub correctly.     
#>  Call `rhub::rhub_check()` to check your package.                              
  1. Run git commit and git push to push the workflow file to GitHub.

  2. Run rhub::rhub_doctor() to check if everything is set up correctly:

rhub::rhub_doctor()
#>  Found R package at /tmp/cli.                                                  
#>  Found git repository at /tmp/cli.                                             
#>  Found GitHub PAT.                                                             
#>  Found repository on GitHub at <https://github.com/r-lib/cli>.                 
#>  Does your GitHub PAT have the right scopes?                                   
#> Error:                                                                          
#> ! Could not use the PAT to authenticate to GitHub                               
#>  Make sure that the URL and your PAT are correct.                              
#> Type .Last.error to see the more details.                                       

Run checks

Use rhub::rhub_platforms() to get a list of supported platforms and checks:

#> ── Virtual machines ─────────────────────────────────────────────────────────── 
#>  1 [VM]  linux                                                                  
#>    All R versions on GitHub Actions ubuntu-latest                               
#>  2 [VM]  macos                                                                  
#>    All R versions on GitHub Actions macos-13                                    
#>  3 [VM]  macos-arm64                                                            
#>    All R versions on GitHub Actions macos-latest                                
#>  4 [VM]  windows                                                                
#>    All R versions on GitHub Actions windows-latest                              
#>                                                                                 
#> ── Containers ───────────────────────────────────────────────────────────────── 
#>  5 [CT]  atlas  [ATLAS]                                                         
#>    R Under development (unstable) (2024-06-03 r86679) on Fedora Linux 38 (Conta…
#>    ghcr.io/r-hub/containers/atlas:latest                                        
#>  6 [CT]  c23  [C23]                                                             
#>    R Under development (unstable) (2024-06-02 r86665) on Ubuntu 22.04.4 LTS     
#>    ghcr.io/r-hub/containers/c23:latest                                          
#>  7 [CT]  clang-asan  [asan, clang-ASAN, clang-UBSAN, ubsan]                     
#>    R Under development (unstable) (2024-06-03 r86679) on Ubuntu 22.04.4 LTS     
#>    ghcr.io/r-hub/containers/clang-asan:latest                                   
#>  8 [CT]  clang16  [clang16]                                                     
#>    R Under development (unstable) (2024-06-02 r86665) on Ubuntu 22.04.4 LTS     
#>    ghcr.io/r-hub/containers/clang16:latest                                      
#>  9 [CT]  clang17  [clang17]                                                     
#>    R Under development (unstable) (2024-06-02 r86665) on Ubuntu 22.04.4 LTS     
#>    ghcr.io/r-hub/containers/clang17:latest                                      
#> 10 [CT]  clang18  [clang18]                                                     
#>    R Under development (unstable) (2024-06-02 r86665) on Ubuntu 22.04.4 LTS     
#>    ghcr.io/r-hub/containers/clang18:latest                                      
#> 11 [CT]  clang19  [clang19]                                                     
#>    R Under development (unstable) (2024-06-02 r86665) on Ubuntu 22.04.4 LTS     
#>    ghcr.io/r-hub/containers/clang19:latest                                      
#> 12 [CT]  donttest  [donttest]                                                   
#>    R Under development (unstable) (2024-06-02 r86665) on Ubuntu 22.04.4 LTS     
#>    ghcr.io/r-hub/containers/donttest:latest                                     
#> 13 [CT]  gcc13  [gcc13]                                                         
#>    R Under development (unstable) (2024-06-03 r86679) on Fedora Linux 38 (Conta…
#>    ghcr.io/r-hub/containers/gcc13:latest                                        
#> 14 [CT]  gcc14  [gcc14]                                                         
#>    R Under development (unstable) (2024-06-03 r86679) on Fedora Linux 40 (Conta…
#>    ghcr.io/r-hub/containers/gcc14:latest                                        
#> 15 [CT]  intel  [Intel]                                                         
#>    R Under development (unstable) (2024-06-03 r86679) on Fedora Linux 38 (Conta…
#>    ghcr.io/r-hub/containers/intel:latest                                        
#> 16 [CT]  mkl  [MKL]                                                             
#>    R Under development (unstable) (2024-06-03 r86679) on Fedora Linux 38 (Conta…
#>    ghcr.io/r-hub/containers/mkl:latest                                          
#> 17 [CT]  nold  [noLD]                                                           
#>    R Under development (unstable) (2024-06-03 r86679) on Ubuntu 22.04.4 LTS     
#>    ghcr.io/r-hub/containers/nold:latest                                         
#> 18 [CT]  nosuggests  [noSuggests]                                               
#>    R Under development (unstable) (2024-06-03 r86679) on Fedora Linux 38 (Conta…
#>    ghcr.io/r-hub/containers/nosuggests:latest                                   
#> 19 [CT]  rchk  [rchk]                                                           
#>    R Under development (unstable) (2024-06-03 r86679) on Ubuntu 22.04.4 LTS     
#>    ghcr.io/r-hub/containers/rchk:latest                                         
#> 20 [CT]  ubuntu-clang  [r-devel-linux-x86_64-debian-clang]                      
#>    R Under development (unstable) (2024-06-03 r86679) on Ubuntu 22.04.4 LTS     
#>    ghcr.io/r-hub/containers/ubuntu-clang:latest                                 
#> 21 [CT]  ubuntu-gcc12  [r-devel-linux-x86_64-debian-gcc]                        
#>    R Under development (unstable) (2024-06-03 r86679) on Ubuntu 22.04.4 LTS     
#>    ghcr.io/r-hub/containers/ubuntu-gcc12:latest                                 
#> 22 [CT]  ubuntu-next  [r-next, r-patched, r-patched-linux-x86_64]               
#>    R version 4.4.1 beta (2024-06-03 r86679) on Ubuntu 22.04.4 LTS               
#>    ghcr.io/r-hub/containers/ubuntu-next:latest                                  
#> 23 [CT]  ubuntu-release  [r-release, r-release-linux-x86_64, ubuntu]            
#>    R version 4.4.0 (2024-04-24) on Ubuntu 22.04.4 LTS                           
#>    ghcr.io/r-hub/containers/ubuntu-release:latest                               
#> 24 [CT]  valgrind  [valgrind]                                                   
#>    R Under development (unstable) (2024-06-03 r86679) on Fedora Linux 38 (Conta…
#>    ghcr.io/r-hub/containers/valgrind:latest                                     

Run rhub::rhub_check() to start R-hub v2 checks on GitHub Actions:

rhub::rhub_check()
#>  Found git repository at /tmp/cli.                                             
#>  Found GitHub PAT.                                                             
#>                                                                                 
#> Available platforms (see `rhub::rhub_platforms()` for details):                 
#>                                                                                 
#>  1 [VM] linux          R-* (any version)                ubuntu-latest on GitHub 
#>  2 [VM] macos          R-* (any version)                macos-13 on GitHub      
#>  3 [VM] macos-arm64    R-* (any version)                macos-latest on GitHub  
#>  4 [VM] windows        R-* (any version)                windows-latest on GitHu 
#>  5 [CT] atlas          R-devel (2024-06-03 r86679)      Fedora Linux 38 (Contai…
#>  6 [CT] c23            R-devel (2024-06-02 r86665)      Ubuntu 22.04.4 LTS      
#>  7 [CT] clang-asan     R-devel (2024-06-03 r86679)      Ubuntu 22.04.4 LTS      
#>  8 [CT] clang16        R-devel (2024-06-02 r86665)      Ubuntu 22.04.4 LTS      
#>  9 [CT] clang17        R-devel (2024-06-02 r86665)      Ubuntu 22.04.4 LTS      
#> 10 [CT] clang18        R-devel (2024-06-02 r86665)      Ubuntu 22.04.4 LTS      
#> 11 [CT] clang19        R-devel (2024-06-02 r86665)      Ubuntu 22.04.4 LTS      
#> 12 [CT] donttest       R-devel (2024-06-02 r86665)      Ubuntu 22.04.4 LTS      
#> 13 [CT] gcc13          R-devel (2024-06-03 r86679)      Fedora Linux 38 (Contai…
#> 14 [CT] gcc14          R-devel (2024-06-03 r86679)      Fedora Linux 40 (Contai…
#> 15 [CT] intel          R-devel (2024-06-03 r86679)      Fedora Linux 38 (Contai…
#> 16 [CT] mkl            R-devel (2024-06-03 r86679)      Fedora Linux 38 (Contai…
#> 17 [CT] nold           R-devel (2024-06-03 r86679)      Ubuntu 22.04.4 LTS      
#> 18 [CT] nosuggests     R-devel (2024-06-03 r86679)      Fedora Linux 38 (Contai…
#> 19 [CT] rchk           R-devel (2024-06-03 r86679)      Ubuntu 22.04.4 LTS      
#> 20 [CT] ubuntu-clang   R-devel (2024-06-03 r86679)      Ubuntu 22.04.4 LTS      
#> 21 [CT] ubuntu-gcc12   R-devel (2024-06-03 r86679)      Ubuntu 22.04.4 LTS      
#> 22 [CT] ubuntu-next    R-4.4.1 beta (2024-06-03 r86679) Ubuntu 22.04.4 LTS      
#> 23 [CT] ubuntu-release R-4.4.0 (2024-04-24)             Ubuntu 22.04.4 LTS      
#> 24 [CT] valgrind       R-devel (2024-06-03 r86679)      Fedora Linux 38 (Contai…
#>                                                                                 
#> Selection (comma separated numbers, 0 to cancel): 1, 5                          
#>                                                                                 
#>  Check started: linux, atlas (uneconomical-gharial).                           
#>   See <https://github.com/r-lib/cli/actions> for live output!                   

The R Consortium runners

If you don’t want to put your package on GitHub, you can still use the rhub package to run package checks on any supported platform using a shared pool of runners in the https://github.com/r-hub2 GitHub organization.

The process is similar to the first version of R-hub:

  • Set your working directory to the R package you want to check.

  • Obtain a token from R-hub, to verify your email address:

    rc_new_token()

    (You do not need to do this, if you already submitted packages to a previous version of R-hub from the same machine, using the same email address. Call rc_list_local_tokens() to check if you already have tokens.)

  • Submit a build with

    rc_submit()
  • Select the platforms you want to use, and follow the instructions and the link provided to see your check results.

Limitations of the R Consortium runners

  • You package will be public for the world, and will be stored in the https://github.com/r-hub2 organization. Your check output and results will be public for anyone with a GitHub account. If you want to keep your package private, you can put it in a private GitHub repository, and use the rhub_setup() and rhub_check() functions instead.
  • The R Consortium runners are shared among all users, so you might need to wait for your builds to start.
  • You have to wait at least five minutes between submissions with rc_submit().
  • Currently you need to create a GitHub account to see the check logs of your package. You don’t need a GitHub account to submit the checks.

To avoid these limitations (except for the need for a GitHub account), put your package in a GitHub repository, and use the rhub_setup() and rhub_check() functions instead of rc_submit() and the R Consortium runners.

Code of Conduct

Please note that the rhub package is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

License

MIT © R Consortium