Skip to content

Commit df8f1a1

Browse files
committed
Merge branch 'master' of https://github.com/watson-developer-cloud/ruby-sdk into regenerate_speech_to_text_add_word
2 parents a3b42fb + f2183ce commit df8f1a1

File tree

10 files changed

+105
-6
lines changed

10 files changed

+105
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
.DS_Store
1313
lib/ibm_watson/.swagger-codegen-ignore
1414
lib/ibm_watson/.swagger-codegen
15+
test/html_reports/
1516

1617
# Used by dotenv library to load environment variables.
1718
.env

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ Layout/EndOfLine:
295295
# The `native` style means that CR+LF (Carriage Return + Line Feed) is
296296
# enforced on Windows, and LF is enforced on other platforms. The other styles
297297
# mean LF and CR+LF, respectively.
298-
EnforcedStyle: native
298+
EnforcedStyle: lf
299299
SupportedStyles:
300300
- native
301301
- lf

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ install:
2222
script:
2323
- bundle exec rake
2424

25+
before_deploy:
26+
- bundle exec rake test:appveyor_status
27+
2528
deploy:
2629
- provider: script
2730
script: npx travis-deploy-once "npx semantic-release"

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ If you want to contribute to the repository, follow these steps:
2222

2323
1. Fork the repo.
2424
2. Test your code changes: `rake` or `rake test`.
25-
3. Travis-CI will run the tests for all services once your changes are merged.
25+
3. Travis-CI and AppVeyor will run the tests for all services once your changes are merged.
2626
4. Add a test for your changes. Only refactoring and documentation changes require no new tests.
2727
5. Make the test pass.
2828
6. Commit your changes.
@@ -36,4 +36,4 @@ Ideally, we'd like to see both unit and integration tests on each method.
3636
Out of the box, `rake` runs integration and unit tests. Put the corresponding credentials in a `.env` file in the root directory for the integration tests to work as intended.
3737
To just run unit or integration tests, run `rake test:unit` or `rake test:integration`
3838

39-
Currently this enables integration tests for all services so, unless all credentials are supplied, some tests will fail.
39+
For the integration tests, tests will only be run for services that have credentials defined in a `.env` file.

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# IBM Watson Ruby SDK
22

