Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ Podfile.lock
bazel-*
bazel_format_virtual_environment/
tools/bazel-*
.bazel_rbe

# Bazel wrapper
bazel_wrapper
Expand Down
2 changes: 1 addition & 1 deletion src/core/lib/address_utils/sockaddr_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ int grpc_sockaddr_is_v4mapped(const grpc_resolved_address* resolved_addr,
if (resolved_addr4_out != nullptr) {
// Normalize ::ffff:0.0.0.0/96 to IPv4.
memset(resolved_addr4_out, 0, sizeof(*resolved_addr4_out));
addr4_out->sin_family = GRPC_AF_INET;
// s6_addr32 would be nice, but it's non-standard.
memcpy(&addr4_out->sin_addr, &addr6->sin6_addr.s6_addr[12], 4);
addr4_out->sin_family = GRPC_AF_INET;
addr4_out->sin_port = addr6->sin6_port;
resolved_addr4_out->len =
static_cast<socklen_t>(sizeof(grpc_sockaddr_in));
Expand Down
1 change: 1 addition & 0 deletions test/distrib/cpp/run_distrib_test_cmake_pkgconfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ cmake \
-DgRPC_SSL_PROVIDER=package \
-DgRPC_ZLIB_PROVIDER=package \
-DgRPC_BUILD_GRPCPP_OTEL_PLUGIN=ON \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
../..
make "-j${GRPC_CPP_DISTRIBTEST_BUILD_COMPILER_JOBS}" install
popd
Expand Down
61 changes: 48 additions & 13 deletions tools/internal_ci/helper_scripts/prepare_build_macos_rc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ df -h /tmpfs /
launchctl limit maxfiles
ulimit -a

# Use temp variable to detect version
# will be cleaned up after migration is complete
os_version=$(sw_vers -productVersion)
is_sonoma=false
if [[ "$os_version" == "14."* ]]; then
is_sonoma=true
fi

# WARNING: TRY TO KEEP THIS FILE AS LEAN AS POSSIBLE
# The rules:
# - think twice before adding installer that takes long time (builds are already slow)
Expand All @@ -47,17 +55,28 @@ export HOMEBREW_NO_AUTO_UPDATE=1
# - Kokoro MacOS Mojave: 27fa87c94a6cf7be40fc8f8fc96bc7c387b7781e
brew config

if $is_sonoma; then
brew install cmake
brew install gnupg
export PATH="/opt/homebrew/bin::${PATH}"
cmake --version
fi

# Add GCP credentials for BQ access
pip install --user google-api-python-client oauth2client six==1.16.0
export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/GrpcTesting-d0eeee2db331.json
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
echo $DIR
pwd

# If this is a PR using RUN_TESTS_FLAGS var, then add flags to filter tests
if [ -n "$KOKORO_GITHUB_PULL_REQUEST_NUMBER" ]; then
export RUN_TESTS_FLAGS="--filter_pr_tests --base_branch origin/$KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH $RUN_TESTS_FLAGS"
fi

if [ "${PREPARE_BUILD_INSTALL_DEPS_RUBY}" == "true" ]
# Changes not needed for sonoma(Already have version available)
# cleanup this once migration complete
if [ "${PREPARE_BUILD_INSTALL_DEPS_RUBY}" == "true" ] && ! $is_sonoma;
then
# Workaround for https://github.com/rvm/rvm/issues/5133
export CURL_CA_BUNDLE=$(pwd)/etc/roots.pem
Expand Down Expand Up @@ -185,21 +204,37 @@ fi
if [ "${PREPARE_BUILD_INSTALL_DEPS_PHP}" == "true" ]
then
time brew install php@8.1 || true
export LDFLAGS="-L/usr/local/opt/php@8.1/lib ${LDFLAGS}"
export CPPFLAGS="-I/usr/local/opt/php@8.1/include ${CPPFLAGS}"
export PATH="/usr/local/opt/php@8.1/bin:/usr/local/opt/php@8.1/sbin:${PATH}"
if [ -e "/usr/local/opt/php@8.1/" ]; then
PHP_PATH="/usr/local/opt/php@8.1/"
elif [ -e "/opt/homebrew/opt/php@8.1" ]; then
PHP_PATH="/opt/homebrew/opt/php@8.1"
else
echo "Error: Unable to check php install path" >&2
exit 1
fi

export LDFLAGS="-L${PHP_PATH}/lib ${LDFLAGS}"
export CPPFLAGS="-I${PHP_PATH}include ${CPPFLAGS}"
export PATH="${PHP_PATH}/bin:${PHP_PATH}/sbin:${PATH}"

# the exit code from "brew install php@8.1" is useless
# so instead we check if PHP was indeed installed successfully.
# Failing early is better than cryptic errors later in the build process.
/usr/local/opt/php@8.1/bin/php --version

# Workaround for https://github.com/Homebrew/homebrew-core/issues/41081
mkdir -p /usr/local/lib/php/pecl

# Download the right version of phpunit to match PHP version
sudo curl -sSL https://phar.phpunit.de/phpunit-9.5.9.phar -o /usr/local/bin/phpunit
sudo chmod +x /usr/local/bin/phpunit
php --version

if $is_sonoma; then
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e5503cda447da73c7e5b6') { echo 'Installer verified'.PHP_EOL; } else { echo 'Installer corrupt'.PHP_EOL; unlink('composer-setup.php'); exit(1); }"
php composer-setup.php --install-dir /tmp
php -r "unlink('composer-setup.php');"
php /tmp/composer.phar global require phpunit/phpunit:9.5.9
else
# Workaround for https://github.com/Homebrew/homebrew-core/issues/41081
mkdir -p /usr/local/lib/php/pecl
# Download the right version of phpunit to match PHP version
sudo curl -sSL https://phar.phpunit.de/phpunit-9.5.9.phar -o /usr/local/bin/phpunit
sudo chmod +x /usr/local/bin/phpunit
fi
fi

# TODO(jtattermusch): better debugging of clock skew, remove once not needed
Expand Down
2 changes: 1 addition & 1 deletion tools/internal_ci/helper_scripts/requirements.macos.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ cython<4.0.0rc1
cryptography==3.4.6
PyJWT==2.0.1
pyOpenSSL==20.0.1
PyYAML==6.0
PyYAML==6.0.2
requests==2.32.2
4 changes: 2 additions & 2 deletions tools/internal_ci/macos/grpc_distribtests_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ source tools/internal_ci/helper_scripts/prepare_build_macos_rc
python3.9 -m pip install -U 'cython<4.0.0rc1' setuptools==65.4.1 wheel --user
python3.10 -m pip install -U 'cython<4.0.0rc1' setuptools==65.4.1 wheel --user
python3.11 -m pip install -U 'cython<4.0.0rc1' setuptools==65.4.1 wheel --user
python3.12 -m pip install -U 'cython<4.0.0rc1' setuptools==65.4.1 wheel --user
python3.13 -m pip install -U 'cython<4.0.0rc1' setuptools==65.4.1 wheel --user
python3.12 -m pip install -U 'cython<4.0.0rc1' setuptools==65.4.1 wheel --user --break-system-packages
python3.13 -m pip install -U 'cython<4.0.0rc1' setuptools==65.4.1 wheel --user --break-system-packages

# Build all python macos artifacts (this step actually builds all the binary wheels and source archives)
tools/run_tests/task_runner.py -f artifact macos python ${TASK_RUNNER_EXTRA_FILTERS} -j 2 -x build_artifacts/sponge_log.xml || FAILED="true"
Expand Down
2 changes: 1 addition & 1 deletion tools/internal_ci/macos/grpc_interop_toprod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ source tools/internal_ci/helper_scripts/prepare_build_macos_interop_rc
# build C++ interop client and server
mkdir -p cmake/build
pushd cmake/build
cmake -DgRPC_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 ../..
cmake -DgRPC_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ../..
make interop_client interop_server -j4
popd

Expand Down
1 change: 1 addition & 0 deletions tools/internal_ci/macos/grpc_objc_bazel_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ TEST_TARGETS=(
# TODO(jtattermusch): can we make ObjC test not depend on running a local interop_server?
python3 tools/run_tests/python_utils/bazel_report_helper.py --report_path build_interop_server
build_interop_server/bazel_wrapper \
--output_base=.bazel_rbe \
--bazelrc=tools/remote_build/mac.bazelrc \
build \
--google_credentials="${KOKORO_GFILE_DIR}/GrpcTesting-d0eeee2db331.json" \
Expand Down
1 change: 1 addition & 0 deletions tools/internal_ci/macos/grpc_run_bazel_c_cpp_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ python3 tools/run_tests/python_utils/bazel_report_helper.py --report_path bazel_

# run all C/C++ tests
bazel_c_cpp_tests/bazel_wrapper \
--output_base=.bazel_rbe \
--bazelrc=tools/remote_build/mac.bazelrc \
test \
--google_credentials="${KOKORO_GFILE_DIR}/GrpcTesting-d0eeee2db331.json" \
Expand Down
2 changes: 2 additions & 0 deletions tools/internal_ci/macos/grpc_run_bazel_isolated_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ source $(dirname $0)/../../../tools/internal_ci/helper_scripts/move_src_tree_and
# change to grpc repo root
cd $(dirname $0)/../../..

source tools/internal_ci/helper_scripts/prepare_build_macos_rc

./tools/run_tests/start_port_server.py

# BUILD ONLY TEST!
Expand Down
3 changes: 1 addition & 2 deletions tools/run_tests/artifacts/artifact_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ def build_jobspec(self, inner_jobs=None):
environ["PIP"] = "/opt/python/{}/bin/pip".format(self.py_version)
environ["GRPC_SKIP_PIP_CYTHON_UPGRADE"] = "TRUE"
if self.arch == "aarch64":
environ["GRPC_SKIP_TWINE_CHECK"] = "TRUE"
# As we won't strip the binary with auditwheel (see below), strip
# it at link time.
environ["LDFLAGS"] = "-s"
Expand Down Expand Up @@ -202,7 +201,7 @@ def build_jobspec(self, inner_jobs=None):
environ["GRPC_SKIP_PIP_CYTHON_UPGRADE"] = "TRUE"
environ["GRPC_PYTHON_BUILD_WITH_STATIC_LIBSTDCXX"] = "TRUE"

if self.arch in ("x86", "aarch64"):
if self.arch in ("x86"):
environ["GRPC_SKIP_TWINE_CHECK"] = "TRUE"

if self.arch == "aarch64":
Expand Down
3 changes: 1 addition & 2 deletions tools/run_tests/artifacts/build_artifact_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,7 @@ then
"${PYTHON}" -m pip install virtualenv
"${PYTHON}" -m virtualenv venv || { "${PYTHON}" -m pip install virtualenv==20.0.23 && "${PYTHON}" -m virtualenv venv; }
# Ensure the generated artifacts are valid using "twine check"
# pinning twine's dependency package `cryptography` version to 3.3.2 (last version without Rust dependency)
venv/bin/python -m pip install "cryptography==3.3.2" "twine==5.0.0" "readme_renderer<40.0"
venv/bin/python -m pip install "cryptography==40.0.0" "twine==5.0.0" "readme_renderer<40.0"
venv/bin/python -m twine check dist/* tools/distrib/python/grpcio_tools/dist/*
if [ "$GRPC_BUILD_MAC" == "" ]; then
venv/bin/python -m twine check src/python/grpcio_observability/dist/*
Expand Down
2 changes: 1 addition & 1 deletion tools/run_tests/helper_scripts/build_cxx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ cd cmake/build
if [ "${GRPC_RUNTESTS_ARCHITECTURE}" = "x86" ]; then
cmake -DgRPC_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE="${MSBUILD_CONFIG}" "$@" ../..
else
cmake -DgRPC_BUILD_GRPCPP_OTEL_PLUGIN=ON -DgRPC_ABSL_PROVIDER=package -DgRPC_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE="${MSBUILD_CONFIG}" -DCMAKE_INSTALL_PREFIX="${INSTALL_PATH}" "$@" ../..
cmake -DgRPC_BUILD_GRPCPP_OTEL_PLUGIN=ON -DgRPC_ABSL_PROVIDER=package -DgRPC_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE="${MSBUILD_CONFIG}" -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_INSTALL_PREFIX="${INSTALL_PATH}" "$@" ../..
fi

if [[ "$*" =~ "-DgRPC_BUILD_TESTS=OFF" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion tools/run_tests/helper_scripts/build_ruby.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fi
# build grpc_ruby_plugin
mkdir -p cmake/build
pushd cmake/build
cmake -DgRPC_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=${CMAKE_CONFIG} -DCMAKE_CXX_STANDARD=17 ../..
cmake -DgRPC_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=${CMAKE_CONFIG} -DCMAKE_CXX_STANDARD=17 -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ../..
make protoc grpc_ruby_plugin -j2
popd

Expand Down