Skip to content

Refactor/cpp client sdk #1

Refactor/cpp client sdk

Refactor/cpp client sdk #1

# Verify client-cpp builds from a minimal toolchain: CMake downloads third-party
# sources into third-party/<os>/ and compiles Thrift + iotdb_session without
# pre-installed Boost / flex / bison packages (except where the OS image lacks
# a working compiler or CMake).
name: C++ Client source build
on:
push:
branches:
- master
- "rc/*"
paths:
- "pom.xml"
- "iotdb-client/pom.xml"
- "iotdb-client/client-cpp/**"
- "iotdb-protocol/thrift-datanode/src/main/thrift/client.thrift"
- "iotdb-protocol/thrift-commons/src/main/thrift/common.thrift"
- ".github/workflows/client-cpp-source-build.yml"
pull_request:
branches:
- master
- "rc/*"
- "force_ci/**"
paths:
- "pom.xml"
- "iotdb-client/pom.xml"
- "iotdb-client/client-cpp/**"
- "iotdb-protocol/thrift-datanode/src/main/thrift/client.thrift"
- "iotdb-protocol/thrift-commons/src/main/thrift/common.thrift"
- ".github/workflows/client-cpp-source-build.yml"
workflow_dispatch:
concurrency:
group: client-cpp-source-build-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3
MAVEN_ARGS: --batch-mode --no-transfer-progress
jobs:
source-build:
name: Source build (${{ matrix.name }})
strategy:
fail-fast: false
matrix:
include:
- name: linux
runs-on: ubuntu-22.04
- name: macos
runs-on: macos-latest
- name: windows-vs2022
runs-on: windows-2022
cmake_generator: ""
- name: windows-vs2026
runs-on: windows-2025-vs2026
cmake_generator: Visual Studio 18 2026
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v5
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: "17"
- name: Install minimal toolchain (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
set -euxo pipefail
sudo apt-get update
# Compiler + CMake only; Boost/flex/bison/m4 come from CMake fetch.
sudo apt-get install -y build-essential cmake wget
- name: Install minimal toolchain (macOS)
if: runner.os == 'macOS'
shell: bash
run: |
set -euxo pipefail
# Xcode CLT ships bison 2.3 which cannot build Thrift 0.21.0 (%code).
brew install bison cmake
echo "$(brew --prefix bison)/bin" >> "$GITHUB_PATH"
bison --version
- name: Install minimal toolchain (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
# No choco boost / winflexbison: CMake downloads into third-party/windows/.
Write-Host "Using preinstalled VS + CMake on the runner image."
- name: Cache Maven packages
uses: actions/cache@v5
with:
path: ~/.m2
key: ${{ runner.os }}-${{ runner.arch }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-m2-
- name: Configure and build (CMake fetch, online)
shell: bash
env:
CMAKE_GENERATOR: ${{ matrix.cmake_generator }}
run: |
set -euxo pipefail
MVN_ARGS=(./mvnw clean package -P with-cpp -pl iotdb-client/client-cpp -am -DskipTests)
MVN_ARGS+=("-Diotdb.offline=OFF" "-Dspotless.skip=true")
if [ -n "${CMAKE_GENERATOR:-}" ]; then
MVN_ARGS+=("-Dcmake.generator=${CMAKE_GENERATOR}")
fi
"${MVN_ARGS[@]}"
- name: Verify install artifacts
shell: bash
run: |
set -euxo pipefail
INSTALL="iotdb-client/client-cpp/target/install"
if [ "${{ runner.os }}" = "Windows" ]; then
test -d "${INSTALL}/include"
ls "${INSTALL}/lib/iotdb_session.dll" "${INSTALL}/lib/iotdb_session.lib"
else
test -f "${INSTALL}/lib/libiotdb_session.so" \
|| test -f "${INSTALL}/lib/libiotdb_session.dylib"
fi
ls -la "${INSTALL}/include" | head -20