xref: /aosp_15_r20/external/protobuf/ruby/travis-test.sh (revision 1b3f573f81763fcece89efc2b6a5209149e44ab8)
1#!/usr/bin/env bash
2
3# Exit on any error.
4set -ex
5
6test_version() {
7  version=$1
8
9  RUBY_CONFORMANCE=test_ruby
10
11  if [[ $version == jruby-9* ]] ; then
12    bash --login -c \
13      "rvm install $version && rvm use $version && rvm get head && \
14       which ruby && \
15       git clean -f && \
16       gem install --no-document bundler && bundle && \
17       rake test && \
18       rake gc_test && \
19       cd ../conformance && make test_jruby && \
20       cd ../ruby/compatibility_tests/v3.0.0 && ./test.sh"
21  else
22    bash --login -c \
23      "rvm install $version && rvm use $version && \
24       which ruby && \
25       git clean -f && \
26       gem install --no-document bundler -v 1.17.3 && bundle && \
27       rake test && \
28       rake gc_test && \
29       cd ../conformance && make ${RUBY_CONFORMANCE} && \
30       cd ../ruby/compatibility_tests/v3.0.0 && \
31       cp -R ../../lib lib && ./test.sh"
32  fi
33}
34
35test_version $1
36