Skip to content

Instantly share code, notes, and snippets.

@romainfrancois
Created October 29, 2013 08:10
Show Gist options
  • Save romainfrancois/7210732 to your computer and use it in GitHub Desktop.
Save romainfrancois/7210732 to your computer and use it in GitHub Desktop.
Log for last travis build of a project

This uses siesta to pull from travis the log for the last build of a given project.

$ travis_log hadley/dplyr | tail -n30
Le chargement a nécessité le package : methods
Le chargement a nécessité le package : siesta
* checking package vignettes in ‘inst/doc’ ... WARNING
Package vignettes without corresponding PDF/HTML:
   ‘benchmark-baseball.Rmd’
   ‘databases.Rmd’
   ‘introduction.Rmd’
   ‘mysql-setup.Rmd’
   ‘postgres-setup.Rmd’
   ‘window-functions.Rmd’

* checking running R code from vignettes ...
   ‘benchmark-baseball.Rmd’ ... OK
   ‘databases.Rmd’ ... OK
   ‘introduction.Rmd’ ... OK
   ‘mysql-setup.Rmd’ ... OK
   ‘postgres-setup.Rmd’ ... OK
   ‘window-functions.Rmd’ ... OK
 OK
* checking re-building of vignette outputs ... OK

WARNING: There were 2 warnings.
NOTE: There were 2 notes.
See
  ‘/home/travis/build/hadley/dplyr/dplyr.Rcheck/00check.log’
for details.


The command "./travis-tool.sh run_tests" exited with 0.

Done. Your build exited with 0.

#!/usr/bin/RScript
require( methods)
require( siesta )
travis <- json_api( "https://api.travis-ci.org/" )
project_builds <- travis$bind( "repos/:owner_name/:name/builds",
id, number, branch, state, result, message
)
builds <- travis$bind( "/builds/:id" )
jobs <- travis$bind( "/jobs/:id" )
args <- commandArgs(TRUE)
options( width = 200 )
rx <- "^(.*)/(.*)$"
user <- sub( rx, "\\1", tail( args, 1L) )
repo <- sub( rx, "\\2", tail( args, 1L) )
last_build <- head( project_builds( user, repo )$id, 1 )
data <- builds( last_build )
job_id <- data$matrix[[1]]$id
log <- jobs( job_id )$log
writeLines( log )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment