Skip to content

Commit

Permalink
try add python build artifact example
Browse files Browse the repository at this point in the history
  • Loading branch information
jtattermusch committed Sep 27, 2023
1 parent befe290 commit 22d057e
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tools/bazelify_tests/test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,16 @@ grpc_build_artifact_task(
docker_image_version = "tools/dockerfile/test/php73_zts_debian11_x64.current_version",
)

# TODO(jtattermusch): add grpc_build_artifact_task targets for python artifacts (but they would require ability to set env)
# Python artifact build tasks

grpc_build_artifact_task(
name = "artifact_python_linux_x64_manylinux2014_cp311",
build_script = "build_artifact_python_linux_x64_cp311.sh",
docker_image_version = "tools/dockerfile/grpc_artifact_python_manylinux2014_x64.current_version",
)

# TODO(jtattermusch): add more grpc_build_artifact_task targets for existing python artifacts from artifact_targets.py

# TODO(jtattermusch): add grpc_build_artifact_task targets for ruby artifacts (which is tricky, since ruby artifact builds do not run under docker since they invoke docker themselves)

test_suite(
Expand All @@ -280,6 +289,7 @@ test_suite(
":artifact_protoc_linux_x64_build_test",
":artifact_protoc_linux_x86_build_test",
":artifact_php_linux_x64_build_test",
":artifact_python_linux_x64_manylinux2014_cp311_build_test",
],
)

Expand Down
31 changes: 31 additions & 0 deletions tools/bazelify_tests/test/build_artifact_python_linux_x64_cp311.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
# Copyright 2023 The gRPC Authors
#
# 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
#
# http://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.

set -ex

# env variable values extracted from PythonArtifact in tools/run_tests/artifacts/artifact_targets.py
# TODO(jtattermusch): find a better way of configuring the python artifact build (the current approach mostly serves as a demonstration)
export PYTHON=/opt/python/cp311-cp311/bin/python
export PIP=/opt/python/cp311-cp311/bin/pip
export GRPC_SKIP_PIP_CYTHON_UPGRADE=TRUE
export GRPC_RUN_AUDITWHEEL_REPAIR=TRUE
export GRPC_BUILD_GRPCIO_TOOLS_DEPENDENTS=TRUE

# set build parallelism to fit the machine configuration of bazelified tests RBE pool.
export GRPC_PYTHON_BUILD_EXT_COMPILER_JOBS=8

mkdir -p artifacts

ARTIFACTS_OUT=artifacts tools/run_tests/artifacts/build_artifact_python.sh

0 comments on commit 22d057e

Please sign in to comment.