Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Starting version 1.0.7, the OpenCPU cloud server adds support for continuous integration (CI). This means that Github repositories can be configured to automatically install your package on an OpenCPU server, every time a commit is pushed. To take advantage of this feature, it is required that:
- Your R source package is hosted on Github.
- The name of the Github repository is identical to the name of the R package
- Your Github user account has a public email address
To setup CI, add the following URL as a ‘WebHook’ in your Github repository:
https://public.opencpu.org/ocpu/webhook
For instructions how to add webhooks, see here. To trigger a build, either push a commit to the master branch, or select the box with the URL and press the Test Hook
button. You should receive an email that reports if the installation was successful. If it was, the package will directly be available for remote use through the OpenCPU API.
But why?
Continuous Integration in OpenCPU addresses several issues at once:
- If you introduced a bug and your package fails to install, you get notified by email immediately.
- Deploy packages/apps on OpenCPU public cloud servers without having to wait until the server synchronizes.
- You can use CI without relying on a 3rd party service; installing your own OpenCPU server is easy.
Every active R package maintainer could benefit from some sort of CI environment, with or without OpenCPU. Earlier this year, Yihui had a cool blog post about Travis CI (also see r-travis). Simon Urbanek’s rforge.net is another service that provides some auto-building functionality. One way or another, it’s important to frequently check that your all your packages still build, pass unit tests, haven’t introduced conflicts, etc. That way you catch problems immediately while the changes are still fresh in your memory.
Moreover, unexpected changes in R or dependencies are often beyond your control, but can cause your package to work one day, and break the next. The article on Possible Directions for Improving Dependency Versioning in R (The R Journal Vol. 5/1, June 2013) explained that CRAN requires all “current” packages to compatible, which assumes that all package authors are constantly on the lookout for changes in dependencies and reverse dependencies, forever. This system is unsustainable and will eventually have to be revised, but continuous integration can at least help detecting problems as soon as possible.
Final notes
Some final notes/disclaimers: this feature is currently being tested; please let me know if something is not working. To setup your own OpenCPU CI server, you need to configure an SMTP server; which is not yet documented in the PDF manual. Also note that currently only the default (master) branch will be deployed; pushes to other branches are ignored. Finally some packages might not build on the public demo server because of missing system dependencies. If your package needs any particular libraries, send me an email (or set up your own cloud server 🙂
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.