diff --git a/.github/actions/setup-ccache/action.yml b/.github/actions/setup-ccache/action.yml index 62de2837a..fa4da936e 100644 --- a/.github/actions/setup-ccache/action.yml +++ b/.github/actions/setup-ccache/action.yml @@ -27,7 +27,12 @@ runs: steps: - name: Install ccache shell: bash - run: sudo apt-get update && sudo apt-get install -y ccache + run: | + if [[ "${RUNNER_OS}" == "macOS" ]]; then + brew install ccache + else + sudo apt-get update && sudo apt-get install -y ccache + fi - name: Restore ccache uses: actions/cache@v4 diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/build_and_test.yaml index f9548716d..1f0df9b90 100644 --- a/.github/workflows/build_and_test.yaml +++ b/.github/workflows/build_and_test.yaml @@ -50,6 +50,56 @@ jobs: shell: bash run: ci/scripts/test_asan_symbolize.sh + macos-build-and-test: + name: appleclang-release-arm64 + runs-on: macos-15 + timeout-minutes: 180 + env: + CC: /usr/bin/clang + CXX: /usr/bin/clang++ + PAIMON_BUILD_JOBS: '3' + CARGO_BUILD_JOBS: '3' + steps: + - name: Checkout paimon-cpp + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + with: + lfs: true + - name: Install build dependencies + shell: bash + run: | + brew install cmake ninja protobuf openssl@3 curl + echo "$(brew --prefix protobuf)/bin" >> "$GITHUB_PATH" + echo "CMAKE_PREFIX_PATH=$(brew --prefix openssl@3):$(brew --prefix curl)" >> "$GITHUB_ENV" + - name: Setup ccache + uses: ./.github/actions/setup-ccache + with: + cache-key-prefix: ccache-appleclang-release-arm64 + - name: Install Rust and protobuf tools + shell: bash + run: ci/scripts/setup_rust.sh + - name: Install flatc and libclang (Vortex) + shell: bash + run: ci/scripts/setup_flatc.sh + - name: Build, test and verify installation + shell: bash + run: | + ci/scripts/build_paimon.sh \ + --source_dir "$(pwd)" \ + --build_type Release \ + --install_smoke + - name: Upload test logs + if: failure() + uses: actions/upload-artifact@v4 + with: + name: appleclang-release-arm64-test-logs + path: | + build/build/test-logs/ + build/Testing/Temporary/ + build/CMakeFiles/CMakeConfigureLog.yaml + - name: Show ccache statistics + if: always() + run: ccache -s + build-and-test: name: ${{ matrix.name }} runs-on: ${{ matrix.runner || 'ubuntu-24.04' }} diff --git a/ci/scripts/build_paimon.sh b/ci/scripts/build_paimon.sh index eacaf7485..ba5237f94 100755 --- a/ci/scripts/build_paimon.sh +++ b/ci/scripts/build_paimon.sh @@ -145,9 +145,9 @@ if [[ "${enable_tsan}" == "true" ]]; then fi # CI always builds natively, so the host architecture is the target architecture. host_arch=$(uname -m) -if [[ "${host_arch}" != "x86_64" ]]; then +if [[ "$(uname -s)" != "Linux" || "${host_arch}" != "x86_64" ]]; then ENABLE_LUMINA="OFF" - echo "=== Lumina disabled: no prebuilt artifacts for ${host_arch} ===" + echo "=== Lumina disabled: no prebuilt artifacts for $(uname -s)-${host_arch} ===" fi if [[ "${verify_full_text_archives}" == "true" && "${ENABLE_FULL_TEXT}" != "ON" ]]; then echo "--verify_full_text_archives requires the full-text index, which this build disables" >&2 diff --git a/ci/scripts/setup_flatc.sh b/ci/scripts/setup_flatc.sh index ce8981f2f..099f3abc3 100755 --- a/ci/scripts/setup_flatc.sh +++ b/ci/scripts/setup_flatc.sh @@ -38,7 +38,13 @@ FLATC_INSTALL_DIR=${FLATC_INSTALL_DIR:-"${HOME}/.local/bin"} # Vortex's native dependencies invoke bindgen in their build scripts, which loads libclang at # build time. Images that only carry GCC (e.g. the gcc8 test container) may lack it. -if ! ldconfig -p 2>/dev/null | grep -q 'libclang'; then +if [[ "$(uname -s)" == "Darwin" ]]; then + if ! brew --prefix llvm >/dev/null 2>&1; then + brew install llvm + fi + export LIBCLANG_PATH="$(brew --prefix llvm)/lib" + echo "LIBCLANG_PATH=${LIBCLANG_PATH}" >>"${GITHUB_ENV:-/dev/null}" || true +elif ! ldconfig -p 2>/dev/null | grep -q 'libclang'; then if [[ "$(id -u)" -ne 0 ]] && command -v sudo >/dev/null 2>&1; then apt_prefix="sudo" else @@ -63,7 +69,12 @@ git clone --depth 1 --branch "v${FLATBUFFERS_VERSION}" \ cmake -S "${workdir}/flatbuffers" -B "${workdir}/build" \ -DCMAKE_BUILD_TYPE=Release \ -DFLATBUFFERS_BUILD_TESTS=OFF -cmake --build "${workdir}/build" --target flatc -j "$(nproc)" +if command -v nproc >/dev/null 2>&1; then + build_jobs=$(nproc) +else + build_jobs=$(sysctl -n hw.ncpu) +fi +cmake --build "${workdir}/build" --target flatc -j "${build_jobs}" mkdir -p "${FLATC_INSTALL_DIR}" install -m 0755 "${workdir}/build/flatc" "${FLATC_INSTALL_DIR}/flatc" diff --git a/cmake_modules/ThirdpartyToolchain.cmake b/cmake_modules/ThirdpartyToolchain.cmake index 8aa8f1183..f8ebb977e 100644 --- a/cmake_modules/ThirdpartyToolchain.cmake +++ b/cmake_modules/ThirdpartyToolchain.cmake @@ -1558,16 +1558,17 @@ macro(build_vortex) PROPERTIES IMPORTED_LOCATION "${VORTEX_STATIC_LIB}" INTERFACE_INCLUDE_DIRECTORIES "${VORTEX_INCLUDE_DIR}") - # System libraries required to link the Rust static archive on Linux (per Vortex's own - # vortex-ffi/cmake/SystemDependencies.cmake). - target_link_libraries(paimon_vortex_ffi - INTERFACE gcc_s - util - rt - Threads::Threads - m - ${CMAKE_DL_LIBS} - c) + # System libraries required to link the Rust static archive. + target_link_libraries(paimon_vortex_ffi INTERFACE Threads::Threads m ${CMAKE_DL_LIBS} + c) + if(APPLE) + target_link_libraries(paimon_vortex_ffi + INTERFACE iconv "-framework Security" + "-framework SystemConfiguration" + "-framework CoreFoundation") + else() + target_link_libraries(paimon_vortex_ffi INTERFACE gcc_s util rt) + endif() add_dependencies(paimon_vortex_ffi vortex_ep) install(FILES "${VORTEX_STATIC_LIB}" DESTINATION ${CMAKE_INSTALL_LIBDIR})