Giter Site home page Giter Site logo

craigcitro / r-travis Goto Github PK

View Code? Open in Web Editor NEW
176.0 17.0 42.0 223 KB

Tools for using R with Travis (http://travis-ci.org) in lieu of a website:

Home Page: https://github.com/craigcitro/r-travis/wiki

License: Apache License 2.0

R 1.70% Shell 98.30%

r-travis's Introduction

R+Travis

Build Status

NATIVE R SUPPORT IN TRAVIS IS LIVE!

We've finally merged support based on this repo into Travis-CI, so you can simply use language: r to test your R packages!

Setting up r-travis

This package has a simple shell script for use in running R package builds on travis, along with a sample .travis.yml file. One should be able to set up travis for their own project by:

  • Copying sample.travis.yml to .travis.yml in your project.
    • Copying sample_revdeps.travis.yml to .travis.yml in your project will passively check reverse dependencies.
  • Adding .travis.yml to your .Rbuildignore.
  • Modifying .travis.yml to list any packages that must be installed from github (instead of CRAN).
  • Turn on travis for your project. (Note that in some cases, it may take time for travis to start watching your repo.)
  • Add a travis "build status" shield to your README file.

See the wiki for more extensive documentation and examples.

Linux or OS X builds

By default, builds are done on Linux. That is enabled by choosing language: c in the .travis.yml file. Builds on OS X can be enabled by choosing language: objective-c. See the comments in sample.travis.yml.

Currently, Travis-CI does not support builds that loop over platforms (such as Linux and OS X) in one build.

The future

My plan is to ultimately merge this into travis as a first-class citizen, so that the simplest config would simply say language: R. However, I'm using this repo as a staging ground to make sure I have the kinks worked out first. The end goal would be for the .travis.yml for an R project to be something as simple as

language: r
github_packages:
  - assertthat
  - devtools

r-travis's People

Contributors

craigcitro avatar eddelbuettel avatar hadley avatar jimhester avatar krlmlr avatar richfitz avatar romainfrancois avatar schloerke avatar yihui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

r-travis's Issues

Compile knitr/Sweave documents

I've started to upload copies of book chapters/publications to github. It occurred to me that it would rstraight forward to use r-travis to test knitr documents (without altering r-travis).

I've mocked up an example work-flow at https://github.com/csgillespie/travis-examples/tree/travis-knitr

The key ideas are:

  • Create a DESCRIPTION file. This file only needs a Depends: section. The install_deps function then uses this file to install any packages that are needed by knitr/Sweave. In my example, the document just depends on knitr.
  • In the .travis.yml file, turn latex on and tweak the install step.

Comments? Should I add this under the recipes section of the wiki?

@yihui any suggestions?

Standardize 'verb' names

On the weekend, I wasted a build cycle or two because I had (mistakenly) assumed it was install_github when it is github_package.

Could we consider making every "install" operation be known as

  install_$foo

for different values of foo: aptget, github, cran, ... ie

  install_deps                   (already there)
  install_devtools              (new alias)
  install_aptget                 (new alias)
  install_r                         (new alias)
  install_r_binary              (new alias)
  install_github                 (new alias)

This would provide consistency as the other command also start with "action verbse" such as "dump" or "run".

Install additional Debian/Ubuntu packages

Can we add a hook to supply 'foo bar giz' so that 'sudo apt-get install foo bar giz' can be executed? My (trivial) test case is my tiny rhiredis package; it needs the hiredis C library from Debian/Ubuntu in order to build.

Make devtools optional

several folks chimed in on #17 asking to make devtools optional. i'm happy to do so if we need to; just to check, though, my understanding is that the two downsides of installing devtools are:

  • install time (devtools has several dependencies)
  • we use the bleeding edge devtools, which can sometimes bite.

one huge advantage for devtools is that it's able to read DESCRIPTION and install not just required packages, but also suggested and linkedto -- given that at least the former is almost always needed for tests to pass, it seems nice to make that happen without the user re-specifying dependencies in .travis.yml.

does that catch all the pros/cons? ( @eddelbuettel @yihui )

Error when lacking a tests directory

If my package doesn't contain a tests directory I get the following error:

cat: *.Rcheck/tests/*.Rout*: No such file or directory
The command "./travis-tool.sh run_tests" exited with 1.
Done. Your build exited with 1.

devtools error

See http://stackoverflow.com/questions/20569485/ and it may be a PBKAC by the user. But I would like @krlmlr to take a look as I fear that some of his code may be complicating matters here. Shouldn't it default to devtools from CRAN now?

Update: The post is now deleted. Users with SO rep above a threshold can still see it. In his screenshot, r-cran-devtools appears.

Better use of notifications

It'd be nice to:

  • get fewer emails
  • only use some branches for the shield in README
  • suggest not testing every branch by default, to make it easier on travis.

Use "$@" instead of "$*" and $*

Problem: "$*" expands to "$1 $2 $3...", i.e. one parameter. $* splits again, but may lead to a different value if the parameters contain spaces. "$@" is a robust alternative, even if we don't have spaces in our params.

open/close github issues on behalf of developper

Scenario:

I'm pushing some code to github that I think will fix a bug I'm tracking with github issues. I'd like the ability to embed the information that this push will maybe fix the bug. Something like:

git commit -m " #maybe_fixes #124"

We can imagine that e.g. using testthat, we can have the issue in the title of the test, e.g.

test_that( "this works #213", {
   ...
} )

Then, if the test passes and the issue is open, we close it.
And, if the test fails, but the issue is closed. we reopen it.

I'm pretty sure we can use github api for that (ping @cscheid). I guess this would need a user token.

Multiple R packages in a single repo

Is it possible to have multiple packages in a single repository? For example, I have multiple (very small) R packages that I use for teaching.

I suppose it would be nice for each package to be validated, but I suppose a global validation would be fine.

How to specify username != hadley in github R package dependencies?

Hi,

(This looks like a really cool project. Thx for putting this together!)

How do I specify the github username in this line of the .travis.yml:

If you'd like to use the github version of any of your dependencies, one can simply add a line like

- ./travis-tool.sh install_github <package>

I looked at travis-tool.sh and it seems you do not handle this at all?
devtools then defaults to username = getOption("github.user") and in the end to "hadley".

And I get, e.g., this in Travis CI:

+ echo 'Installing github package: BBmisc'
Installing github package: BBmisc
+ Rscript -e 'library(devtools); library(methods); options(repos=c(CRAN="http://cran.rstudio.com")); install_github("BBmisc")'
Installing github repo BBmisc/master from hadley
Downloading BBmisc.zip from https://github.com/hadley/BBmisc/archive/master.zip
Error: client error: (406) Not Acceptable
Execution halted

Please note that I might also want to list dependencies that I do not develop but other people. So we just need a second argument right?

Best,

Bernd

Install non-R dependencies

One of my packages requires the R package rgdal, which depends on a non-R library called GDAL.

Does anyone else depend on rgdal? Perhaps there is a way to specify installing GDAL in the .travis.yml file?

uploading the check directory to dropbox

I played with this this morning. This directory has been uploaded to dropbox by travis. This is an intermediate measure but at least is a way to see build artefacts without dumping them in the log file.

This needs the dropbox.sh file from my fork of r-travis, inspired from https://github.com/andreafabrizi/Dropbox-Uploader by modified to fit nicely with travis.

It also needs some dropbox specific environment variables to handle authentification with dropbox etc ...

My dropbox branch of dplyr for example has :

env:
  global:
  - ACCESS_LEVEL=sandbox
  - secure: LELmW/uGnmc8gPcJcDMV5SeAy7eieqSrNTqW8mSrSShgu31ifQ9tzd+5U2SxL/LVit+oxT/oyXAKSjX8oebBC8qSZKMR33+kURxq8HHZ6eqhvJv3lh7wjvFpXdPdgr+HrtCqnKBqbMN0oQkMZAtBUTpIwf0K+Zw+eNon0GdYIc4=
  - secure: QOMc+iTz2UspKkm4J6XDNMxzALAzH8NCDR0J+s3JG2VWcHS0m0sbK6rIiTnztzonTP9052HfpgdUY8Culjpww7JamCQ3CYUA83NAdmXLrsSsUWC6emxkw0dCUi2exMVllNfy9uH+Dcj1ytZpDrabeBDS6CF4jbp7wpfMrfJeOO0=
  - secure: L3fKoY3SMpxsaLz/TUIy07j209E5ZCBFaXLEb3j0f+hYc97432xFDcBNjtE8TQ8X0GqnmCxZX/+45QRm2th7Hk2Ei1imIM2OMDQNnBFBnbzqN4qTrGkPCP6YEfKqw8NvxB6GkJEXgxE1zHIhTguicvDSPKNO1SUAirnzkRc1C6M=
  - secure: V94Mz3NGm5e39XPr776K3HMzX8m9Khz3DWwQgjE6gADn2kElm4ZgLYJ+hmTaW1W79vx/GDD6n3whPCP28oocOB/LLVX4zzY5tvjVegSo6gY1wRXPF+HEysjokxlMfVC68qS2qDr4f9FgJb0oREddJ5CxINZOL6suBYj9yzPhafA=

The 4 secure lines above are generated by travis encrypt ENV_VAR=value for the 4 environment variable that ./dropbox.sh needs:

APPKEY=xxx
APPSECRET=yyy
ACCESS_LEVEL=sandbox
OAUTH_ACCESS_TOKEN=xxx
OAUTH_ACCESS_TOKEN_SECRET=xxx

To get APPKEY and APPSECRET, we just create a dropbox app.
Then for the OAUTH_ACCESS_TOKEN and OAUTH_ACCESS_TOKEN_SECRET, I've used the original https://github.com/andreafabrizi/Dropbox-Uploader script. When you run it the first time and you follow through, it writes a ~/.dropbox_uploader file that contains the information.

This is still a bit involved but this is meant as a proof of concept of uploading whatever we create on travis into dropbox. I guess this could be applied to other things like google drive ...

With a bit of imagination, we could then have things like up to date vignettes, benchmark results.

Eventually I think it would make sense to have the information not necessarily on dropbox but on some service we would create as a community to make sense and present nicely.

wget | bash installation style

Copying travis-tool.sh, chmodding it and running bootstrap and bootstrap_devtools should happen in one command like

wget ... | bash

Can be done with Here documents and cat

Old travis-tool.sh remains a stub that notifies the user of the new syntax

Fragility from added repos

This is mostly an FYI and to see if we may want to make a few more things optional.

I just pulled and merged, and the build following the push failed as the PPA could not be reached: https://travis-ci.org/eddelbuettel/r-travis/builds/13442161

We need to keep an eye on events like this because if it happens too frequently we cannot rely on the extra .deb binaries.

Craig is of course free to close this as there is nothing operational in here...

More control over testing

Depending on what you're working on, a full R CMD check might be overkill. It would be nice to have the ability to (e.g.) just run tests

Source travis-tool.sh instead of calling it

This is a suggestion for a rather radical change to the architecture of our tiny script. If necessary, it can be made fully backward-compatible.

Advantages:

  1. We can export environment variables to the Travis build script (e.g., PATH on OS X, required for LaTeX)
  2. We can control premature exit with success from the script to avoid testing build configurations we don't want to test
  3. No need to prefix every call to our tool with ./travis-tool.sh -- this will be helpful for a later migration to travis-build, too
  4. The travis-tool.sh script can be simplifed somewhat (of course not if backward compatibility is attempted)
  5. Installation and bootstrapping can be carried out in one line, simplifying users' .travis.yml: source <(wget ...)

This works, because the entire build process in Travis CI is carried out in the same shell.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.