This is an automated email from the ASF dual-hosted git repository.
paleolimbot pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-nanoarrow.git
The following commit(s) were added to refs/heads/main by this push:
new 580c3d2d fix(ci): Use cached Arrow C++ build in CI (#410)
580c3d2d is described below
commit 580c3d2dd6f42e27243b7e7e3c75f7ba99407044
Author: Dewey Dunnington <[email protected]>
AuthorDate: Wed Mar 27 10:17:12 2024 -0300
fix(ci): Use cached Arrow C++ build in CI (#410)
This PR removes the use of the debian packages for Arrow C++ in favour
of a minimal (cached) build. This is slightly faster than installing and
removes the dependence on the artifactory for CI to pass (which is
temporarily not available).
It also updates some of the actions, which were using old checkout/cache
versions or installing Arrow C++ unnecessarily.
Closes #408.
---
.github/workflows/build-and-test-device.yaml | 26 +++--------
.github/workflows/build-and-test-ipc.yaml | 43 +++++++++++-------
.github/workflows/build-and-test.yaml | 34 ++++++++++----
ci/scripts/build-arrow-cpp-minimal.sh | 67 ++++++++++++++++++++++++++++
4 files changed, 127 insertions(+), 43 deletions(-)
diff --git a/.github/workflows/build-and-test-device.yaml
b/.github/workflows/build-and-test-device.yaml
index dfb6e0a1..47345289 100644
--- a/.github/workflows/build-and-test-device.yaml
+++ b/.github/workflows/build-and-test-device.yaml
@@ -30,6 +30,9 @@ on:
- 'src/nanoarrow/**'
- 'extensions/nanoarrow_device/**'
+permissions:
+ contents: read
+
jobs:
test-c-device:
@@ -50,27 +53,12 @@ jobs:
NANOARROW_ARROW_TESTING_DIR: '${{ github.workspace }}/arrow-testing'
steps:
- - name: Checkout repo
- uses: actions/checkout@v3
- with:
- fetch-depth: 0
-
- - name: Checkout arrow-testing
- uses: actions/checkout@v3
- with:
- repository: apache/arrow-testing
- fetch-depth: 0
- path: arrow-testing
+ - uses: actions/checkout@v4
- - name: Install dependencies
+ - name: Install memcheck dependencies
+ if: matrix.config.label == 'default-build'
run: |
- sudo apt-get update
- sudo apt install -y -V ca-certificates lsb-release wget cmake
valgrind
- 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
- sudo apt-get install -y -V
./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb
- sudo apt-get update
- sudo apt-get install -y -V libarrow-dev
- rm apache-arrow-apt-*.deb
+ sudo apt-get update && sudo apt-get install -y valgrind
- name: Build
run: |
diff --git a/.github/workflows/build-and-test-ipc.yaml
b/.github/workflows/build-and-test-ipc.yaml
index 25987b1c..9f823a1a 100644
--- a/.github/workflows/build-and-test-ipc.yaml
+++ b/.github/workflows/build-and-test-ipc.yaml
@@ -30,6 +30,9 @@ on:
- 'src/nanoarrow/**'
- 'extensions/nanoarrow_ipc/**'
+permissions:
+ contents: read
+
jobs:
test-c-ipc:
@@ -51,36 +54,46 @@ jobs:
NANOARROW_ARROW_TESTING_DIR: '${{ github.workspace }}/arrow-testing'
steps:
- - name: Checkout repo
- uses: actions/checkout@v3
- with:
- fetch-depth: 0
+ - uses: actions/checkout@v4
- name: Checkout arrow-testing
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
with:
repository: apache/arrow-testing
- fetch-depth: 0
path: arrow-testing
- - name: Install dependencies
+ - 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: |
- sudo apt-get update
- sudo apt install -y -V ca-certificates lsb-release wget cmake
valgrind
- 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
- sudo apt-get install -y -V
./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb
- sudo apt-get update
- sudo apt-get install -y -V libarrow-dev
- rm apache-arrow-apt-*.deb
+ 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 ${{
matrix.config.cmake_args }}
+
+ 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
diff --git a/.github/workflows/build-and-test.yaml
b/.github/workflows/build-and-test.yaml
index 673b2293..0191b97c 100644
--- a/.github/workflows/build-and-test.yaml
+++ b/.github/workflows/build-and-test.yaml
@@ -29,6 +29,9 @@ on:
- '.github/workflows/build-and-test.yaml'
- 'src/nanoarrow/**'
+permissions:
+ contents: read
+
jobs:
test-c:
@@ -49,24 +52,37 @@ jobs:
steps:
- uses: actions/checkout@v4
- - name: Install dependencies
+ - name: Install memcheck dependencies
+ if: matrix.config.label == 'default-build'
run: |
- sudo apt-get update
- sudo apt install -y -V ca-certificates lsb-release wget cmake
valgrind
- 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
- sudo apt-get install -y -V
./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb
- sudo apt-get update
- sudo apt-get install -y -V libarrow-dev
- rm apache-arrow-apt-*.deb
+ 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 nanoarrow
run: |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/dist/lib
sudo ldconfig
+
+ ARROW_PATH="$(pwd)/arrow"
mkdir build
cd build
+
cmake .. -DNANOARROW_BUILD_TESTS=ON
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
- ${{ matrix.config.cmake_args }}
+ -DCMAKE_PREFIX_PATH="${ARROW_PATH}" ${{ matrix.config.cmake_args }}
+
cmake --build .
- name: Check for non-namespaced symbols in namespaced build
diff --git a/ci/scripts/build-arrow-cpp-minimal.sh
b/ci/scripts/build-arrow-cpp-minimal.sh
new file mode 100755
index 00000000..826f7e57
--- /dev/null
+++ b/ci/scripts/build-arrow-cpp-minimal.sh
@@ -0,0 +1,67 @@
+#!/usr/bin/env bash
+#
+# 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.
+
+# Builds a minimal Arrow C++ version required for running nanoarrow tests
+
+set -e
+set -o pipefail
+
+case $# in
+ 2) ARROW_CPP_VERSION="$1"
+ ARROW_CPP_INSTALL_DIR="$2"
+ ;;
+ *) echo "Usage:"
+ echo " Build and install Arrow C++:"
+ echo " $0 <version> <install dir>"
+ exit 1
+ ;;
+esac
+
+# Allow other cmake (e.g., cmake3 on centos7)
+if [ -z "$CMAKE_BIN" ]; then
+ CMAKE_BIN=cmake
+fi
+
+# Ensure install directory exists and is absolute
+if [ ! -d "${ARROW_CPP_INSTALL_DIR}" ]; then
+ mkdir -p "${ARROW_CPP_INSTALL_DIR}"
+fi
+
+ARROW_CPP_INSTALL_DIR="$(cd "${ARROW_CPP_INSTALL_DIR}" && pwd)"
+
+ARROW_CPP_SCRATCH_DIR="arrow-cpp-build-${ARROW_CPP_VERSION}"
+
+mkdir "${ARROW_CPP_SCRATCH_DIR}"
+pushd "${ARROW_CPP_SCRATCH_DIR}"
+
+curl -L
"https://www.apache.org/dyn/closer.lua?action=download&filename=arrow/arrow-${ARROW_CPP_VERSION}/apache-arrow-${ARROW_CPP_VERSION}.tar.gz"
| \
+ tar -zxf -
+mkdir build && cd build
+cmake ../apache-arrow-${ARROW_CPP_VERSION}/cpp \
+ -DARROW_JEMALLOC=OFF \
+ -DARROW_SIMD_LEVEL=NONE \
+ -DARROW_FILESYSTEM=OFF \
+ -DCMAKE_INSTALL_PREFIX="${ARROW_CPP_INSTALL_DIR}"
+cmake --build . --parallel $(nproc)
+cmake --install . --prefix="${ARROW_CPP_INSTALL_DIR}"
+
+popd
+
+# On success, we can remove the build directory
+rm -rf "${ARROW_CPP_SCRATCH_DIR}"