You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by li...@apache.org on 2022/06/09 17:28:27 UTC
[arrow-adbc] branch main updated: Set up basic C++ CI pipeline (#11)
This is an automated email from the ASF dual-hosted git repository.
lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git
The following commit(s) were added to refs/heads/main by this push:
new 4af06e7 Set up basic C++ CI pipeline (#11)
4af06e7 is described below
commit 4af06e7e21f731677775a94fd0364b9fcd8e4f56
Author: David Li <li...@gmail.com>
AuthorDate: Thu Jun 9 13:28:23 2022 -0400
Set up basic C++ CI pipeline (#11)
Flight SQL is not included since the Arrow Conda packages do not include it.
---
.github/workflows/cpp.yml | 90 ++++++++++++++++++++++
adbc_driver_manager/CMakeLists.txt | 1 +
.../build_support/run-test.sh | 31 ++------
.../AdbcDefines.cmake => ci/conda_env_cpp.txt | 30 ++------
cmake_modules/AdbcDefines.cmake | 1 +
drivers/sqlite/CMakeLists.txt | 1 +
6 files changed, 107 insertions(+), 47 deletions(-)
diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml
new file mode 100644
index 0000000..b1871d2
--- /dev/null
+++ b/.github/workflows/cpp.yml
@@ -0,0 +1,90 @@
+# 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: C/C++
+
+on:
+ pull_request:
+ branches:
+ - main
+ paths:
+ - "adbc.h"
+ - "adbc_driver_manager/**"
+ - "drivers/**"
+ - ".github/workflows/cpp.yml"
+ push:
+ paths:
+ - "adbc.h"
+ - "adbc_driver_manager/**"
+ - "drivers/**"
+ - ".github/workflows/cpp.yml"
+
+concurrency:
+ group: ${{ github.repository }}-${{ github.ref }}-${{ github.workflow }}
+ cancel-in-progress: true
+
+jobs:
+ cpp-conda:
+ name: "Conda"
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+ persist-credentials: false
+ - name: Get Date
+ id: get-date
+ shell: bash
+ run: |
+ echo "::set-output name=today::$(/bin/date -u '+%Y%m%d')"
+ - name: Cache Conda
+ uses: actions/cache@v2
+ env:
+ # Increment this to reset cache manually
+ CACHE_NUMBER: 0
+ with:
+ path: ~/conda_pkgs_dir
+ key: conda-${{ runner.os }}-${{ steps.get-date.outputs.today }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/**') }}
+ - uses: conda-incubator/setup-miniconda@v2
+ with:
+ miniforge-variant: Mambaforge
+ miniforge-version: latest
+ use-mamba: true
+ # Required for caching
+ use-only-tar-bz2: true
+ - name: Install Dependencies
+ shell: bash -l {0}
+ run: |
+ mamba install --file ci/conda_env_cpp.txt
+ - name: Build/Test SQLite3 Driver
+ shell: bash -l {0}
+ run: |
+ mkdir -p build/driver_sqlite
+ pushd build/driver_sqlite
+ cmake ../../drivers/sqlite -DARROW_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=$CONDA_PREFIX
+ cmake --build .
+ ctest --output-on-failure
+ popd
+ - name: Build/Test Driver Manager
+ shell: bash -l {0}
+ run: |
+ mkdir -p build/driver_manager
+ pushd build/driver_manager
+ cmake ../../adbc_driver_manager -DARROW_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=$CONDA_PREFIX
+ cmake --build .
+ env LD_LIBRARY_PATH=../driver_sqlite ctest --output-on-failure
+ popd
diff --git a/adbc_driver_manager/CMakeLists.txt b/adbc_driver_manager/CMakeLists.txt
index dfeee14..2a1210c 100644
--- a/adbc_driver_manager/CMakeLists.txt
+++ b/adbc_driver_manager/CMakeLists.txt
@@ -26,6 +26,7 @@ include(DefineOptions)
project(adbc_driver_manager
VERSION "${ARROW_BASE_VERSION}"
LANGUAGES CXX)
+include(CTest)
add_arrow_lib(adbc_driver_manager SOURCES adbc_driver_manager.cc)
include_directories(SYSTEM ${REPOSITORY_ROOT})
diff --git a/cmake_modules/AdbcDefines.cmake b/ci/build_support/run-test.sh
old mode 100644
new mode 100755
similarity index 51%
copy from cmake_modules/AdbcDefines.cmake
copy to ci/build_support/run-test.sh
index b73463f..1de7e73
--- a/cmake_modules/AdbcDefines.cmake
+++ b/ci/build_support/run-test.sh
@@ -1,3 +1,4 @@
+#!/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
@@ -15,27 +16,11 @@
# specific language governing permissions and limitations
# under the License.
-# Common definitions for the CMake projects in this repository.
+main() {
+ local CMAKE_BINARY_DIR="$1"
+ local TEST_OR_BENCHMARK="$2"
+ local TEST_PATH="$3"
+ exec "${CMAKE_BINARY_DIR}/${TEST_PATH}"
+}
-enable_language(C)
-include(DefineOptions)
-
-set(ARROW_VERSION "9.0.0-SNAPSHOT")
-set(ARROW_BASE_VERSION "9.0.0")
-set(ARROW_VERSION_MAJOR "9")
-set(ARROW_VERSION_MINOR "0")
-set(ARROW_VERSION_PATCH "0")
-
-math(EXPR ARROW_SO_VERSION "${ARROW_VERSION_MAJOR} * 100 + ${ARROW_VERSION_MINOR}")
-set(ARROW_FULL_SO_VERSION "${ARROW_SO_VERSION}.${ARROW_VERSION_PATCH}.0")
-
-if(ARROW_DEPENDENCY_SOURCE STREQUAL "CONDA")
- message(STATUS "Adding \$CONDA_PREFIX to CMAKE_PREFIX_PATH")
- list(APPEND CMAKE_PREFIX_PATH "$ENV{CONDA_PREFIX}")
-endif()
-
-if(ARROW_BUILD_TESTS)
- add_custom_target(all-tests)
- find_package(GTest)
- set(ARROW_TEST_LINK_LIBS GTest::gtest_main GTest::gtest GTest::gmock)
-endif()
+main "$@"
diff --git a/cmake_modules/AdbcDefines.cmake b/ci/conda_env_cpp.txt
similarity index 51%
copy from cmake_modules/AdbcDefines.cmake
copy to ci/conda_env_cpp.txt
index b73463f..1c5f906 100644
--- a/cmake_modules/AdbcDefines.cmake
+++ b/ci/conda_env_cpp.txt
@@ -15,27 +15,9 @@
# specific language governing permissions and limitations
# under the License.
-# Common definitions for the CMake projects in this repository.
-
-enable_language(C)
-include(DefineOptions)
-
-set(ARROW_VERSION "9.0.0-SNAPSHOT")
-set(ARROW_BASE_VERSION "9.0.0")
-set(ARROW_VERSION_MAJOR "9")
-set(ARROW_VERSION_MINOR "0")
-set(ARROW_VERSION_PATCH "0")
-
-math(EXPR ARROW_SO_VERSION "${ARROW_VERSION_MAJOR} * 100 + ${ARROW_VERSION_MINOR}")
-set(ARROW_FULL_SO_VERSION "${ARROW_SO_VERSION}.${ARROW_VERSION_PATCH}.0")
-
-if(ARROW_DEPENDENCY_SOURCE STREQUAL "CONDA")
- message(STATUS "Adding \$CONDA_PREFIX to CMAKE_PREFIX_PATH")
- list(APPEND CMAKE_PREFIX_PATH "$ENV{CONDA_PREFIX}")
-endif()
-
-if(ARROW_BUILD_TESTS)
- add_custom_target(all-tests)
- find_package(GTest)
- set(ARROW_TEST_LINK_LIBS GTest::gtest_main GTest::gtest GTest::gmock)
-endif()
+arrow-cpp>=8.0.0
+cmake
+compilers
+gmock>=1.10.0
+gtest>=1.10.0
+ninja
diff --git a/cmake_modules/AdbcDefines.cmake b/cmake_modules/AdbcDefines.cmake
index b73463f..1b4a580 100644
--- a/cmake_modules/AdbcDefines.cmake
+++ b/cmake_modules/AdbcDefines.cmake
@@ -38,4 +38,5 @@ if(ARROW_BUILD_TESTS)
add_custom_target(all-tests)
find_package(GTest)
set(ARROW_TEST_LINK_LIBS GTest::gtest_main GTest::gtest GTest::gmock)
+ set(BUILD_SUPPORT_DIR "${REPOSITORY_ROOT}/ci/build_support")
endif()
diff --git a/drivers/sqlite/CMakeLists.txt b/drivers/sqlite/CMakeLists.txt
index 283aef0..f7335e7 100644
--- a/drivers/sqlite/CMakeLists.txt
+++ b/drivers/sqlite/CMakeLists.txt
@@ -24,6 +24,7 @@ include(BuildUtils)
project(adbc_driver_sqlite
VERSION "${ARROW_BASE_VERSION}"
LANGUAGES CXX)
+include(CTest)
find_package(Arrow REQUIRED)
find_package(SQLite3 REQUIRED)