浏览代码

Merge pull request #383 from cfallin/ruby-travis

Add Ruby to Travis testing
Chris Fallin 10 年之前
父节点
当前提交
2fe0483848
共有 4 个文件被更改,包括 33 次插入3 次删除
  1. 1 0
      .travis.yml
  2. 9 1
      ruby/pom.xml
  3. 4 2
      ruby/tests/basic.rb
  4. 19 0
      ruby/travis-test.sh

+ 1 - 0
.travis.yml

@@ -14,6 +14,7 @@ script:
   - cd python && python setup.py build && python setup.py test && cd ..
   - export LD_LIBRARY_PATH=../src/.libs
   - cd python && python setup.py build --cpp_implementation && python setup.py test --cpp_implementation && cd ..
+  - cd ruby && sh travis-test.sh && cd ..
   - cd conformance && make test_java && cd ..
   - make distcheck -j2
 notifications:

+ 9 - 1
ruby/pom.xml

@@ -61,6 +61,14 @@
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-compiler-plugin</artifactId>
+              <configuration>
+                <source>1.6</source>
+                <target>1.6</target>
+              </configuration>
+            </plugin>
         </plugins>
     </build>
     <dependencies>
@@ -78,7 +86,7 @@
         <dependency>
             <groupId>com.google.protobuf</groupId>
             <artifactId>protobuf-java</artifactId>
-            <version>3.0.0-alpha-3-pre</version>
+            <version>3.0.0-alpha-2</version>
         </dependency>
     </dependencies>
 </project>

+ 4 - 2
ruby/tests/basic.rb

@@ -1035,7 +1035,8 @@ module BasicTest
     end
 
     def test_json
-      skip("Unimplemented") if RUBY_PLATFORM == "java"
+      # TODO: Fix JSON in JRuby version.
+      return if RUBY_PLATFORM == "java"
       m = TestMessage.new(:optional_int32 => 1234,
                           :optional_int64 => -0x1_0000_0000,
                           :optional_uint32 => 0x8000_0000,
@@ -1066,7 +1067,8 @@ module BasicTest
     end
 
     def test_json_maps
-      skip("Unimplemented") if RUBY_PLATFORM == "java"
+      # TODO: Fix JSON in JRuby version.
+      return if RUBY_PLATFORM == "java"
       m = MapMessage.new(:map_string_int32 => {"a" => 1})
       expected = '{"map_string_int32":{"a":1},"map_string_msg":{}}'
       assert MapMessage.encode_json(m) == expected

+ 19 - 0
ruby/travis-test.sh

@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# Exit on any error.
+set -e
+
+test_version() {
+  version=$1
+  bash --login -c \
+    "rvm install $version && rvm use $version && \
+     which ruby && \
+     gem install bundler && bundle && \
+     rake test"
+}
+
+test_version ruby-1.9
+test_version ruby-2.0
+test_version ruby-2.1
+test_version ruby-2.2
+test_version jruby