Skip to content

Commit d142b75

Browse files
authored
CI: Add GitHub Actions workflow to package C++ client binaries (#17528)
* add cpp client package ci * fix ci * remove vs2019 cpp client package * arm ubuntu22.04
1 parent f5d26af commit d142b75

1 file changed

Lines changed: 226 additions & 0 deletions

File tree

Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
# Manual run; Release published; v* tag pushes; rc/** pushes only when C++-related paths change
2+
# (job should-package). release events use the workflow file from the default branch.
3+
name: C++ Client package
4+
5+
on:
6+
workflow_dispatch:
7+
release:
8+
types: [published]
9+
push:
10+
branches:
11+
- "rc/**"
12+
tags:
13+
- "v*"
14+
15+
concurrency:
16+
group: client-cpp-package-${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
env:
20+
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3
21+
MAVEN_ARGS: --batch-mode --no-transfer-progress
22+
23+
jobs:
24+
should-package:
25+
runs-on: ubuntu-latest
26+
outputs:
27+
run: ${{ steps.result.outputs.run }}
28+
steps:
29+
- uses: actions/checkout@v5
30+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/rc/')
31+
- uses: dorny/paths-filter@v3
32+
id: filter
33+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/rc/')
34+
with:
35+
filters: |
36+
cpp:
37+
- 'pom.xml'
38+
- 'iotdb-client/**'
39+
- 'iotdb-protocol/**'
40+
- '.github/workflows/client-cpp-package.yml'
41+
- id: result
42+
shell: bash
43+
run: |
44+
set -euo pipefail
45+
E="${{ github.event_name }}"
46+
R="${{ github.ref }}"
47+
if [[ "$E" == "workflow_dispatch" ]] || [[ "$E" == "release" ]]; then
48+
echo "run=true" >> "$GITHUB_OUTPUT"
49+
exit 0
50+
fi
51+
if [[ "$E" == "push" ]] && [[ "$R" == refs/tags/v* ]]; then
52+
echo "run=true" >> "$GITHUB_OUTPUT"
53+
exit 0
54+
fi
55+
if [[ "$E" == "push" ]] && [[ "$R" =~ ^refs/heads/rc/ ]]; then
56+
if [[ "${{ steps.filter.outputs.cpp }}" == "true" ]]; then
57+
echo "run=true" >> "$GITHUB_OUTPUT"
58+
else
59+
echo "run=false" >> "$GITHUB_OUTPUT"
60+
fi
61+
exit 0
62+
fi
63+
echo "run=false" >> "$GITHUB_OUTPUT"
64+
65+
package-linux:
66+
name: Package (${{ matrix.name }})
67+
needs: should-package
68+
if: needs.should-package.outputs.run == 'true'
69+
strategy:
70+
fail-fast: false
71+
matrix:
72+
include:
73+
- name: linux-x86_64
74+
runs-on: ubuntu-22.04
75+
- name: linux-aarch64
76+
runs-on: ubuntu-22.04-arm
77+
runs-on: ${{ matrix.runs-on }}
78+
steps:
79+
- uses: actions/checkout@v5
80+
- name: Set up JDK 17
81+
uses: actions/setup-java@v5
82+
with:
83+
distribution: temurin
84+
java-version: "17"
85+
- name: Install C++ dependencies (Linux)
86+
shell: bash
87+
run: |
88+
set -euxo pipefail
89+
sudo apt-get update
90+
sudo apt-get install -y libboost-all-dev openssl libssl-dev
91+
- name: Cache Maven packages
92+
uses: actions/cache@v5
93+
with:
94+
path: ~/.m2
95+
key: ${{ runner.os }}-${{ runner.arch }}-m2-${{ hashFiles('**/pom.xml') }}
96+
restore-keys: |
97+
${{ runner.os }}-${{ runner.arch }}-m2-
98+
- name: Package client-cpp
99+
shell: bash
100+
run: |
101+
set -euxo pipefail
102+
./mvnw clean package -P with-cpp -pl iotdb-client/client-cpp -am \
103+
-DskipTests \
104+
-Dspotless.check.skip=true -Dspotless.apply.skip=true
105+
- name: Upload zip artifact
106+
uses: actions/upload-artifact@v6
107+
with:
108+
name: client-cpp-${{ matrix.name }}
109+
path: iotdb-client/client-cpp/target/client-cpp-*-cpp-*.zip
110+
if-no-files-found: error
111+
112+
package-macos:
113+
name: Package (${{ matrix.name }})
114+
needs: should-package
115+
if: needs.should-package.outputs.run == 'true'
116+
strategy:
117+
fail-fast: false
118+
matrix:
119+
include:
120+
- name: macos-x86_64
121+
runs-on: macos-15-intel
122+
- name: macos-arm64
123+
runs-on: macos-latest
124+
runs-on: ${{ matrix.runs-on }}
125+
steps:
126+
- uses: actions/checkout@v5
127+
- name: Set up JDK 17
128+
uses: actions/setup-java@v5
129+
with:
130+
distribution: temurin
131+
java-version: "17"
132+
- name: Install C++ dependencies (macOS)
133+
shell: bash
134+
run: |
135+
set -euxo pipefail
136+
brew install boost openssl
137+
- name: Cache Maven packages
138+
uses: actions/cache@v5
139+
with:
140+
path: ~/.m2
141+
key: ${{ runner.os }}-${{ runner.arch }}-m2-${{ hashFiles('**/pom.xml') }}
142+
restore-keys: |
143+
${{ runner.os }}-${{ runner.arch }}-m2-
144+
- name: Package client-cpp
145+
shell: bash
146+
env:
147+
MACOSX_DEPLOYMENT_TARGET: "12.0"
148+
run: |
149+
set -euxo pipefail
150+
./mvnw clean package -P with-cpp -pl iotdb-client/client-cpp -am \
151+
-DskipTests \
152+
-Dspotless.check.skip=true -Dspotless.apply.skip=true
153+
- name: Upload zip artifact
154+
uses: actions/upload-artifact@v6
155+
with:
156+
name: client-cpp-${{ matrix.name }}
157+
path: iotdb-client/client-cpp/target/client-cpp-*-cpp-*.zip
158+
if-no-files-found: error
159+
160+
package-windows:
161+
name: Package (${{ matrix.name }})
162+
needs: should-package
163+
if: needs.should-package.outputs.run == 'true'
164+
strategy:
165+
fail-fast: false
166+
matrix:
167+
include:
168+
- name: windows-vs2022
169+
runs-on: windows-2022
170+
boost_choco: boost-msvc-14.3
171+
cmake_generator: ""
172+
iotdb_tools_thrift_version: ""
173+
- name: windows-vs2026
174+
runs-on: windows-2025-vs2026
175+
boost_choco: boost-msvc-14.3
176+
cmake_generator: Visual Studio 18 2026
177+
iotdb_tools_thrift_version: ""
178+
runs-on: ${{ matrix.runs-on }}
179+
steps:
180+
- uses: actions/checkout@v5
181+
- name: Set up JDK 17
182+
uses: actions/setup-java@v5
183+
with:
184+
distribution: temurin
185+
java-version: "17"
186+
- name: Install C++ dependencies (Windows)
187+
shell: pwsh
188+
run: |
189+
choco install winflexbison3 -y
190+
choco install ${{ matrix.boost_choco }} -y
191+
$boost_path = (Get-ChildItem -Path 'C:\local\' -Filter 'boost_*').FullName
192+
echo $boost_path >> $env:GITHUB_PATH
193+
choco install openssl -y
194+
$sslPath = (Get-ChildItem 'C:\Program Files\OpenSSL*' -Directory | Select-Object -First 1).FullName
195+
echo "$sslPath\bin" >> $env:GITHUB_PATH
196+
echo "OPENSSL_ROOT_DIR=$sslPath" >> $env:GITHUB_ENV
197+
- name: Cache Maven packages
198+
uses: actions/cache@v5
199+
with:
200+
path: ~/.m2
201+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
202+
restore-keys: |
203+
${{ runner.os }}-m2-
204+
- name: Package client-cpp
205+
shell: bash
206+
env:
207+
CMAKE_GENERATOR: ${{ matrix.cmake_generator }}
208+
IOTDB_TOOLS_THRIFT_VERSION: ${{ matrix.iotdb_tools_thrift_version }}
209+
run: |
210+
set -euxo pipefail
211+
MVN_ARGS=(./mvnw clean package -P with-cpp -pl iotdb-client/client-cpp -am \
212+
-DskipTests \
213+
-Dspotless.check.skip=true -Dspotless.apply.skip=true)
214+
if [ -n "${CMAKE_GENERATOR:-}" ]; then
215+
MVN_ARGS+=("-Dcmake.generator=${CMAKE_GENERATOR}")
216+
fi
217+
if [ -n "${IOTDB_TOOLS_THRIFT_VERSION:-}" ]; then
218+
MVN_ARGS+=("-Diotdb-tools-thrift.version=${IOTDB_TOOLS_THRIFT_VERSION}")
219+
fi
220+
"${MVN_ARGS[@]}"
221+
- name: Upload zip artifact
222+
uses: actions/upload-artifact@v6
223+
with:
224+
name: client-cpp-${{ matrix.name }}
225+
path: iotdb-client/client-cpp/target/client-cpp-*-cpp-*.zip
226+
if-no-files-found: error

0 commit comments

Comments
 (0)