Skip to content

Commit 2800f5a

Browse files
sofislbcoe
andauthored
build: make ci testing conditional on engines field in package.json, move configs to Node 12 (#1418)
* build: make ci testing conditional on engines field in package.json, move configs to Node 12 Co-authored-by: Benjamin E. Coe <[email protected]>
1 parent 811faf6 commit 2800f5a

File tree

13 files changed

+86
-88
lines changed

13 files changed

+86
-88
lines changed

synthtool/gcp/templates/node_library/.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
node: [10, 12, 14, 16]
12+
node: [{{metadata['engine'] | int}}, {{metadata['engine'] | int+2}}, {{metadata['engine'] | int+4}}]
1313
steps:
1414
- uses: actions/checkout@v3
1515
- uses: actions/setup-node@v3

synthtool/gcp/templates/node_library/.kokoro/common.cfg

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

synthtool/gcp/templates/node_library/.kokoro/continuous/node10/common.cfg

Lines changed: 0 additions & 34 deletions
This file was deleted.

synthtool/gcp/templates/node_library/.kokoro/continuous/node10/docs.cfg

Lines changed: 0 additions & 4 deletions
This file was deleted.

synthtool/gcp/templates/node_library/.kokoro/continuous/node10/test.cfg

Lines changed: 0 additions & 9 deletions
This file was deleted.

synthtool/gcp/templates/node_library/.kokoro/presubmit/node10/common.cfg

Lines changed: 0 additions & 34 deletions
This file was deleted.

synthtool/gcp/templates/node_library/.kokoro/release/docs.cfg

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

synthtool/gcp/templates/node_library/.kokoro/samples-test.sh

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

synthtool/gcp/templates/node_library/.kokoro/system-test.sh

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

synthtool/gcp/templates/node_library/.kokoro/test.sh

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

synthtool/languages/node.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import logging
2525
import shutil
2626

27-
_REQUIRED_FIELDS = ["name", "repository"]
27+
_REQUIRED_FIELDS = ["name", "repository", "engines"]
2828
_TOOLS_DIRECTORY = "/synthtool"
2929

3030

@@ -48,6 +48,7 @@ def read_metadata():
4848
data["repository"] = f'{repo["owner"]}/{repo["name"]}'
4949
data["repository_name"] = repo["name"]
5050
data["lib_install_cmd"] = f'npm install {data["name"]}'
51+
data["engine"] = re.search(r"([0-9][0-9])", data["engines"]["node"]).group()
5152

5253
return data
5354

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"name": "@google-cloud/dlp",
3+
"description": "DLP API client for Node.js",
4+
"version": "3.1.0",
5+
"license": "Apache-2.0",
6+
"author": "Google Inc",
7+
"engines": {
8+
"node": ">=10.0.0"
9+
},
10+
"repository": "googleapis/nodejs-dlp",
11+
"main": "build/src/index.js",
12+
"files": [
13+
"build/protos",
14+
"build/src"
15+
],
16+
"keywords": [
17+
"google apis client",
18+
"google api client",
19+
"google apis",
20+
"google api",
21+
"google",
22+
"google cloud platform",
23+
"google cloud",
24+
"cloud",
25+
"google dlp",
26+
"dlp",
27+
"DLP API"
28+
],
29+
"scripts": {
30+
"test": "c8 mocha build/test",
31+
"samples-test": "cd samples/ && npm link ../ && npm install && npm test && cd ../",
32+
"system-test": "mocha build/system-test",
33+
"docs": "jsdoc -c .jsdoc.js",
34+
"lint": "gts check",
35+
"fix": "gts fix",
36+
"docs-test": "linkinator docs",
37+
"clean": "gts clean",
38+
"compile": "tsc -p . && cp -r protos build/",
39+
"compile-protos": "compileProtos src",
40+
"predocs-test": "npm run docs",
41+
"prepare": "npm run compile-protos && npm run compile",
42+
"prelint": "cd samples; npm link ../; npm install",
43+
"precompile": "gts clean",
44+
"api-extractor": "api-extractor run --local",
45+
"api-documenter": "api-documenter yaml --input-folder=temp"
46+
},
47+
"dependencies": {
48+
"google-gax": "^2.9.2",
49+
"protobufjs": "^6.8.0"
50+
},
51+
"devDependencies": {
52+
"@types/mocha": "^8.0.0",
53+
"@types/node": "^12.0.0",
54+
"@types/sinon": "^9.0.0",
55+
"c8": "^7.0.0",
56+
"gts": "^2.0.0",
57+
"jsdoc": "^3.5.5",
58+
"jsdoc-fresh": "^1.0.1",
59+
"jsdoc-region-tag": "^1.0.2",
60+
"linkinator": "^2.0.0",
61+
"mocha": "^8.0.0",
62+
"null-loader": "^4.0.0",
63+
"pack-n-play": "^1.0.0-2",
64+
"sinon": "^10.0.0",
65+
"ts-loader": "^8.0.0",
66+
"typescript": "^3.8.3",
67+
"webpack": "^5.0.0",
68+
"webpack-cli": "^4.0.0",
69+
"@microsoft/api-documenter": "^7.8.10",
70+
"@microsoft/api-extractor": "^7.8.10"
71+
}
72+
}

tests/test_node.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ def test_quickstart_metadata_with_snippet():
4343
assert "samples/quickstart.js" in sample_names
4444

4545

46+
def test_metadata_engines_field():
47+
with util.chdir(FIXTURES / "node_templates" / "standard"):
48+
metadata = node.template_metadata()
49+
assert "10" in metadata["engine"]
50+
51+
4652
def test_quickstart_metadata_without_snippet():
4753
with util.chdir(FIXTURES / "node_templates" / "no_quickstart_snippet"):
4854
metadata = node.template_metadata()

0 commit comments

Comments
 (0)