Skip to content
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

Add Speech generated samples #8210

Closed
wants to merge 7 commits into from
Closed

Add Speech generated samples #8210

wants to merge 7 commits into from

Conversation

beccasaurus
Copy link
Contributor

@beccasaurus beccasaurus commented Jun 4, 2019

Please add labels:

  • do not merge
  • api: speech

This PR is a companion to a similar PR sent for PHP: googleapis/google-cloud-php#1991

I send this Python PR to show differences between the generated PHP + Python sample artifacts.

I also sent a similar PR to Ruby: googleapis/google-cloud-ruby#3431

=> @dwsupplee
/cc @busunkim96
/fyi @TheRoyalTnetennba @dazuma @googleapis/samplegen


The following is the body of the PHP Pull Request (for context)

Hello there, dear PHP friends! 🐘

We'd like to incorporate the samples which GAPIC generator now supports into google-cloud-php.

tl;dr

These things are required to "Make it go"

  • PHP samples generated should be copied into samples/ directory by synth.py (gapic-generator)
  • Tests for code samples should be copied into samples/... directory from googleapis (synthtool)
  • Code samples resources should be copied into samples/... directory from googleapis (synthtool)
  • PHP library CI should be setup to run code sample tests (google-cloud-php)
    ^ I need y'all's help with this last one!

More info: go/library-samples (internal)

End Goal

🤖 Autosynth sends PRs for new / modified code samples and tests

Should work once google-cloud-php is configured to run system tests for generated samples in CI

This PR

This PR serves the purpose of being an example Pull Request with generated samples to use for CI setup.

I've communicated with some of y'all who are expecting this PR for discussion and configuring CI

The actual diff of this PR is a result of doing the following:

  1. Update synth.py to generate samples (currently opt-in feature behind a --dev_samples flag)
  2. Run script with functionality I plan to get into SynthTool as include_samples=True (will send PR)
  3. Run synth.py to generate the samples (and supplemental script to add tests + resources for samples)

Companion PRs

To help with discussion / see differences between a couple languages, I send PRs to Python and Ruby:

DIY

If you want to reproduce this diff:

  1. Clone google-cloud-php and checkout fresh master and cd Speech/
  2. Edit synth.py to add samples s.copy(library / 'samples/')
    and enable sample generation --dev_samples
  3. Run synth python3 -m synthtool
  4. (Run polyfill script for missing functionality)
    curl -LO https://gist.github.com/beccasaurus/8ac942988a8f6021a6bf938eb0b6858b/raw/include_samples.sh
    chmod +x include_samples.sh
    ./include_samples.sh speech "v1 v1p1beta1" php
    
  5. Look at the resulting samples/ directory

If you want to run the tests:

  1. Install the googleapis code sample test runner:
    python3 -m pip install sample-tester
    
  2. Run the tests
    sample-tester samples/*/test/*
    
    # just v1p1beta1 tests
    sample-tester samples/v1p1beta1/test/*
    
    # just a certain test
    sample-tester --cases "My test name" samples/v1/test/*
    
    # show the commands which invoke each sample with the resulting STDOUT
    sample-tester -v detailed samples/*/test/*
    
    https://sample-tester.readthedocs.io/
    

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 4, 2019
@busunkim96 busunkim96 added api: speech Issues related to the Speech-to-Text API. do not merge Indicates a pull request not ready for merge, due to either quality or timing. labels Jun 4, 2019
@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Jun 11, 2019
Rebecca Taylor added 3 commits June 13, 2019 14:03
Result of re-running synthtool

In addition to ./include_samples.sh used to setup the samples/tests
If you delete samples/ and re-run with include_samples=True
the exact samples/ structure will be regenerated (no git diff)
@busunkim96
Copy link
Contributor

@beccasaurus Do you need anything from me, or is this mostly here for demonstration purposes? 😄

@yoshi-automation yoshi-automation removed the 🚨 This issue needs some love. label Jul 3, 2019
@tseaver tseaver added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 30, 2019
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 30, 2019
@beccasaurus
Copy link
Contributor Author

🧹 Out-of-date / Deprecated

301 Redirect => #9153

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: speech Issues related to the Speech-to-Text API. cla: yes This human has signed the Contributor License Agreement. do not merge Indicates a pull request not ready for merge, due to either quality or timing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants