Michael Lanyon's Blog Notes and thoughts from LanyonM

Testing With Multiple Grails Versions on Travis-CI

Comments

Maintaining plugins for quickly evolving frameworks can become burdensome if the testing tools don’t help you ensure backward compatibility. We have been slowly incorporating better testing into the Grails Feature Toggle Plugin and have been looking to test all minor versions of Grails 2. If only there were a way for Travis-CI to test all those versions of Grails…

Travis-CI + Grails

Thanks to bjfish, there’s a quick and easy way to have Travis test multiple versions of Grails. Using GVM, you can install an environment-specified version of Grails within Travis. We have successfully integrated this approach into the Feature Toggle Plugin. Have a look at our .travis.yml here:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
language: groovy

jdk:
- oraclejdk6

env:
- GRAILS_VERSION=2.3.1
- GRAILS_VERSION=2.2.4
- GRAILS_VERSION=2.1.5
- GRAILS_VERSION=2.0.4

before_install:
- rm -rf ~/.gvm
- curl -s get.gvmtool.net > ~/install_gvm.sh
- chmod 775 ~/install_gvm.sh
- ~/install_gvm.sh
- echo "gvm_auto_answer=true" > ~/.gvm/etc/config
- source ~/.gvm/bin/gvm-init.sh
- gvm install grails $GRAILS_VERSION || true

branches:
  only:
    - master
    - more-testing

script: grails clean
     && grails upgrade --non-interactive
     && grails test-app --non-interactive

Another likely influential post outlines this same approach and the comments (this one in particular) discuss whether this is the cleanest solution. It certainly sounds like something to look into.

Hopefully using Travis-CI to test multiple versions of Grails will help maintainers establish backward compatibility for their plugins and libraries.