This is an automated email from the ASF dual-hosted git repository.
amoeba pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-cookbook.git
The following commit(s) were added to refs/heads/main by this push:
new 6c309c8 MINOR: Test dev cookbook deploy in PRs (#400)
6c309c8 is described below
commit 6c309c8f901955325c0ae46c8d6d66c55b287fae
Author: Bryce Mecum <[email protected]>
AuthorDate: Sun Apr 26 20:56:37 2026 -0700
MINOR: Test dev cookbook deploy in PRs (#400)
Fixes the dev cookbook workflow and also makes it so it will run on PRs
against main. The dev cookbooks build Arrow C++ from scratch since we no
longer have nightly C++ binaries.
We might consider not doing that in the future since it takes quite a
long time.
The original motivation for this change was mainly because I wanted to
fix the dev cookbooks so I made the workflow run on a PR since I could
test but I think this has enough value to leave in for now.
---
.github/workflows/deploy_development_cookbooks.yml | 4 +
cpp/code/CMakeLists.txt | 96 ++++++++++++----------
cpp/code/flight.cc | 7 ++
cpp/dev.yml | 11 ++-
4 files changed, 67 insertions(+), 51 deletions(-)
diff --git a/.github/workflows/deploy_development_cookbooks.yml
b/.github/workflows/deploy_development_cookbooks.yml
index e34a35e..6471d95 100644
--- a/.github/workflows/deploy_development_cookbooks.yml
+++ b/.github/workflows/deploy_development_cookbooks.yml
@@ -2,6 +2,9 @@ on:
push:
branches:
- main
+ pull_request:
+ branches:
+ - main
name: Deploy development Cookbooks
@@ -80,6 +83,7 @@ jobs:
name: deploy
runs-on: ubuntu-latest
needs: [make_dev_cookbooks, make_dev_cpp]
+ if: github.event_name == 'push'
steps:
- name: Checkout repo
uses: actions/checkout@v5
diff --git a/cpp/code/CMakeLists.txt b/cpp/code/CMakeLists.txt
index 7c9890f..cb7259f 100644
--- a/cpp/code/CMakeLists.txt
+++ b/cpp/code/CMakeLists.txt
@@ -19,19 +19,21 @@ cmake_minimum_required(VERSION 3.19)
project(arrow-cookbook)
set(CMAKE_CXX_STANDARD 20)
-if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++")
endif()
-# Add Arrow and other required packages
if(DEFINED ENV{ARROW_NIGHTLY})
set(CMAKE_BUILD_TYPE Debug)
set(ARROW_BUILD_SHARED True)
set(ARROW_DEPENDENCY_SOURCE "AUTO")
set(ARROW_ENABLE_THREADING ON)
- set(ARROW_SIMD_LEVEL NONE) # macOS-specific workaround
set(ARROW_WITH_SNAPPY ON)
+ set(ARROW_THRIFT_SOURCE "BUNDLED")
+ set(ARROW_PROTOBUF_SOURCE "BUNDLED")
+ set(ARROW_GRPC_SOURCE "BUNDLED")
+ set(ARROW_BUILD_STATIC ON)
set(ARROW_ACERO ON)
set(ARROW_COMPUTE ON)
@@ -41,6 +43,13 @@ if(DEFINED ENV{ARROW_NIGHTLY})
set(ARROW_IPC ON)
set(ARROW_PARQUET ON)
+ find_package(OpenSSL REQUIRED)
+
+ # Prevent re2 from registering its test targets with CTest.
+ # re2 uses its own variable instead of BUILD_TESTING.
+ # TODO: fix upstream in Arrow's bundled dependency handling.
+ set(RE2_BUILD_TESTING OFF CACHE BOOL "" FORCE)
+
include(FetchContent)
FetchContent_Declare(Arrow
@@ -62,11 +71,8 @@ if(DEFINED ENV{ARROW_NIGHTLY})
arrow_shared
SYSTEM INTERFACE "$<BUILD_INTERFACE:${arrow_SOURCE_DIR}/cpp/src>"
)
- # Force FetchContent Arrow headers to the front of every target's include
- # list so they take priority over any system Arrow headers added transitively
- # (e.g. /opt/homebrew/include from GTest::gtest). Without this the recipe
- # executables compile against the older installed Arrow headers but link
- # against the FetchContent Arrow runtime, causing ABI mismatches.
+ # Help make sure the FetchContent build headers go in front if the system has
+ # stable Arrow DLLs installed too
include_directories(BEFORE SYSTEM "${arrow_SOURCE_DIR}/cpp/src")
else()
@@ -76,46 +82,53 @@ else()
find_package(Parquet REQUIRED)
endif()
-if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CXX_CLANG_TIDY "clang-tidy")
endif()
-# Create test targets
enable_testing()
find_package(GTest REQUIRED)
include(GoogleTest)
+# Resolve which Arrow targets to link against and wire up their dependency
+# chains once here, before any recipe() calls.
+if(TARGET Arrow::arrow_shared AND (NOT DEFINED ARROW_GRPC_USE_SHARED OR
ARROW_GRPC_USE_SHARED))
+ set(ARROW_RECIPE_LIBS
+ ArrowDataset::arrow_dataset_shared
+ ArrowFlight::arrow_flight_shared)
+elseif(TARGET arrow_flight_static)
+ # gRPC is statically bundled inside Arrow. Link against the static Arrow libs
+ # so there is only one copy of gRPC in the binary (avoids duplicate TLS
slots).
+ target_link_libraries(parquet_static INTERFACE arrow_static)
+ target_link_libraries(arrow_dataset_static INTERFACE parquet_static)
+ target_link_libraries(arrow_flight_static INTERFACE arrow_static)
+ set(ARROW_RECIPE_LIBS arrow_dataset_static arrow_flight_static)
+else()
+ target_link_libraries(parquet_shared INTERFACE arrow_shared)
+ target_link_libraries(arrow_dataset_shared INTERFACE parquet_shared)
+ target_link_libraries(arrow_flight_shared INTERFACE arrow_shared)
+ set(ARROW_RECIPE_LIBS arrow_dataset_shared arrow_flight_shared)
+endif()
+
function(RECIPE TARGET)
add_executable(
- ${TARGET}
- ${TARGET}.cc
- common.cc
- main.cc
+ ${TARGET}
+ ${TARGET}.cc
+ common.cc
+ main.cc
)
- if(TARGET Arrow::arrow_shared)
- target_link_libraries(
- ${TARGET}
- ArrowDataset::arrow_dataset_shared
- ArrowFlight::arrow_flight_shared GTest::gtest
- )
- else()
- target_link_libraries(parquet_shared INTERFACE arrow_shared)
- target_link_libraries(arrow_dataset_shared INTERFACE parquet_shared)
- target_link_libraries(arrow_flight_shared INTERFACE arrow_shared)
- target_link_libraries(${TARGET} arrow_dataset_shared arrow_flight_shared
GTest::gtest)
- endif()
- if (MSVC)
+ target_link_libraries(${TARGET} ${ARROW_RECIPE_LIBS} GTest::gtest)
+ if(MSVC)
target_compile_options(${TARGET} PRIVATE /W4 /WX)
- else ()
+ else()
target_compile_options(${TARGET} PRIVATE -Wall -Wextra -Wpedantic -Werror)
- # _Nullable/_Nonnull nullability annotations in absl macros trigger
- # -Wnullability-extension under -Wpedantic; this is Clang-only.
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ # _Nullable/_Nonnull nullability annotations in absl macros trigger
+ # -Wnullability-extension under -Wpedantic.
target_compile_options(${TARGET} PRIVATE -Wno-nullability-extension)
endif()
- endif ()
-
+ endif()
gtest_discover_tests(${TARGET})
endfunction()
@@ -124,23 +137,16 @@ recipe(creating_arrow_objects)
recipe(datasets)
recipe(flight)
-# Add protobuf to flight
-find_package(Threads)
-find_package(gRPC CONFIG REQUIRED)
+if(NOT TARGET gRPC::grpc)
+ find_package(gRPC CONFIG REQUIRED)
+endif()
-set(PROTO_FILES
- protos/helloworld.proto
-)
+set(PROTO_FILES protos/helloworld.proto)
-target_link_libraries(flight
- protobuf::libprotobuf
- gRPC::grpc
- gRPC::grpc++
-)
+target_link_libraries(flight protobuf::libprotobuf gRPC::grpc gRPC::grpc++)
target_include_directories(flight PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
-get_target_property(grpc_cpp_plugin_location gRPC::grpc_cpp_plugin LOCATION)
protobuf_generate(TARGET flight LANGUAGE cpp PROTOS ${PROTO_FILES})
protobuf_generate(TARGET flight LANGUAGE grpc
GENERATE_EXTENSIONS .grpc.pb.h .grpc.pb.cc
- PLUGIN "protoc-gen-grpc=${grpc_cpp_plugin_location}"
+ PLUGIN "protoc-gen-grpc=$<TARGET_FILE:gRPC::grpc_cpp_plugin>"
PROTOS ${PROTO_FILES})
diff --git a/cpp/code/flight.cc b/cpp/code/flight.cc
index 038f43e..24daa70 100644
--- a/cpp/code/flight.cc
+++ b/cpp/code/flight.cc
@@ -392,6 +392,13 @@ arrow::Status TestCustomGrpcImpl() {
rout << response.reply();
EndRecipe("CustomGrpcImpl::CreateClient");
+
+ StartRecipe("CustomGrpcImpl::StopServer");
+ ARROW_RETURN_NOT_OK(server->Shutdown());
+ ARROW_RETURN_NOT_OK(server->Wait());
+ rout << "Server shut down successfully" << std::endl;
+ EndRecipe("CustomGrpcImpl::StopServer");
+
return arrow::Status::OK();
}
diff --git a/cpp/dev.yml b/cpp/dev.yml
index 90eda6e..e96158e 100644
--- a/cpp/dev.yml
+++ b/cpp/dev.yml
@@ -19,6 +19,10 @@ channels:
- conda-forge
dependencies:
- python=3.10
+ - pip
+ - pip:
+ - --index-url
https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
+ - pyarrow
- compilers
- cmake
- ninja
@@ -27,11 +31,6 @@ dependencies:
- gmock
- clang-tools
- zlib
- - grpc-cpp
- - protobuf
- - abseil-cpp
- - c-ares
- - re2
- - thrift-cpp
+ - openssl
- rapidjson
- snappy