|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: Testing Your Project with Rubinius on Travis |
| 4 | +author: Brian Shirai |
| 5 | +--- |
| 6 | + |
| 7 | +[Travis CI](http://travis-ci.org) has been a tremendously useful tool for |
| 8 | +automating testing and has provided Ruby implementations with valuable |
| 9 | +feedback. However, it can be a trial-and-error process to find the right |
| 10 | +incantations for `.travis.yml` to get your preferred selection of Ruby |
| 11 | +implementations running. This post explains how to test your project on |
| 12 | +Rubinius. |
| 13 | + |
| 14 | +With the Rubinius 2.0 release, there are no longer language modes. Rubinius is |
| 15 | +presently working on compatibility with the upcoming MRI 2.1 release. There |
| 16 | +are still compatibility issues to be fixed, primarily keyword syntax and some |
| 17 | +core library API changes. What this means for your `.travis.yml` file is that |
| 18 | +'rbx-18mode' and 'rbx-19mode' are no longer supported. We submitted a patch to |
| 19 | +the [Travis lint tool](https://github.com/travis-ci/travis-lint) to check for |
| 20 | +this, so please use the linter! |
| 21 | + |
| 22 | +So, if those language modes are no longer available, what should you add to |
| 23 | +your `.travis.yml` file? Remember that Rubinius is releasing new versions every |
| 24 | +week or so. Together with recent changes to RVM, this gives four options for |
| 25 | +how specific you want to be about the Rubinius version you test against. The |
| 26 | +following list of Rubinius options is from least-to-most specific: |
| 27 | + |
| 28 | +1. 'rbx' - This means the most recent Rubinius release. Every time your tests |
| 29 | + run, the most recently released binary will be used. |
| 30 | +1. 'rbx-X' - This means the most recent Major release. For example, if you use |
| 31 | + 'rbx-2' (which is the only one available right now), your tests will run on |
| 32 | + the most recent 2.Y.Z release, but would not run on 3.Y.Z. |
| 33 | +1. 'rbx-X.Y' - This means the most recent Minor release. If you use 'rbx-2.2', |
| 34 | + your tests will run on the most recent 2.2.Z release, but will not use the |
| 35 | + 2.3.Z or 2.1.Z release. |
| 36 | +1. 'rbx-X.Y.Z' - This means precisely the specified release. So, 'rbx-2.2.1' |
| 37 | + will run only on the 2.1.1 releease and no other release. |
| 38 | + |
| 39 | +This method of designating the version of Rubinius you wish to run against |
| 40 | +should look similar to specifying versions of gems with the pessimistic |
| 41 | +operator (~>). It is intended to give you the same flexibility while allowing |
| 42 | +for stability constraints that you choose. |
| 43 | + |
| 44 | +Since each of these designations is independent, you can mix and match them as |
| 45 | +you wish. For example, if you know that Rubinius 2.2.1 is green for your |
| 46 | +project, you can specify both 'rbx-2.2.1' and 'rbx'. Or you can always stay on |
| 47 | +the cutting edge by just using 'rbx'. |
| 48 | + |
| 49 | +If you need help getting your project set up or updated on Travis, please let |
| 50 | +us know. I've created a simple project called |
| 51 | +[travis-canary](https://travis-ci.org/rubinius/travis-canary) that you can |
| 52 | +check to see if the ways of specifying Rubinius listed above are currently |
| 53 | +working on Travis. |
| 54 | + |
| 55 | +Happy testing! |
0 commit comments