| # 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-ipc |
| |
| on: |
| push: |
| branches: |
| - main |
| pull_request: |
| branches: |
| - main |
| paths: |
| - 'CMakeLists.txt' |
| - '.github/workflows/build-and-test-ipc.yaml' |
| - 'src/nanoarrow/**' |
| - 'extensions/nanoarrow_ipc/**' |
| |
| permissions: |
| contents: read |
| |
| jobs: |
| test-c-ipc: |
| |
| runs-on: ubuntu-latest |
| |
| name: ${{ matrix.config.label }} |
| |
| strategy: |
| fail-fast: false |
| matrix: |
| config: |
| - {label: default-build, cmake_args: "-DNANOARROW_IPC_BUILD_APPS=ON"} |
| - {label: default-noatomics, cmake_args: "-DCMAKE_C_FLAGS='-DNANOARROW_IPC_USE_STDATOMIC=0'"} |
| - {label: namespaced-build, cmake_args: "-DNANOARROW_NAMESPACE=SomeUserNamespace"} |
| - {label: bundled-build, cmake_args: "-DNANOARROW_IPC_BUNDLE=ON"} |
| |
| env: |
| SUBDIR: 'extensions/nanoarrow_ipc' |
| NANOARROW_ARROW_TESTING_DIR: '${{ github.workspace }}/arrow-testing' |
| |
| steps: |
| - uses: actions/checkout@v4 |
| |
| - name: Checkout arrow-testing |
| uses: actions/checkout@v4 |
| with: |
| repository: apache/arrow-testing |
| path: arrow-testing |
| |
| - name: Install memcheck dependencies |
| if: matrix.config.label == 'default-build' || matrix.config.label == 'default-noatomics' |
| run: | |
| sudo apt-get update && sudo apt-get install -y valgrind |
| |
| - name: Cache Arrow C++ Build |
| id: cache-arrow-build |
| uses: actions/cache@v4 |
| with: |
| path: arrow |
| # Bump the number at the end of this line to force a new Arrow C++ build |
| key: arrow-${{ runner.os }}-10 |
| |
| - name: Build Arrow C++ |
| if: steps.cache-arrow-build.outputs.cache-hit != 'true' |
| shell: bash |
| run: | |
| ci/scripts/build-arrow-cpp-minimal.sh 15.0.2 arrow |
| |
| - name: Build |
| run: | |
| ARROW_PATH="$(pwd)/arrow" |
| cd $SUBDIR |
| export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/dist/lib |
| sudo ldconfig |
| |
| mkdir build |
| cd build |
| |
| cmake .. -DCMAKE_BUILD_TYPE=Debug -DNANOARROW_IPC_BUILD_TESTS=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: | |
| cd $SUBDIR |
| |
| # Dump all symbols |
| nm --extern-only build/libnanoarrow_ipc.a |
| |
| # Check for non-namespaced ones |
| ARROW_SYMBOLS=`nm --extern-only build/libnanoarrow_ipc.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 $SUBDIR |
| |
| export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/dist/lib |
| sudo ldconfig |
| cd build |
| ctest -T test --output-on-failure . |
| |
| - name: Test dump_stream |
| if: matrix.config.label == 'default-build' |
| run: | |
| $SUBDIR/build/dump_stream || true |
| $SUBDIR/build/dump_stream this_is_not_a_file || true |
| $SUBDIR/build/dump_stream examples/cmake-ipc/invalid.arrows || true |
| $SUBDIR/build/dump_stream examples/cmake-ipc/schema-valid.arrows |
| cat examples/cmake-ipc/schema-valid.arrows | $SUBDIR/build/dump_stream - |
| |
| - name: Run tests with valgrind |
| if: matrix.config.label == 'default-build' || matrix.config.label == 'default-noatomics' |
| run: | |
| cd $SUBDIR |
| |
| export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/dist/lib |
| sudo ldconfig |
| cd build |
| ctest -T memcheck . |
| |
| - name: Upload memcheck results |
| if: failure() && matrix.config.label == 'default-build' |
| uses: actions/upload-artifact@main |
| with: |
| name: nanoarrow-ipc-memcheck |
| path: extensions/nanoarrow_ipc/build/Testing/Temporary/MemoryChecker.*.log |