-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci(speech): update quickstart to V2 demonstrating regional endpoints #13760
ci(speech): update quickstart to V2 demonstrating regional endpoints #13760
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #13760 +/- ##
==========================================
+ Coverage 93.23% 93.78% +0.55%
==========================================
Files 2197 2284 +87
Lines 188700 199141 +10441
==========================================
+ Hits 175929 186762 +10833
+ Misses 12771 12379 -392 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 4 files reviewed, 2 unresolved discussions (waiting on @devbww)
google/cloud/speech/quickstart/quickstart.cc
line 37 at r1 (raw file):
Previously, devbww (Bradley White) wrote…
What if
argc
is 0, 1, or 2?
Added additional argc usage condition.
google/cloud/speech/quickstart/quickstart.cc
line 54 at r1 (raw file):
Previously, devbww (Bradley White) wrote…
Factor out the
set_recognizer
.[Then the
MakeSpeechConnection()
can be turned into a conditional expression and become theconnection
initializer.]
Moved set recognizer out of the conditional.
google/cloud/speech/README.md
Outdated
int main(int argc, char* argv[]) try { | ||
auto constexpr kDefaultUri = "gs://cloud-samples-data/speech/hello.wav"; | ||
if (argc > 2) { | ||
std::cerr << "Usage: " << argv[0] << " [gcs-uri]\n" | ||
if (argc < 3 || argc > 4) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: (argc != 3 && argc != 4)
would be the clearer exposition, methinks.
google/cloud/speech/README.md
Outdated
if (location == "global") { | ||
connection = speech::MakeSpeechConnection(); | ||
} else { | ||
connection = speech::MakeSpeechConnection(location); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opt: Perhaps MakeXxxConnection("global")
should mean the same thing as MakeXxxConnection()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 4 files reviewed, 3 unresolved discussions (waiting on @devbww)
google/cloud/speech/README.md
line 39 at r2 (raw file):
Previously, devbww (Bradley White) wrote…
Nit:
(argc != 3 && argc != 4)
would be the clearer exposition, methinks.
Done.
google/cloud/speech/README.md
line 62 at r2 (raw file):
Previously, devbww (Bradley White) wrote…
Opt: Perhaps
MakeXxxConnection("global")
should mean the same thing asMakeXxxConnection()
?
I'd rather have the overload than introduce a sentinel value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 4 files reviewed, 1 unresolved discussion (waiting on @scotthart)
google/cloud/speech/README.md
line 62 at r2 (raw file):
Previously, scotthart (Scott Hart) wrote…
I'd rather have the overload than introduce a sentinel value.
Note that we already have a sentinel of an empty location.
absl::StrCat(location, location.empty() ? "" : "-", |
And we'd still have the overload for the "compat" part.
4e283d8
to
9ac2f7b
Compare
9ac2f7b
to
69410ae
Compare
69410ae
to
f665ff2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 4 files reviewed, 1 unresolved discussion (waiting on @devbww)
google/cloud/speech/README.md
line 62 at r2 (raw file):
Previously, devbww (Bradley White) wrote…
Note that we already have a sentinel of an empty location.
absl::StrCat(location, location.empty() ? "" : "-", And we'd still have the overload for the "compat" part.
Use the non-deprecated MakeConnection function with the existing sentinel value.
# Some tests and quickstarts need to specify a location as "global". | ||
export GOOGLE_CLOUD_CPP_TEST_GLOBAL="global" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can only ever have one value ("global") so I don't think having a variable makes sense. Let's just hardcode "global" in the quickstart runner.
connection = speech::MakeSpeechConnection(location); | ||
auto client = speech::SpeechClient(connection); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think 99% of the quickstarts squash this into one line.
auto client = speech::SpeechClient(speech::MakeSpeechConnection(location));
@@ -26,12 +26,20 @@ if (BUILD_TESTING AND GOOGLE_CLOUD_CPP_ENABLE_CXX_EXCEPTIONS) | |||
target_link_libraries(speech_quickstart PRIVATE google-cloud-cpp::speech) | |||
google_cloud_cpp_add_common_options(speech_quickstart) | |||
add_test( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is cool. good idea to have multiple tests for the quickstart
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 4 files reviewed, 4 unresolved discussions (waiting on @dbolduc and @devbww)
google/cloud/speech/CMakeLists.txt
line 28 at r4 (raw file):
Previously, dbolduc (Darren Bolduc) wrote…
this is cool. good idea to have multiple tests for the quickstart
Done.
google/cloud/speech/quickstart/quickstart.cc
line 55 at r4 (raw file):
Previously, dbolduc (Darren Bolduc) wrote…
I think 99% of the quickstarts squash this into one line.
auto client = speech::SpeechClient(speech::MakeSpeechConnection(location));
Done.
ci/etc/integration-tests-config.sh
line 38 at r4 (raw file):
Previously, dbolduc (Darren Bolduc) wrote…
This can only ever have one value ("global") so I don't think having a variable makes sense. Let's just hardcode "global" in the quickstart runner.
Done.
e50c2b9
to
0dcce9b
Compare
While we need to wait until after the next release to commit these changes, for our own CI purposes, this quickstart shows how to use the API available at HEAD to direct the speech client to use regional endpoints and reocgnizers.
part of the work for #13729
blocked on microsoft/vcpkg#38204
This change is