Skip to content

Commit

Permalink
add CI workflow and remove hyphen
Browse files Browse the repository at this point in the history
  • Loading branch information
kweinmeister committed Nov 8, 2022
1 parent dcc8b21 commit bd3acfe
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 7 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/mediatranslation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: mediatranslation
on:
push:
branches:
- main
paths:
- 'mediatranslation/**'
pull_request:
paths:
- 'mediatranslation/**'
pull_request_target:
types: [labeled]
schedule:
- cron: '0 0 * * 0'
jobs:
test:
if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }}
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: 'write'
pull-requests: 'write'
id-token: 'write'
steps:
- uses: actions/checkout@v3.1.0
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: 'google-github-actions/auth@v0.8.3'
with:
workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider'
service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com'
create_credentials_file: 'true'
access_token_lifetime: 600s
- uses: actions/setup-node@v3.5.1
with:
node-version: 16
- run: npm install
working-directory: mediatranslation
- run: npm test
working-directory: mediatranslation
env:
MOCHA_REPORTER_SUITENAME: mediatranslation
MOCHA_REPORTER_OUTPUT: mediatranslation_sponge_log.xml
MOCHA_REPORTER: xunit
- if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
await github.rest.issues.removeLabel({
name: 'actions:force-run',
owner: 'GoogleCloudPlatform',
repo: 'nodejs-docs-samples',
issue_number: context.payload.pull_request.number
});
} catch (e) {
if (!e.message.includes('Label does not exist')) {
throw e;
}
}
- if: ${{ github.event_name == 'schedule'}}
run: |
curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L
chmod +x ./flakybot
./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
1 change: 1 addition & 0 deletions .github/workflows/workflows.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"healthcare/dicom",
"healthcare/fhir",
"healthcare/hl7v2",
"mediatranslation",
"monitoring/opencensus",
"monitoring/prometheus",
"datacatalog/cloud-client",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "media-translation-samples",
"name": "mediatranslation-samples",
"private": true,
"license": "Apache-2.0",
"author": "Google LLC",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* @param {string} targetLanguage languate translating to, as BCP-47 code
*/
function main(filename, encoding, sourceLanguage, targetLanguage) {
// [START media_translation_quickstart]
// [START mediatranslation_quickstart]
const fs = require('fs');

// Imports the CLoud Media Translation client library
Expand Down Expand Up @@ -93,7 +93,7 @@ function main(filename, encoding, sourceLanguage, targetLanguage) {
}
});

// [END media_translation_quickstart]
// [END mediatranslation_quickstart]
}
quickstart();
}
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* @param {string} targetLanguage languate translating to, as BCP-47 code
*/
function main(filename, encoding, sourceLanguage, targetLanguage) {
// [START media_translation_translate_from_file]
// [START mediatranslation_translate_from_file]
const fs = require('fs');

// Imports the CLoud Media Translation client library
Expand Down Expand Up @@ -94,7 +94,7 @@ function main(filename, encoding, sourceLanguage, targetLanguage) {
}
});

// [END media_translation_translate_from_file]
// [END mediatranslation_translate_from_file]
}
translate_from_file();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
function main(encoding, sampleRateHertz, sourceLanguage, targetLanguage) {
sampleRateHertz = Number(sampleRateHertz);

// [START media_translation_translate_from_mic]
// [START mediatranslation_translate_from_mic]

// Allow user input from terminal
const readline = require('readline');
Expand Down Expand Up @@ -150,6 +150,6 @@ function main(encoding, sampleRateHertz, sourceLanguage, targetLanguage) {
}

doTranslationLoop();
// [END media_translation_translate_from_mic]
// [END mediatranslation_translate_from_mic]
}
main(...process.argv.slice(2));

0 comments on commit bd3acfe

Please sign in to comment.