chore: Fix flatcc linking for non-bundled case (#894) #1776
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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: test-c-device | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - 'CMakeLists.txt' | |
| - '.github/workflows/build-and-test-device.yaml' | |
| - 'src/nanoarrow/**' | |
| - 'python/meson.build' | |
| - 'python/src/nanoarrow/meson.build' | |
| permissions: | |
| contents: read | |
| jobs: | |
| test-c-device: | |
| runs-on: ${{ matrix.config.runner }} | |
| name: ${{ matrix.config.label }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| config: | |
| - {runner: ubuntu-latest, label: default-build} | |
| - {runner: ubuntu-latest, label: namespaced-build, cmake_args: "-DNANOARROW_NAMESPACE=SomeUserNamespace"} | |
| - {runner: ubuntu-latest, label: bundled-build, cmake_args: "-DNANOARROW_DEVICE_BUNDLE=ON"} | |
| - {runner: ubuntu-latest, label: shared-test-linkage, cmake_args: "-DNANOARROW_TEST_LINKAGE_SHARED=ON"} | |
| - {runner: macOS-latest, label: with-metal, cmake_args: "-DNANOARROW_DEVICE_WITH_METAL=ON"} | |
| - {runner: "runs-on=${{ github.run_id }}/family=g4dn.xlarge/image=ubuntu24-gpu-x64/spot=capacity-optimized", label: with-cuda, cmake_args: "-DNANOARROW_DEVICE_WITH_CUDA=ON"} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install memcheck dependencies | |
| if: matrix.config.label == 'default-build' | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y valgrind | |
| - name: Set up Python | |
| if: matrix.config.label == 'with-cuda' | |
| uses: actions/setup-python@v6 | |
| with: | |
| # cupy-cuda12x does not have a PyPI distribution for Python 3.14 | |
| python-version: "3.13" | |
| cache: 'pip' | |
| - name: Display NVIDIA SMI details | |
| if: matrix.config.label == 'with-cuda' | |
| run: | | |
| nvidia-smi | |
| nvidia-smi -L | |
| nvidia-smi -q -d Memory | |
| # The self-hosted runner for CUDA needs a number of packages installed that | |
| # are already installed on the GitHub runner | |
| - name: Install build dependencies | |
| if: matrix.config.label == 'with-cuda' | |
| run: | | |
| # Install minimal CUDA packages needed for building (avoid full cuda-toolkit | |
| # which includes nsight-systems and other large tools that exhaust disk space) | |
| sudo apt-get update && \ | |
| sudo apt-get install -y cmake build-essential tzdata \ | |
| cuda-nvcc-13-2 cuda-cudart-dev-13-2 libcublas-dev-13-2 | |
| # Install newer cmake for building Arrow C++ | |
| pip install cmake | |
| # Debug install location of cuda toolkit | |
| ldconfig -p | grep libcuda | |
| - name: Cache Arrow C++ Build | |
| id: cache-arrow-build | |
| uses: actions/cache@v5 | |
| with: | |
| path: arrow | |
| # Bump the number at the end of this line to force a new Arrow C++ build | |
| key: arrow-device-${{ runner.os }}-${{ runner.arch }}-${{ matrix.config.label }}-3 | |
| - name: Build Arrow C++ | |
| if: steps.cache-arrow-build.outputs.cache-hit != 'true' | |
| shell: bash | |
| run: | | |
| ci/scripts/build-arrow-cpp-minimal.sh 21.0.0 arrow | |
| - name: Build | |
| run: | | |
| ARROW_PATH="$(pwd)/arrow" | |
| # Debug arrow includes | |
| find "${ARROW_PATH}" | |
| mkdir build | |
| cd build | |
| export VERBOSE=1 | |
| cmake .. -DCMAKE_BUILD_TYPE=Debug -DNANOARROW_DEVICE=ON \ | |
| -DNANOARROW_BUILD_TESTS=ON -DNANOARROW_BUILD_TESTS_WITH_ARROW=ON \ | |
| -DCMAKE_PREFIX_PATH="${ARROW_PATH}" ${{ matrix.config.cmake_args }} | |
| cmake --build . | |
| - name: Check for non-namespaced symbols in namespaced build | |
| if: matrix.config.label == 'namespaced-build' | |
| run: | | |
| # Dump all symbols | |
| nm --extern-only build/libnanoarrow_device_static.a | |
| # Check for non-namespaced ones | |
| ARROW_SYMBOLS=`nm --extern-only build/libnanoarrow_device_static.a | grep "T Arrow" || true` | |
| if [ -z "$ARROW_SYMBOLS" ]; then | |
| exit 0 | |
| fi | |
| echo "Found the following non-namespaced extern symbols:" | |
| echo $ARROW_SYMBOLS | |
| exit 1 | |
| - name: Run tests | |
| run: | | |
| cd build | |
| ctest -T test --output-on-failure . | |
| - name: Run tests with valgrind | |
| if: matrix.config.label == 'default-build' || matrix.config.label == 'default-noatomics' | |
| run: | | |
| cd build | |
| ctest -T memcheck . | |
| - name: Upload memcheck results | |
| if: failure() && matrix.config.label == 'default-build' | |
| uses: actions/upload-artifact@main | |
| with: | |
| name: nanoarrow-device-memcheck | |
| path: build/Testing/Temporary/MemoryChecker.*.log | |
| - name: Build Python bindings with CUDA | |
| if: matrix.config.label == 'with-cuda' | |
| env: | |
| NANOARROW_PYTHON_CUDA_HOME: "/usr/local/cuda" | |
| run: | | |
| cd python | |
| python3 -m pip install ".[test]" -vv | |
| python3 -m pip install cupy-cuda12x | |
| - name: Test Python bindings with CUDA | |
| if: matrix.config.label == 'with-cuda' | |
| run: | | |
| cd python | |
| python3 -m pytest -vv |