This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
The following commit(s) were added to refs/heads/main by this push:
new 691ca53f4 ci(bindings/cpp): add ci for test and doc (#2998)
691ca53f4 is described below
commit 691ca53f415558584608084afbd900f41c6bab0d
Author: Mingzhuo Yin <[email protected]>
AuthorDate: Fri Sep 1 13:33:45 2023 +0800
ci(bindings/cpp): add ci for test and doc (#2998)
* ci(bindings/cpp): add ci for test and doc
Signed-off-by: silver-ymz <[email protected]>
* show ci test result in terminal
Signed-off-by: silver-ymz <[email protected]>
* install libgtest in docs ci
Signed-off-by: silver-ymz <[email protected]>
---------
Signed-off-by: silver-ymz <[email protected]>
---
.github/workflows/bindings_cpp.yml | 69 ++++++++++++++++++++++++++++++++++++++
.github/workflows/docs.yml | 40 ++++++++++++++++++++++
bindings/cpp/CMakeLists.txt | 7 +++-
website/docusaurus.config.js | 4 +++
4 files changed, 119 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/bindings_cpp.yml
b/.github/workflows/bindings_cpp.yml
new file mode 100644
index 000000000..03cad7633
--- /dev/null
+++ b/.github/workflows/bindings_cpp.yml
@@ -0,0 +1,69 @@
+# 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: Bindings Cpp CI
+
+on:
+ push:
+ branches:
+ - main
+ tags:
+ - '*'
+ pull_request:
+ branches:
+ - main
+ paths:
+ - "bindings/cpp/**"
+ - ".github/workflows/bindings_cpp.yml"
+ workflow_dispatch:
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
+ cancel-in-progress: true
+
+permissions:
+ contents: read
+
+jobs:
+ test:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ - name: Install dependencies
+ run: |
+ sudo apt-get install libgtest-dev ninja-build
+ cd /usr/src/gtest
+ sudo cmake CMakeLists.txt
+ sudo make
+ sudo cp lib/*.a /usr/lib
+ sudo ln -s /usr/lib/libgtest.a /usr/local/lib/libgtest.a
+ sudo ln -s /usr/lib/libgtest_main.a /usr/local/lib/libgtest_main.a
+
+ - name: Setup Rust toolchain
+ uses: ./.github/actions/setup
+
+ - name: Build Cpp binding
+ working-directory: "bindings/cpp"
+ run: |
+ mkdir build
+ cd build
+ cmake -GNinja ..
+ ninja
+
+ - name: Run tests
+ working-directory: "bindings/cpp/build"
+ run: ./opendal_cpp_test
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index b1e90eec2..35765dcaa 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -221,6 +221,39 @@ jobs:
name: haskell-docs
path: ./bindings/haskell/doc/
+ build-cpp-doc:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Setup Rust toolchain
+ uses: ./.github/actions/setup
+
+ - name: Install dependencies
+ run: |
+ sudo apt-get install doxygen graphviz ninja-build libgtest-dev
+ cd /usr/src/gtest
+ sudo cmake CMakeLists.txt
+ sudo make
+ sudo cp lib/*.a /usr/lib
+ sudo ln -s /usr/lib/libgtest.a /usr/local/lib/libgtest.a
+ sudo ln -s /usr/lib/libgtest_main.a /usr/local/lib/libgtest_main.a
+
+ - name: Build Cpp docs
+ working-directory: "bindings/cpp"
+ run: |
+ mkdir build
+ cd build
+ cmake -GNinja ..
+ ninja docs
+
+ - name: Upload docs
+ uses: actions/upload-artifact@v3
+ with:
+ name: cpp-docs
+ path: ./bindings/cpp/build/docs_doxygen/html
+
build-website:
runs-on: ubuntu-latest
needs:
@@ -231,6 +264,7 @@ jobs:
- build-c-doc
- build-lua-doc
- build-haskell-doc
+ - build-cpp-doc
steps:
- uses: actions/checkout@v3
@@ -287,6 +321,12 @@ jobs:
name: haskell-docs
path: ./website/static/docs/haskell
+ - name: Download cpp docs
+ uses: actions/download-artifact@v3
+ with:
+ name: cpp-docs
+ path: ./website/static/docs/cpp
+
- name: Install Dependencies
working-directory: website
run: yarn install --immutable
diff --git a/bindings/cpp/CMakeLists.txt b/bindings/cpp/CMakeLists.txt
index adf4a5b53..ebffe0d5a 100644
--- a/bindings/cpp/CMakeLists.txt
+++ b/bindings/cpp/CMakeLists.txt
@@ -21,8 +21,13 @@ project(opendal-cpp CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
+if (NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE Debug)
+endif()
+
+# cargo target dir must be absolute, otherwise some build target cannot find it
+get_filename_component(CARGO_TARGET_DIR ${CMAKE_SOURCE_DIR}/../../target
ABSOLUTE)
set(CARGO_MANIFEST ${CMAKE_SOURCE_DIR}/Cargo.toml)
-set(CARGO_TARGET_DIR ${CMAKE_SOURCE_DIR}/../../target)
set(RUST_SOURCE_FILE ${CMAKE_SOURCE_DIR}/src/lib.rs)
set(RUST_BRIDGE_CPP ${CARGO_TARGET_DIR}/cxxbridge/opendal-cpp/src/lib.rs.cc)
set(RUST_LIB
${CARGO_TARGET_DIR}/debug/${CMAKE_STATIC_LIBRARY_PREFIX}opendal_cpp${CMAKE_STATIC_LIBRARY_SUFFIX})
diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js
index 526cae230..71e3431ef 100644
--- a/website/docusaurus.config.js
+++ b/website/docusaurus.config.js
@@ -136,6 +136,10 @@ const config = {
{
label: 'Haskell Binding',
to: 'pathname:///docs/haskell/'
+ },
+ {
+ label: 'C++ Binding',
+ to: 'pathname:///docs/cpp/'
}
]
},