Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
22e7e6a
initial commit
jkwlui Feb 19, 2019
860569e
add samples/package.json
jkwlui Mar 4, 2019
25fcbaf
chore: use public protos (#7)
jkwlui Apr 2, 2019
af5219e
chore: release 1.0.0 (#34)
yoshi-automation May 20, 2019
f6221ec
chore: release 1.1.0 (#42)
yoshi-automation Jun 6, 2019
827f81f
chore: release 1.1.1 (#47)
yoshi-automation Jun 14, 2019
f9918b8
chore: release 1.1.2 (#52)
yoshi-automation Jun 26, 2019
1c2a8bf
chore: release 1.1.3 (#60)
yoshi-automation Aug 2, 2019
5478896
chore: release 1.2.0 (#66)
yoshi-automation Sep 16, 2019
35812ed
chore: release 1.3.1 (#81)
release-please[bot] Oct 22, 2019
6458e23
chore: release 1.3.2 (#86)
release-please[bot] Nov 15, 2019
69d2886
docs(samples): add a quickstart (#88)
JustinBeckwith Nov 15, 2019
da7e82b
chore: release 1.3.3 (#90)
release-please[bot] Nov 15, 2019
281e8d8
chore: release 1.3.4 (#94)
release-please[bot] Dec 5, 2019
534e135
docs: update jsdoc license/samples-README (#97)
Dec 23, 2019
fc3be6a
refactor: use explicit mocha imports (#102)
JustinBeckwith Dec 30, 2019
934bf47
chore(deps): update dependency mocha to v7 (#105)
renovate-bot Jan 6, 2020
d16124a
chore: release 1.4.0 (#110)
release-please[bot] Jan 17, 2020
39d29a8
chore: release 1.4.1 (#123)
release-please[bot] Feb 3, 2020
36f96cb
chore: release 1.4.2 (#131)
release-please[bot] Feb 10, 2020
f84831f
chore: release 1.5.0 (#145)
release-please[bot] Mar 2, 2020
f2e362a
chore: release 1.6.0 (#147)
release-please[bot] Mar 11, 2020
5471595
fix: remove unused files from package (#173)
JustinBeckwith Apr 13, 2020
4fbd914
chore: release 2.0.0 (#162)
release-please[bot] Jun 4, 2020
fb491cb
chore(deps): update dependency mocha to v8 (#190)
renovate-bot Jun 11, 2020
ec45d2b
chore: release 2.1.0 (#188)
release-please[bot] Jun 29, 2020
875f3f2
chore: release 2.1.1 (#199)
release-please[bot] Jul 10, 2020
96dc293
chore: release 2.1.2 (#232)
release-please[bot] Dec 2, 2020
33f3dd4
chore: release 2.2.0 (#243)
release-please[bot] Jan 12, 2021
d45435b
chore: release 2.2.1 (#271)
release-please[bot] May 13, 2021
ec62f5b
chore: release 2.2.2 (#280)
release-please[bot] Jun 3, 2021
a0e62ef
chore: release 2.2.3 (#288)
release-please[bot] Jun 25, 2021
e7e14cb
chore: release 2.2.4 (#293)
release-please[bot] Jul 1, 2021
614c14e
chore: release 2.2.5 (#295)
release-please[bot] Jul 12, 2021
b193d5f
chore: release 2.2.6 (#297)
release-please[bot] Jul 21, 2021
be19b3c
fix(build): migrate to using main branch (#304)
sofisl Aug 14, 2021
5eb6d19
chore: release 2.2.7 (#305)
release-please[bot] Aug 17, 2021
9ce741e
chore: release 2.3.0 (#308)
release-please[bot] Aug 23, 2021
5f95b74
build!: update library to use Node 12 (#356)
sofisl May 20, 2022
8c909ec
chore(main): release 3.0.0 (#358)
release-please[bot] Jun 20, 2022
fa6ce36
chore(main): release 3.1.0 (#363)
release-please[bot] Jul 5, 2022
1bb1db5
Merge remote-tracking branch 'migration/main' into nodejs-datalabelin…
ivanmkc Nov 3, 2022
cbdb21f
Merge branch 'main' into nodejs-datalabeling-migration
kweinmeister Nov 8, 2022
4097863
ci: add test workflow
kweinmeister Nov 8, 2022
dd0dba8
ci: checkout before auth
kweinmeister Nov 8, 2022
81bed57
Merge branch 'main' into nodejs-datalabeling-migration
ivanmkc Nov 8, 2022
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/datalabeling.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: datalabeling
on:
push:
branches:
- main
paths:
- "datalabeling/**"
pull_request:
paths:
- "datalabeling/**"
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: datalabeling
- run: npm test
working-directory: datalabeling
env:
MOCHA_REPORTER_SUITENAME: datalabeling
MOCHA_REPORTER_OUTPUT: datalabeling_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 @@ -23,6 +23,7 @@
"composer/functions/composer-storage-trigger",
"containerengine/hello-world",
"datacatalog/cloud-client",
"datalabeling",
"datastore/functions",
"datacatalog/quickstart",
"endpoints/getting-started",
Expand Down
3 changes: 3 additions & 0 deletions datalabeling/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
rules:
no-console: off
52 changes: 52 additions & 0 deletions datalabeling/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[//]: # "This README.md file is auto-generated, all changes to this file will be lost."
[//]: # "To regenerate it, use `python -m synthtool`."
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>

# [Google Cloud Data Labeling: Node.js Samples](https://github.com/googleapis/nodejs-datalabeling)

[![Open in Cloud Shell][shell_img]][shell_link]



## Table of Contents

* [Before you begin](#before-you-begin)
* [Samples](#samples)
* [Get Datasets](#get-datasets)

## Before you begin

Before running the samples, make sure you've followed the steps outlined in
[Using the client library](https://github.com/googleapis/nodejs-datalabeling#using-the-client-library).

`cd samples`

`npm install`

`cd ..`

## Samples



### Get Datasets

Gets all available Datasets.

View the [source code](https://github.com/googleapis/nodejs-datalabeling/blob/main/samples/quickstart.js).

[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-datalabeling&page=editor&open_in_editor=samples/quickstart.js,samples/README.md)

__Usage:__


`node quickstart.js`






[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-datalabeling&page=editor&open_in_editor=samples/README.md
[product-docs]: https://cloud.google.com/data-labeling/docs/
23 changes: 23 additions & 0 deletions datalabeling/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "nodejs-datalabeling-samples",
"private": true,
"license": "Apache-2.0",
"author": "Google LLC",
"engines": {
"node": ">=12.0.0"
},
"files": [
"*.js",
"!test/"
],
"scripts": {
"test": "mocha --timeout 600000"
},
"dependencies": {
"@google-cloud/datalabeling": "^3.1.0"
},
"devDependencies": {
"chai": "^4.2.0",
"mocha": "^8.0.0"
}
}
37 changes: 37 additions & 0 deletions datalabeling/quickstart.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

// sample-metadata:
// title: Get Datasets
// description: Gets all available Datasets.
// usage: node quickstart.js

function main() {
// [START datalabeling_quickstart]
const {DataLabelingServiceClient} = require('@google-cloud/datalabeling');
const client = new DataLabelingServiceClient();

async function quickstart() {
const projectId = await client.getProjectId();
const parent = client.projectPath(projectId);
const [result] = await client.listDatasets({parent});
console.log('Datasets:');
console.log(result);
}
quickstart();
// [END datalabeling_quickstart]
}
main(...process.argv.slice(2));
28 changes: 28 additions & 0 deletions datalabeling/test/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

const {assert} = require('chai');
const {describe, it} = require('mocha');
const {execSync} = require('child_process');

const exec = cmd => execSync(cmd, {encoding: 'utf8'});

describe('quickstart', () => {
it('should run the quickstart', () => {
const stdout = exec('node quickstart.js');
assert.include(stdout, 'Datasets:');
});
});