This is an automated email from the ASF dual-hosted git repository. silver pushed a commit to branch cpp-ci in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
commit 3e5835130b2bde2789e33d2027ccc4d32316178b Author: silver-ymz <[email protected]> AuthorDate: Fri Sep 1 11:12:17 2023 +0800 ci(bindings/cpp): add ci for test and doc Signed-off-by: silver-ymz <[email protected]> --- .github/workflows/bindings_cpp.yml | 69 ++++++++++++++++++++++++++++++++++++++ .github/workflows/docs.yml | 33 ++++++++++++++++++ bindings/cpp/CMakeLists.txt | 7 +++- website/docusaurus.config.js | 4 +++ 4 files changed, 112 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bindings_cpp.yml b/.github/workflows/bindings_cpp.yml new file mode 100644 index 000000000..5ab29340b --- /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: ninja test diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 0494ce6af..fd18789d8 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -225,6 +225,32 @@ 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 + + - 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: @@ -235,6 +261,7 @@ jobs: - build-c-doc - build-lua-doc - build-haskell-doc + - build-cpp-doc steps: - uses: actions/checkout@v3 @@ -291,6 +318,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/' } ] },
