This is the successor / continuation of the r-travis repository, which is itself a maintained fork of the (now deprecated) original r-travis repository by Craig Citro et al. I was an early contributor to this project, and quite like its design and features -- so I have been keeping it around, maintained and extended it. It is my 'go-to' CI setup for a few dozen repositories affecting a fairly decent number of users.
See the r-ci webpage for a brief overview of usage with GitHub Actions, Travis, Azure DevOps and Docker. See this r^4 blog post for a short video and background slides.
The file .github/workflows/ci.yaml (also used in many of my repos) provides a working example. It
is frequently a copy or variant of the r-ci.yaml file here. It relies on a
corresponding GitHub Action which run boths setup and bootstrap steps and should be all you need.
A minimal versions follows:
# Run CI for R using https://eddelbuettel.github.io/r-ci/
name: ci
on:
push:
pull_request:
env:
_R_CHECK_FORCE_SUGGESTS_: "false"
jobs:
ci:
strategy:
matrix:
include:
#- {os: macOS-latest}
- {os: ubuntu-latest}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup
uses: eddelbuettel/github-actions/r-ci@master
- name: Dependencies
run: ./run.sh install_deps
- name: Test
run: ./run.sh run_tests
#- name: Coverage
# if: ${{ matrix.os == 'ubuntu-latest' }}
# run: ./run.sh coverageOther variants can be found at different GitHub repos. They sometimes experiment with different
containers, or with swapping install_all (which includes Suggests:) for install_deps.
An older and minimal example of use with Travis follows:
language: c
sudo: required
dist: focal
before_install:
- curl -OLs https://eddelbuettel.github.io/r-ci/run.sh && chmod 0755 run.sh
- ./run.sh bootstrap
install:
- ./run.sh install_deps
script:
- ./run.sh run_testsThis downloads the run.sh script, uses it to bootstrap the test environment, then installs
dependencies via install_deps and finally runs tests. For a realistic but real example see e.g.
this .travis.yml file of package
digest. For another example, see
package tidyCpp which shows how to use the run.sh
script with Travis CI as well as
with GitHub
Actions, or
package dang (featured in the
video mentioned above) Numerous variations are possible: running
'test matrices' across macOS and Linux, using BSPM for binaries (both of those are used by
digest, running with several g++
versions (as used by
RcppSimdjson, ...).
We also use the same approach of downloading run.sh and invoking it for the different steps in
with GitHub Actions (e.g. for
tidyCpp). There
is also an older Action r-ci-setup for
GitHub to download run.sh
and set it up. Similarly, Azure Pipelines can be used (as was done by a test repo on Azure). The
newer Action r-ci is now
preferred as it includes the bootstrap step.
There are also other options of use with PPAs and more---for fullest details see the source of the
shell script run.sh.
As of September 2022, we rely on r2u to supply a full set of
binaries for CRAN for use on Ubuntu LTS. You can use it via install_deps() or install_all()
without having to supply the r-cran-* packages explicitly.
Dirk Eddelbuettel (for this maintained fork)
Craig Citro, Kirill Mueller, Dirk Eddelbuettel, ... (for the original r-travis)