|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | + |
| 18 | +name: test-c-device |
| 19 | + |
| 20 | +on: |
| 21 | + push: |
| 22 | + branches: |
| 23 | + - main |
| 24 | + pull_request: |
| 25 | + branches: |
| 26 | + - main |
| 27 | + paths: |
| 28 | + - 'CMakeLists.txt' |
| 29 | + - '.github/workflows/build-and-test-device.yaml' |
| 30 | + - 'src/nanoarrow/**' |
| 31 | + - 'extensions/nanoarrow_device/**' |
| 32 | + |
| 33 | +jobs: |
| 34 | + test-c-device: |
| 35 | + |
| 36 | + runs-on: ubuntu-latest |
| 37 | + |
| 38 | + name: ${{ matrix.config.label }} |
| 39 | + |
| 40 | + strategy: |
| 41 | + fail-fast: false |
| 42 | + matrix: |
| 43 | + config: |
| 44 | + - {label: default-build} |
| 45 | + - {label: namespaced-build, cmake_args: "-DNANOARROW_NAMESPACE=SomeUserNamespace"} |
| 46 | + - {label: bundled-build, cmake_args: "-DNANOARROW_DEVICE_BUNDLE=ON"} |
| 47 | + |
| 48 | + env: |
| 49 | + SUBDIR: 'extensions/nanoarrow_device' |
| 50 | + NANOARROW_ARROW_TESTING_DIR: '${{ github.workspace }}/arrow-testing' |
| 51 | + |
| 52 | + steps: |
| 53 | + - name: Checkout repo |
| 54 | + uses: actions/checkout@v3 |
| 55 | + with: |
| 56 | + fetch-depth: 0 |
| 57 | + |
| 58 | + - name: Checkout arrow-testing |
| 59 | + uses: actions/checkout@v3 |
| 60 | + with: |
| 61 | + repository: apache/arrow-testing |
| 62 | + fetch-depth: 0 |
| 63 | + path: arrow-testing |
| 64 | + |
| 65 | + - name: Install dependencies |
| 66 | + run: | |
| 67 | + sudo apt-get update |
| 68 | + sudo apt install -y -V ca-certificates lsb-release wget cmake valgrind |
| 69 | + wget https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb |
| 70 | + sudo apt-get install -y -V ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb |
| 71 | + sudo apt-get update |
| 72 | + sudo apt-get install -y -V libarrow-dev |
| 73 | + rm apache-arrow-apt-*.deb |
| 74 | +
|
| 75 | + - name: Build |
| 76 | + run: | |
| 77 | + cd $SUBDIR |
| 78 | + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/dist/lib |
| 79 | + sudo ldconfig |
| 80 | + mkdir build |
| 81 | + cd build |
| 82 | + cmake .. -DCMAKE_BUILD_TYPE=Debug -DNANOARROW_DEVICE_BUILD_TESTS=ON ${{ matrix.config.cmake_args }} |
| 83 | + cmake --build . |
| 84 | +
|
| 85 | + - name: Check for non-namespaced symbols in namespaced build |
| 86 | + if: matrix.config.label == 'namespaced-build' |
| 87 | + run: | |
| 88 | + cd $SUBDIR |
| 89 | +
|
| 90 | + # Dump all symbols |
| 91 | + nm --extern-only build/libnanoarrow_device.a |
| 92 | +
|
| 93 | + # Check for non-namespaced ones |
| 94 | + ARROW_SYMBOLS=`nm --extern-only build/libnanoarrow_device.a | grep "T Arrow" || true` |
| 95 | + if [ -z "$ARROW_SYMBOLS" ]; then |
| 96 | + exit 0 |
| 97 | + fi |
| 98 | +
|
| 99 | + echo "Found the following non-namespaced extern symbols:" |
| 100 | + echo $ARROW_SYMBOLS |
| 101 | + exit 1 |
| 102 | +
|
| 103 | + - name: Run tests |
| 104 | + run: | |
| 105 | + cd $SUBDIR |
| 106 | +
|
| 107 | + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/dist/lib |
| 108 | + sudo ldconfig |
| 109 | + cd build |
| 110 | + ctest -T test --output-on-failure . |
| 111 | +
|
| 112 | + - name: Run tests with valgrind |
| 113 | + if: matrix.config.label == 'default-build' || matrix.config.label == 'default-noatomics' |
| 114 | + run: | |
| 115 | + cd $SUBDIR |
| 116 | +
|
| 117 | + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/dist/lib |
| 118 | + sudo ldconfig |
| 119 | + cd build |
| 120 | + ctest -T memcheck . |
| 121 | +
|
| 122 | + - name: Upload memcheck results |
| 123 | + if: failure() && matrix.config.label == 'default-build' |
| 124 | + uses: actions/upload-artifact@main |
| 125 | + with: |
| 126 | + name: nanoarrow-device-memcheck |
| 127 | + path: extensions/nanoarrow_device/build/Testing/Temporary/MemoryChecker.*.log |
0 commit comments