33
[![Build Status](https://travis-ci.org/watson-developer-cloud/ruby-sdk.svg)](https://travis-ci.org/watson-developer-cloud/ruby-sdk)
4+
[![Build status](https://ci.appveyor.com/api/projects/status/ir3k0ue138o4u67e?svg=true)](https://ci.appveyor.com/project/maxnussbaum/ruby-sdk)
45
[![Slack](https://wdc-slack-inviter.mybluemix.net/badge.svg)](https://wdc-slack-inviter.mybluemix.net)
56
[![codecov.io](https://codecov.io/github/watson-developer-cloud/ruby-sdk/coverage.svg)](https://codecov.io/github/watson-developer-cloud/ruby-sdk)
67
[![Gem Version](https://badge.fury.io/rb/ibm_watson.svg)](https://badge.fury.io/rb/ibm_watson)
@@ -275,7 +276,9 @@ Note: `recognize_with_websocket` has been **deprecated** in favor of **`recogniz
275276

276277
## Ruby version
277278

278-
Tested on Ruby 2.3, 2.4, 2.5
279+
Tested on:
280+
* MRI Ruby (RVM): 2.3.7, 2.4.4, 2.5.1
281+
* RubyInstaller (Windows x64): 2.3.3, 2.4.4, 2.5.1
279282

280283
## Contributing
281284

appveyor.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
version: 1.0.{build}-{branch}
2+
skip_tags: true
3+
4+
cache:
5+
- vendor/bundle
6+
7+
environment:
8+
matrix:
9+
- RUBY_VERSION: 23-x64
10+
- RUBY_VERSION: 24-x64
11+
- RUBY_VERSION: 25-x64
12+
13+
init:
14+
- set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
15+
16+
install:
17+
- ps: |
18+
if ($Env:RUBY_VERSION -match "^23" ) {
19+
# RubyInstaller; download OpenSSL headers from OpenKnapsack Project
20+
$Env:openssl_dir = "C:\Ruby${Env:RUBY_VERSION}"
21+
appveyor DownloadFile http://dl.bintray.com/oneclick/OpenKnapsack/x64/openssl-1.0.2j-x64-windows.tar.lzma
22+
7z e openssl-1.0.2j-x64-windows.tar.lzma
23+
7z x -y -oC:\Ruby${Env:RUBY_VERSION} openssl-1.0.2j-x64-windows.tar
24+
} else {
25+
# RubyInstaller2; openssl package seems to be installed already
26+
$Env:openssl_dir = "C:\msys64\mingw64"
27+
}
28+
- set SSL_CERT_FILE=C:/ruby24-x64/ssl/cert.pem
29+
- bundle install
30+
- gem uninstall -a -x --force eventmachine
31+
- gem install eventmachine --platform ruby --no-rdoc --no-ri -- --with-ssl-dir=%openssl_dir%
32+
33+
build: off
34+
35+
before_test:
36+
- ruby -v
37+
- gem -v
38+
- bundle -v
39+
40+
test_script:
41+
- bundle exec rake
42+
43+
deploy: off
44+
matrix:
45+
fast_finish: true

ibm_watson.gemspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ Gem::Specification.new do |spec|
4343
spec.add_development_dependency "httplog", "~> 1.0"
4444
spec.add_development_dependency "minitest", "~> 5.11"
4545
spec.add_development_dependency "minitest-hooks", "~> 1.5"
46+
spec.add_development_dependency "minitest-reporters", "~> 1.3"
47+
spec.add_development_dependency "minitest-retry", "~> 0.1"
4648
spec.add_development_dependency "rake", "~> 12.3"
4749
spec.add_development_dependency "rubocop", "~> 0.57"
4850
spec.add_development_dependency "simplecov", "~> 0.16"

rakefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace :test do
1616
t.test_files = FileList["test/unit/*.rb"]
1717
t.verbose = true
1818
t.warning = true
19+
t.deps = [:rubocop]
1920
end
2021

2122
Rake::TestTask.new do |t|
@@ -25,7 +26,16 @@ namespace :test do
2526
t.test_files = FileList["test/integration/*.rb"]
2627
t.verbose = true
2728
t.warning = true
28-
t.deps = [:dotenv]
29+
t.deps = %i[dotenv rubocop]
30+
end
31+
32+
Rake::TestTask.new do |t|
33+
t.name = "appveyor_status"
34+
t.description = "Checks to ensure that AppVeyor tests pass before deploying from Travis"
35+
t.libs << "test"
36+
t.test_files = FileList["test/appveyor_status.rb"]
37+
t.verbose = false
38+
t.warning = false
2939
end
3040
end
3141

@@ -41,5 +51,5 @@ task :coverage do
4151
Rake::Task["test"].execute
4252
end
4353

44-
task def: %i[rubocop coverage] do
54+
task def: %i[coverage] do
4555
end

test/appveyor_status.rb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# frozen_string_literal: true
2+
3+
require("minitest/reporters")
4+
require("minitest/autorun")
5+
require("minitest/retry")
6+
require("http")
7+
require("json")
8+
9+
Minitest::Retry.use!
10+
Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(color: true), Minitest::Reporters::SpecReporter.new]
11+
12+
# Test to run from Travis to ensure that AppVeyor tests pass before attempting to deploy to RubyGems
13+
class AppVeyorStatusTest < Minitest::Test
14+
def test_appveyor_status
15+
skip "Branch is NOT master and/or Ruby != 2.5.1, so AppVeyor check before deployment will not be run." if ENV["TRAVIS_BRANCH"] != "master" || ENV["TRAVIS_RUBY_VERSION"] != "2.5.1"
16+
client = HTTP::Client.new
17+
status = JSON.parse(client.get("https://ci.appveyor.com/api/projects/maxnussbaum/ruby-sdk").body.to_s)["build"]["status"]
18+
while status != "success" && status != "failed" && status != "cancelled"
19+
sleep(3)
20+
status = JSON.parse(client.get("https://ci.appveyor.com/api/projects/maxnussbaum/ruby-sdk").body.to_s)["build"]["status"]
21+
end
22+
if status == "success"
23+
assert(true)
24+
else
25+
assert(false, "AppVeyor tests have NOT passed! Please ensure that AppVeyor passes before deploying")
26+
end
27+
end
28+
end

test/test_helper.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
require("simplecov")
44
require("codecov")
5+
require("minitest/reporters")
56

67
if ENV["COVERAGE"]
78
SimpleCov.formatter = SimpleCov::Formatter::Codecov if ENV["CI"]
@@ -19,3 +20,9 @@
1920

2021
require("minitest/autorun")
2122
require_relative("./../lib/ibm_watson.rb")
23+
require("minitest/retry")
24+
25+
Minitest::Retry.use!
26+
27+
Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(color: true, slow_count: 10), Minitest::Reporters::SpecReporter.new, Minitest::Reporters::HtmlReporter.new] if ENV["CI"].nil?
28+
Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(color: true, slow_count: 10), Minitest::Reporters::SpecReporter.new] if ENV["CI"]

0 commit comments

Comments
 (0)