Skip to content

Commit 86cfdfe

Browse files
authored
Merge pull request #713 from watson-developer-cloud/semrelease-correct
fix(semrelease): Provide proper git message for semantic release
2 parents ca54907 + d17593d commit 86cfdfe

File tree

4 files changed

+78
-55
lines changed

4 files changed

+78
-55
lines changed

.bumpversion.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[bumpversion]
22
current_version = 4.0.3
33
commit = True
4-
message = [skip ci] Bump version: {current_version} -> {new_version}
54

65
[bumpversion:file:ibm_watson/version.py]
76
search = __version__ = '{current_version}'

.releaserc

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
{
2-
"branch": "master",
3-
"verifyConditions": ["@semantic-release/changelog", "@semantic-release/github"],
42
"debug": true,
5-
"prepare": [
3+
"plugins": [
4+
"@semantic-release/commit-analyzer",
5+
"@semantic-release/release-notes-generator",
66
"@semantic-release/changelog",
7-
"@semantic-release/git",
8-
{
9-
"path": "@semantic-release/exec",
10-
"cmd": "bumpversion --current-version ${lastRelease.version} --new-version ${nextRelease.version} patch"
11-
}
12-
],
13-
"publish": [
14-
{
15-
"path": "@semantic-release/github"
16-
}
7+
[
8+
"@semantic-release/exec",
9+
{
10+
"prepareCmd": "bumpversion --allow-dirty --current-version ${lastRelease.version} --new-version ${nextRelease.version} patch"
11+
}
12+
],
13+
[
14+
"@semantic-release/git",
15+
{
16+
"message": "chore(release): ${nextRelease.version} release notes\n\n${nextRelease.notes}"
17+
}
18+
],
19+
"@semantic-release/github"
1720
]
18-
}
21+
}

.travis.yml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,42 @@
11
language: python
2+
23
matrix:
34
include:
45
- python: 3.5
56
- python: 3.6
67
- python: 3.7
78
- python: 3.8
8-
cache: pip
9+
10+
cache: pip3
11+
912
before_install:
1013
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && openssl aes-256-cbc -K $encrypted_cebf25e6c525_key
1114
-iv $encrypted_cebf25e6c525_iv -in .env.enc -out .env -d || true'
1215
- npm install npm@latest -g
16+
1317
install:
14-
- pip install tox-travis
18+
- pip3 install tox-travis
19+
1520
before_script:
16-
- sudo apt-get update
17-
- pip install pypandoc
18-
- sudo apt-get install pandoc
19-
- pip install -r requirements.txt
20-
- pip install -r requirements-dev.txt
21-
- pip install --editable .
21+
- pip3 install -r requirements.txt
22+
- pip3 install -r requirements-dev.txt
23+
- pip3 install --editable .
24+
2225
script:
23-
- pip install -U python-dotenv
26+
- pip3 install -U python-dotenv
2427
- tox
28+
2529
before_deploy:
26-
- pip install bumpversion
30+
- sudo apt-get update
31+
- pip3 install pypandoc
32+
- sudo apt-get install pandoc
33+
- pip3 install bumpversion
2734
- nvm install 12
2835
- npm install @semantic-release/changelog
2936
- npm install @semantic-release/exec
3037
- npm install @semantic-release/git
3138
- npm install @semantic-release/github
39+
3240
deploy:
3341
- provider: script
3442
script: docs/publish.sh

test/integration/test_speech_to_text_v1.py

Lines changed: 43 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
import pytest
66
import threading
77

8-
@pytest.mark.skipif(
9-
os.getenv('VCAP_SERVICES') is None, reason='requires VCAP_SERVICES')
8+
9+
@pytest.mark.skipif(os.getenv('VCAP_SERVICES') is None,
10+
reason='requires VCAP_SERVICES')
1011
class TestSpeechToTextV1(TestCase):
1112
text_to_speech = None
1213
custom_models = None
@@ -17,12 +18,11 @@ class TestSpeechToTextV1(TestCase):
1718
def setup_class(cls):
1819
cls.speech_to_text = ibm_watson.SpeechToTextV1()
1920
cls.speech_to_text.set_default_headers({
20-
'X-Watson-Learning-Opt-Out':
21-
'1',
22-
'X-Watson-Test':
23-
'1'
21+
'X-Watson-Learning-Opt-Out': '1',
22+
'X-Watson-Test': '1'
2423
})
25-
cls.custom_models = cls.speech_to_text.list_language_models().get_result()
24+
cls.custom_models = cls.speech_to_text.list_language_models(
25+
).get_result()
2626
cls.create_custom_model = cls.speech_to_text.create_language_model(
2727
name="integration_test_model",
2828
base_model_name="en-US_BroadbandModel").get_result()
@@ -36,22 +36,27 @@ def teardown_class(cls):
3636
def test_models(self):
3737
output = self.speech_to_text.list_models().get_result()
3838
assert output is not None
39-
model = self.speech_to_text.get_model('ko-KR_BroadbandModel').get_result()
39+
model = self.speech_to_text.get_model(
40+
'ko-KR_BroadbandModel').get_result()
4041
assert model is not None
4142
try:
4243
self.speech_to_text.get_model('bogus')
4344
except Exception as e:
4445
assert 'X-global-transaction-id:' in str(e)
4546

