diff --git a/.github/actions/setup-conda-arrow/action.yml b/.github/actions/setup-conda-arrow/action.yml new file mode 100644 index 000000000..980c6302d --- /dev/null +++ b/.github/actions/setup-conda-arrow/action.yml @@ -0,0 +1,60 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +name: Set up conda Arrow +description: Install Arrow and Parquet from conda-forge for CMake builds. + +inputs: + runtime-library-path: + description: Runtime library path variable to export. + required: false + default: LD_LIBRARY_PATH + extra-packages: + description: Extra conda packages to install, space separated. + required: false + default: "" + +runs: + using: composite + steps: + - name: Set up conda + uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1 + with: + miniforge-version: latest + channels: conda-forge + channel-priority: strict + activate-environment: arrow + - name: Install Arrow and Parquet + shell: bash -el {0} + env: + RUNTIME_LIBRARY_PATH: ${{ inputs.runtime-library-path }} + EXTRA_PACKAGES: ${{ inputs.extra-packages }} + run: | + read -r -a extra_packages <<< "${EXTRA_PACKAGES}" + mamba install -y "libarrow=24.0.*" "libparquet=24.0.*" "${extra_packages[@]}" + echo "CMAKE_PREFIX_PATH=${CONDA_PREFIX}" >> "$GITHUB_ENV" + echo "ICEBERG_REQUIRE_SYSTEM_ARROW=ON" >> "$GITHUB_ENV" + + case "${RUNTIME_LIBRARY_PATH}" in + LD_LIBRARY_PATH|DYLD_FALLBACK_LIBRARY_PATH) ;; + *) + echo "::error::Unsupported runtime-library-path: ${RUNTIME_LIBRARY_PATH}" + exit 1 + ;; + esac + runtime_path_var="${RUNTIME_LIBRARY_PATH}" + echo "${runtime_path_var}=${!runtime_path_var:+${!runtime_path_var}:}${CONDA_PREFIX}/lib" >> "$GITHUB_ENV" diff --git a/.github/workflows/cpp-linter.yml b/.github/workflows/cpp-linter.yml index 9e8518199..56cb7d76d 100644 --- a/.github/workflows/cpp-linter.yml +++ b/.github/workflows/cpp-linter.yml @@ -60,6 +60,11 @@ jobs: run: | sudo apt-get update sudo apt-get install -y libcurl4-openssl-dev libsqlite3-dev libpq-dev default-libmysqlclient-dev + - name: Set up conda Arrow + uses: ./.github/actions/setup-conda-arrow + with: + # This leg builds Hive, whose Thrift runtime needs Boost headers. + extra-packages: libboost-devel - name: Set up sccache uses: ./.github/actions/setup-sccache with: @@ -78,7 +83,12 @@ jobs: -DICEBERG_SQL_SQLITE=ON \ -DICEBERG_SQL_POSTGRESQL=ON \ -DICEBERG_SQL_MYSQL=ON \ - -DICEBERG_BUILD_HIVE=ON + -DICEBERG_BUILD_HIVE=ON \ + -DICEBERG_BUNDLE_THRIFT=OFF + if [[ -d _deps/vendoredarrow-src ]]; then + echo "::error::Expected Arrow from CMAKE_PREFIX_PATH, but CMake configured vendored Arrow" + exit 1 + fi cmake --build . - name: Save sccache if: always() diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1c85c7cc0..53a995003 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -93,7 +93,9 @@ jobs: env: SCCACHE_DIR: ${{ github.workspace }}/.sccache SCCACHE_CACHE_SIZE: "2G" - ICEBERG_EXTRA_CMAKE_ARGS: "-DICEBERG_BUILD_HIVE=ON" + # Prebuilt Arrow exports no Thrift target, so resolve the Thrift runtime + # from conda instead of Arrow's bundled build. + ICEBERG_EXTRA_CMAKE_ARGS: "-DICEBERG_BUILD_HIVE=ON -DICEBERG_BUNDLE_THRIFT=OFF" steps: - name: Checkout iceberg-cpp uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 @@ -102,6 +104,12 @@ jobs: - name: Install dependencies shell: bash run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev + - name: Set up conda Arrow + uses: ./.github/actions/setup-conda-arrow + with: + # Thrift's public C++ headers include Boost, and libboost-devel (not + # libboost-headers) is the package carrying BoostConfig.cmake. + extra-packages: libboost-devel - name: Restore sccache cache uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: diff --git a/cmake_modules/FindThriftAlt.cmake b/cmake_modules/FindThriftAlt.cmake index 13820998b..8ccbd9f74 100644 --- a/cmake_modules/FindThriftAlt.cmake +++ b/cmake_modules/FindThriftAlt.cmake @@ -85,10 +85,12 @@ endif() include(FindPackageHandleStandardArgs) if(TARGET thrift::thrift) - # CONFIG mode already produced the target; satisfy REQUIRED_VARS with it. + # CONFIG mode already produced the target. REQUIRED_VARS dereferences names as + # variables, so pass a variable holding the target rather than the target name. + set(ThriftAlt_TARGET thrift::thrift) find_package_handle_standard_args( ThriftAlt - REQUIRED_VARS thrift::thrift + REQUIRED_VARS ThriftAlt_TARGET VERSION_VAR ThriftAlt_VERSION) else() find_package_handle_standard_args(