We build two versions of our gem. One for Ruby and one for JRuby . This is achieved by running gem build ./yourgem.gemspec under each platform as in the example below:
$ rvm use ruby
$ gem build ./yourgem.gemspec # this creates file gooddata-2.0.0.gem
$ rvm use jruby
$ rm Gemfile.lock
$ bundle install
$ gem build ./yourgem.gemspec # creates gooddata-2.0.0-java.gem
I can do the same in the script section in my .travis.yml but it doesn’t work using DPL. I’ve tried the following:
To achieve your goal, define 2 jobs, one with rvm: 2.3 and another with rvm: jruby-* (your choice), and have them each push a gem it builds (remember that the jobs in a build matrix do not have shared storage, so even if you build the gems in previous stages, they will not be available to your deployment stage jobs).
@BanzaiMan, thank you for enabling the debugging feature. I can now confirm that dpl is run under CRuby. The command is rvm $(travis_internal_ruby) do... where travis_internal_ruby is 2.4.1 (CRuby). We can see how the command is composed here. I believe that leaving out the rvm do part would have the desired result. I.e. Ruby gems would be deployed under the platform specified in the rvm section, not only under CRuby.
Do you want to fix this? If you confirm my idea, I will be happy to submit a PR.
This is a tough situation, to be completely upfront about it.
We invoke deployment via rvm $(travis_internal_ruby) … because we know ahead of time this Ruby is capable of invoking dpl and deploying build artifacts. The current ruby set in rvm: key may or may not be. Hence the dilemma.
If you are confident that your Ruby (whatever it is) is capable of executing dpl, you could try redefining the travis_internal_ruby function. Without testing at all, I would first try with:
function travis_internal_ruby() {
echo "$TRAVIS_RUBY_VERSION"
}
Thanks for the explanation @BanzaiMan. I completely understand the difficulties of supporting different rubies. It’s probably not worth it in this case. I’ll try the suggested workaround.