Skip to content

Commit d19c368

Browse files
authored
feat: add integration test for build (googleapis#14319)
1 parent 34a7916 commit d19c368

3 files changed

Lines changed: 59 additions & 1 deletion

File tree

.generator/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ def handle_build(librarian: str = LIBRARIAN_DIR, repo: str = REPO_DIR):
481481
"--repo",
482482
type=str,
483483
help="Path to the directory in the container which contains google-cloud-python repository",
484-
default=SOURCE_DIR,
484+
default=REPO_DIR,
485485
)
486486
if len(sys.argv) == 1:
487487
parser.print_help(sys.stderr)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"id": "google-cloud-language",
3+
"version": "2.17.2",
4+
"last_generated_commit": "97a83d76a09a7f6dcab43675c87bdfeb5bcf1cb5",
5+
"apis": [
6+
{
7+
"path": "google/cloud/language/v1beta2",
8+
"service_config": "language_v1beta2.yaml",
9+
"status": ""
10+
},
11+
{
12+
"path": "google/cloud/language/v2",
13+
"service_config": "language_v2.yaml",
14+
"status": ""
15+
},
16+
{
17+
"path": "google/cloud/language/v1",
18+
"service_config": "language_v1.yaml",
19+
"status": ""
20+
}
21+
],
22+
"source_roots": [
23+
"packages/google-cloud-language"
24+
],
25+
"preserve_regex": [
26+
".OwlBot.yaml",
27+
"packages/google-cloud-language/CHANGELOG.md",
28+
"docs/CHANGELOG.md",
29+
"docs/README.rst",
30+
"samples/README.txt",
31+
"tar.gz",
32+
"gapic_version.py",
33+
"samples/generated_samples/snippet_metadata_",
34+
"scripts/client-post-processing"
35+
],
36+
"remove_regex": [
37+
"packages/google-cloud-language"
38+
],
39+
"tag_format": "{id}-v{version}"
40+
}

cloudbuild-test.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,24 @@ steps:
5959
- 'generate'
6060
waitFor: ['build-generator', 'clone-googleapis']
6161

62+
# Step 4: Run the generator to test the library code.
63+
- name: 'gcr.io/cloud-builders/docker'
64+
id: 'build-library'
65+
waitFor: ['generate-library']
66+
args:
67+
- 'run'
68+
- '--rm'
69+
# Mount the test-resources/librarian from this repo's workspace as the librarian dir.
70+
- '-v'
71+
- '/workspace/.generator/test-resources/librarian:/app/librarian'
72+
# We run the `build` command against the checked in google-cloud-language package.
73+
- '-v'
74+
- '/workspace:/app/repo'
75+
# The image that was built in the first step.
76+
- 'gcr.io/$PROJECT_ID/python-librarian-generator:latest'
77+
# The command to execute inside the container.
78+
- 'build'
79+
6280
options:
6381
default_logs_bucket_behavior: REGIONAL_USER_OWNED_BUCKET
6482
machineType: E2_HIGHCPU_32

0 commit comments

Comments
 (0)