4647
def test_create_custom_model(self):
47-
current_custom_models = self.speech_to_text.list_language_models().get_result()
48+
current_custom_models = self.speech_to_text.list_language_models(
49+
).get_result()
4850
assert len(current_custom_models['customizations']) - len(
4951
self.custom_models.get('customizations')) >= 1
5052

5153
def test_recognize(self):
52-
with open(os.path.join(os.path.dirname(__file__), '../../resources/speech.wav'), 'rb') as audio_file:
54+
with open(
55+
os.path.join(os.path.dirname(__file__),
56+
'../../resources/speech.wav'), 'rb') as audio_file:
5357
output = self.speech_to_text.recognize(
54-
audio=audio_file, content_type='audio/l16; rate=44100').get_result()
58+
audio=audio_file,
59+
content_type='audio/l16; rate=44100').get_result()
5560
assert output['results'][0]['alternatives'][0][
5661
'transcript'] == 'thunderstorms could produce large hail isolated tornadoes and heavy rain '
5762

@@ -60,7 +65,8 @@ def test_recognitions(self):
6065
assert output is not None
6166

6267
def test_custom_corpora(self):
63-
output = self.speech_to_text.list_corpora(self.customization_id).get_result()
68+
output = self.speech_to_text.list_corpora(
69+
self.customization_id).get_result()
6470
assert not output['corpora']
6571

6672
def test_acoustic_model(self):
@@ -83,7 +89,9 @@ def test_acoustic_model(self):
8389
get_acoustic_model['customization_id']).get_result()
8490

8591
def test_recognize_using_websocket(self):
92+
8693
class MyRecognizeCallback(RecognizeCallback):
94+
8795
def __init__(self):
8896
RecognizeCallback.__init__(self)
8997
self.error = None
@@ -96,14 +104,19 @@ def on_transcription(self, transcript):
96104
self.transcript = transcript
97105

98106
test_callback = MyRecognizeCallback()
99-
with open(os.path.join(os.path.dirname(__file__), '../../resources/speech.wav'), 'rb') as audio_file:
107+
with open(
108+
os.path.join(os.path.dirname(__file__),
109+
'../../resources/speech.wav'), 'rb') as audio_file:
100110
audio_source = AudioSource(audio_file, False)
101-
t = threading.Thread(target=self.speech_to_text.recognize_using_websocket, args=(audio_source, "audio/l16; rate=44100", test_callback))
111+
t = threading.Thread(
112+
target=self.speech_to_text.recognize_using_websocket,
113+
args=(audio_source, "audio/l16; rate=44100", test_callback))
102114
t.start()
103115
t.join()
104116
assert test_callback.error is None
105117
assert test_callback.transcript is not None
106-
assert test_callback.transcript[0]['transcript'] == 'thunderstorms could produce large hail isolated tornadoes and heavy rain '
118+
assert test_callback.transcript[0][
119+
'transcript'] == 'thunderstorms could produce large hail isolated tornadoes and heavy rain '
107120

108121
def test_custom_grammars(self):
109122
customization_id = None
@@ -116,37 +129,37 @@ def test_custom_grammars(self):
116129
print('Creating a new custom model')
117130
create_custom_model_for_grammar = self.speech_to_text.create_language_model(
118131
name="integration_test_model_for_grammar",
119-
base_model_name="en-US_BroadbandModel"
120-
).get_result()
121-
customization_id = create_custom_model_for_grammar['customization_id']
132+
base_model_name="en-US_BroadbandModel").get_result()
133+
customization_id = create_custom_model_for_grammar[
134+
'customization_id']
122135

123136
grammars = self.speech_to_text.list_grammars(
124-
customization_id
125-
).get_result()['grammars']
137+
customization_id).get_result()['grammars']
126138

127139
if not grammars:
128-
with open(os.path.join(os.path.dirname(__file__), '../../resources/confirm-grammar.xml'), 'rb') as grammar_file:
140+
with open(
141+
os.path.join(os.path.dirname(__file__),
142+
'../../resources/confirm-grammar.xml'),
143+
'rb') as grammar_file:
129144
add_grammar_result = self.speech_to_text.add_grammar(
130145
customization_id,
131146
grammar_name='test-add-grammar-python',
132147
grammar_file=grammar_file,
133148
content_type='application/srgs+xml',
134-
allow_overwrite=True
135-
).get_result()
149+
allow_overwrite=True).get_result()
136150
assert add_grammar_result is not None
137151

138152
get_grammar_result = self.speech_to_text.get_grammar(
139153
customization_id,
140-
grammar_name='test-add-grammar-python'
141-
).get_result()
154+
grammar_name='test-add-grammar-python').get_result()
142155
assert get_grammar_result is not None
143156
else:
144157
print('Deleting grammar')
145-
delete_grammar_result = self.speech_to_text.delete_grammar(
146-
customization_id,
147-
'test-add-grammar-python'
148-
).get_result()
149-
assert delete_grammar_result is not None
158+
try:
159+
self.speech_to_text.delete_grammar(
160+
customization_id, 'test-add-grammar-python').get_result()
161+
except ibm_watson.ApiException as ex:
162+
print('Could not delete grammar: {0}'.format(ex.message))
150163

151164
try:
152165
self.speech_to_text.delete_language_model(customization_id)

0 commit comments

Comments
 (0)