The goal of travis is to simplify the setup of continuous integration with Travis CI. Its main purpose is to provide a command-line way in R for certain Travis tasks that are usually done in the browser (build checking, cache deletion, build restarts, etc.). To learn more about Travis CI, read this blog post and the Getting Started vignette of the tic package.
You can install travis from github with:
The package is linked to the “rtravis” application, and will request GitHub permissions to carry out its actions. We try hard to minimize the scope of the permissions we request, but this may lead to multiple authentication requests. Revoking these permissions also invalidates any SSH keys created by this package.
Create a repository on GitHub (if it’s not there yet)
Show the GitHub repository name
Browse the repo on Travis
The first time you’re calling these function in an R session, several browser windows will open, prompting you:
Turn on Travis for this repo (syncs from GitHub if necessary!)
Set up push access for Travis: This creates an SSH key, stores it as encoded encrypted environment variable on Travis, and enables push access for the corresponding public key. GitHub notifies you via e-mail.
Query current state of the repo on Travis.
A collection of 25 Travis CI builds: - id: 430482536, number: 415, state: started, duration: NULL, event_type: pull_request, ... - id: 430482493, number: 414, state: failed, duration: 2886, event_type: push, ... - id: 430453895, number: 413, state: failed, duration: 3028, event_type: pull_request, ... - id: 430453887, number: 412, state: failed, duration: 3251, event_type: push, ... - id: 430442750, number: 411, state: failed, duration: 2716, event_type: pull_request, ... - ...
Retrieve cache information
A collection of 56 Travis CI caches: - repository_id: 10785882, size: 68080246, name: cache-linux-trusty- 118a1ba90e288592bc83914310d60771d319c6a1e959176fb3aadede7b9782cb--R-3.5.0.tgz, branch: PR.64, last_modified: 2018-09-13T22:29:55Z, repo: list(`@type` = "repository", `@href` = "/repo/10785882", `@representation` = "minimal", id = 10785882, name = "tic", slug = "ropenscilabs/tic") - repository_id: 10785882, size: 60603887, name: cache-linux-trusty- e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855--R-3.1.3.tgz, branch: PR.64, last_modified: 2018-09-13T22:27:07Z, repo: list(`@type` = "repository", `@href` = "/repo/10785882", `@representation` = "minimal", id = 10785882, name = "tic", slug = "ropenscilabs/tic") [...]
Clear all caches (caution, currently it’s only possible to delete all caches!):
Finished deleting caches for <repo> on Travis CI.
Create a Personal Access Token (PAT) to avoid GitHub’s rate limit
Create a personal access token, make sure that you are signed in as the correct user. The suggested description 'travis+tic for <repo>' has been copied to the clipboard. If you use this token only to avoid GitHub's rate limit, you can leave all scopes unchecked. Then, copy the new token to the clipboard, it will be detected and applied automatically. Please visit https://github.com/settings/tokens/new. A browser window will be opened. Waiting for PAT to appear on the clipboard.
After competing all authentications, the process stops here. A browser window will be opened, prompting you to create a new GitHub PAT. At this point, the suggested description for the PAT has been placed in your clipboard, you can hit Ctrl + V (Cmd + V on the Mac) to paste the description in the text box. Leave all checkboxes unchecked, click the green “Generate token” button. The newly created token appears in the browser, click the clipboard icon next to the token to place it on the clipboard. The R process continues:
Detected PAT, clearing clipboard. Finished adding private environment variable GITHUB_PAT to <repo> on Travis CI.
Set or update environment variables on Travis. Caution: The secret value passed to this function is captured in the R history, you may want to review your
Finished adding private environment variable variable to <repo> on Travis CI.
Fetch the complete log of a specific build
Setting up libatomic1:amd64 (4.8.4-2ubuntu1~14.04.4) ... Setting up libitm1:amd64 (4.8.4-2ubuntu1~14.04.4) ... Setting up libgomp1:amd64 (4.8.4-2ubuntu1~14.04.4) ... Setting up libasan0:amd64 (4.8.4-2ubuntu1~14.04.4) ... [...]
Apart from automating away a few button flips, it also provides an easy method to set up push access which can be then triggered (on Travis) by the companion package tic via the
use_tic() function, which performs the following steps:
tic.Rfile depending on the repo type (package, website, bookdown, …)
Fine-grained control is available through more specialized functions, see the examples below.