Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/pip/synthtool/gcp/templates/pyt…
Browse files Browse the repository at this point in the history
…hon_library/dot-kokoro/cryptography-41.0.4
  • Loading branch information
parthea authored Oct 2, 2023
2 parents 3c2b4c0 + 4c4063f commit 0944b41
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 34 deletions.
7 changes: 1 addition & 6 deletions docker/owlbot/nodejs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# build from the root of this repo:
# docker build -t gcr.io/repo-automation-bots/owlbot-nodejs -f docker/owlbot/nodejs/Dockerfile .
FROM python:3.10.12-bookworm

WORKDIR /

###################### Install nodejs.
Expand Down Expand Up @@ -46,11 +45,7 @@ COPY post-processor-changes.txt /post-processor-changes.txt
RUN find /synthtool -exec chmod a+r {} \;
RUN find /synthtool -type d -exec chmod a+x {} \;

# Install dependencies used for post processing:
# * gts/typescript are used for linting.
# * google-gax and gapic-tools are used for compiling protos.
RUN cd /synthtool && mkdir node_modules && npm i [email protected] [email protected] \
[email protected] @google-cloud/[email protected] [email protected]
RUN cd /synthtool && mkdir node_modules && npm install @google-cloud/[email protected]

ENTRYPOINT [ "/bin/bash" ]
CMD [ "/synthtool/docker/owlbot/nodejs/entrypoint.sh" ]
2 changes: 2 additions & 0 deletions docker/owlbot/nodejs/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

set -ex

npm i --only=dev --ignore-scripts

if [ -f owlbot.py ]; then
python owlbot.py
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ branchProtectionRules:
requiredStatusCheckContexts:
- "ci/kokoro: Samples test"
- "ci/kokoro: System test"
- docs
- lint
- test ({{metadata['engine'] | int}})
- test ({{metadata['engine'] | int+2}})
Expand Down
21 changes: 0 additions & 21 deletions synthtool/gcp/templates/python_mono_repo_library/noxfile.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -472,24 +472,3 @@ def prerelease_deps(session):
session.run("python", "-c", "import google.auth; print(google.auth.__version__)")

session.run("py.test", "tests/unit")

system_test_path = os.path.join("tests", "system.py")
system_test_folder_path = os.path.join("tests", "system")

# Only run system tests if found.
if os.path.exists(system_test_path):
session.run(
"py.test",
"--verbose",
f"--junitxml=system_{session.python}_sponge_log.xml",
system_test_path,
*session.posargs,
)
if os.path.exists(system_test_folder_path):
session.run(
"py.test",
"--verbose",
f"--junitxml=system_{session.python}_sponge_log.xml",
system_test_folder_path,
*session.posargs,
)
14 changes: 9 additions & 5 deletions synthtool/languages/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,20 +213,22 @@ def fix(hide_output=False):
shell.run(["npm", "run", "fix"], hide_output=hide_output)


# TODO: delete these functions if it turns out we no longer
# need them to be hermetic.
def fix_hermetic(hide_output=False):
"""
Fixes the formatting in the current Node.js library. It assumes that gts
is already installed in a well known location on disk (node_modules/.bin).
"""
logger.debug("Copy eslint config")
shell.run(
["cp", "-r", f"{_TOOLS_DIRECTORY}/node_modules", "."],
["cp", "-r", "node_modules", "."],
check=True,
hide_output=hide_output,
)
logger.debug("Running fix...")
shell.run(
[f"{_TOOLS_DIRECTORY}/node_modules/.bin/gts", "fix"],
["node_modules/.bin/gts", "fix"],
check=False,
hide_output=hide_output,
)
Expand All @@ -241,6 +243,8 @@ def compile_protos(hide_output=False):
shell.run(["npx", "compileProtos", "src"], hide_output=hide_output)


# TODO: delete these functions if it turns out we no longer
# need them to be hermetic.
def compile_protos_hermetic(hide_output=False):
"""
Compiles protos into .json, .js, and .d.ts files using
Expand All @@ -249,7 +253,7 @@ def compile_protos_hermetic(hide_output=False):
"""
logger.debug("Compiling protos...")
shell.run(
[f"{_TOOLS_DIRECTORY}/node_modules/.bin/compileProtos", "src"],
["node_modules/.bin/compileProtos", "src"],
check=True,
hide_output=hide_output,
)
Expand All @@ -265,8 +269,8 @@ def postprocess_gapic_library(hide_output=False):

def postprocess_gapic_library_hermetic(hide_output=False):
logger.debug("Post-processing GAPIC library...")
fix_hermetic(hide_output=hide_output)
compile_protos_hermetic(hide_output=hide_output)
fix(hide_output=hide_output)
compile_protos(hide_output=hide_output)
logger.debug("Post-processing completed")


Expand Down
5 changes: 4 additions & 1 deletion synthtool/languages/python_mono_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,12 @@ def owlbot_main(package_dir: str) -> None:
microgenerator=True,
default_python_version="3.9",
unit_test_python_versions=["3.7", "3.8", "3.9", "3.10", "3.11"],
system_test_python_versions=["3.8", "3.9", "3.10", "3.11"],
cov_level=100,
versions=gcp.common.detect_versions(
path=f"{package_dir}/google", default_first=True
path=f"{package_dir}/google",
default_version=default_version,
default_first=True,
),
)
s.move([templated_files], package_dir)
Expand Down

0 comments on commit 0944b41

Please sign in to comment.