Skip to content

Commit a51ace8

Browse files
committed
fix(ci): upload cpp SDK tarball before packaged example smoke tests
Resolve and upload artifacts on macOS and Windows immediately after packaging so failed verify steps still retain the tarball; reuse pkg path in verify step.
1 parent 4edd844 commit a51ace8

1 file changed

Lines changed: 56 additions & 56 deletions

File tree

.github/workflows/client-cpp-package.yml

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -316,34 +316,6 @@ jobs:
316316
set -euxo pipefail
317317
./mvnw clean package -P with-cpp -pl iotdb-client/client-cpp -am -DskipTests \
318318
-Dspotless.skip=true
319-
- name: Verify packaged examples
320-
shell: bash
321-
run: |
322-
set -euxo pipefail
323-
PKG_TARBALL=$(find iotdb-client/client-cpp/target -maxdepth 1 -type f -name 'iotdb-session-cpp-*.tar.gz' -print -quit)
324-
test -n "${PKG_TARBALL}"
325-
PKG_UNPACK="${RUNNER_TEMP}/client-cpp-package"
326-
rm -rf "${PKG_UNPACK}"
327-
mkdir -p "${PKG_UNPACK}"
328-
tar -xzf "${PKG_TARBALL}" -C "${PKG_UNPACK}"
329-
PKG_ROOT=$(find "${PKG_UNPACK}" -mindepth 1 -maxdepth 1 -type d -name 'iotdb-session-cpp-*' -print -quit)
330-
test -n "${PKG_ROOT}"
331-
EXAMPLE_BUILD="${RUNNER_TEMP}/client-cpp-example-smoke"
332-
cmake -S "${PKG_ROOT}/examples" -B "${EXAMPLE_BUILD}" \
333-
-DCMAKE_BUILD_TYPE=Release \
334-
-DIOTDB_SDK_ROOT="${PKG_ROOT}"
335-
cmake --build "${EXAMPLE_BUILD}" -j"$(sysctl -n hw.ncpu)"
336-
./mvnw -pl distribution -am -DskipTests -Dspotless.skip=true package
337-
SERVER_ROOT=$(find "${GITHUB_WORKSPACE}/distribution/target" -path '*/apache-iotdb-*-all-bin/sbin/start-standalone.sh' -print -quit | sed 's#/sbin/start-standalone.sh##')
338-
test -n "${SERVER_ROOT}"
339-
"${SERVER_ROOT}/sbin/start-standalone.sh"
340-
trap '"${SERVER_ROOT}/sbin/stop-standalone.sh" || true' EXIT
341-
sleep 30
342-
"${EXAMPLE_BUILD}/SessionExample"
343-
"${EXAMPLE_BUILD}/AlignedTimeseriesSessionExample"
344-
"${EXAMPLE_BUILD}/TableModelSessionExample"
345-
"${EXAMPLE_BUILD}/tree_example"
346-
"${EXAMPLE_BUILD}/table_example"
347319
- name: Resolve package tarball
348320
id: pkg
349321
shell: bash
@@ -371,6 +343,34 @@ jobs:
371343
${{ steps.pkg.outputs.path }}
372344
${{ steps.pkg.outputs.sha512_path }}
373345
if-no-files-found: error
346+
- name: Verify packaged examples
347+
shell: bash
348+
run: |
349+
set -euxo pipefail
350+
PKG_TARBALL="${{ steps.pkg.outputs.path }}"
351+
test -n "${PKG_TARBALL}"
352+
PKG_UNPACK="${RUNNER_TEMP}/client-cpp-package"
353+
rm -rf "${PKG_UNPACK}"
354+
mkdir -p "${PKG_UNPACK}"
355+
tar -xzf "${PKG_TARBALL}" -C "${PKG_UNPACK}"
356+
PKG_ROOT=$(find "${PKG_UNPACK}" -mindepth 1 -maxdepth 1 -type d -name 'iotdb-session-cpp-*' -print -quit)
357+
test -n "${PKG_ROOT}"
358+
EXAMPLE_BUILD="${RUNNER_TEMP}/client-cpp-example-smoke"
359+
cmake -S "${PKG_ROOT}/examples" -B "${EXAMPLE_BUILD}" \
360+
-DCMAKE_BUILD_TYPE=Release \
361+
-DIOTDB_SDK_ROOT="${PKG_ROOT}"
362+
cmake --build "${EXAMPLE_BUILD}" -j"$(sysctl -n hw.ncpu)"
363+
./mvnw -pl distribution -am -DskipTests -Dspotless.skip=true package
364+
SERVER_ROOT=$(find "${GITHUB_WORKSPACE}/distribution/target" -path '*/apache-iotdb-*-all-bin/sbin/start-standalone.sh' -print -quit | sed 's#/sbin/start-standalone.sh##')
365+
test -n "${SERVER_ROOT}"
366+
"${SERVER_ROOT}/sbin/start-standalone.sh"
367+
trap '"${SERVER_ROOT}/sbin/stop-standalone.sh" || true' EXIT
368+
sleep 30
369+
"${EXAMPLE_BUILD}/SessionExample"
370+
"${EXAMPLE_BUILD}/AlignedTimeseriesSessionExample"
371+
"${EXAMPLE_BUILD}/TableModelSessionExample"
372+
"${EXAMPLE_BUILD}/tree_example"
373+
"${EXAMPLE_BUILD}/table_example"
374374
375375
package-windows:
376376
name: Package (${{ matrix.name }})
@@ -455,13 +455,40 @@ jobs:
455455
throw "Expected PE32+ x64 (machine=0x8664), got 0x$($machine.ToString('X4'))"
456456
}
457457
Write-Host "Verified x64 DLL: $dll"
458+
- name: Resolve package tarball
459+
id: pkg
460+
shell: bash
461+
run: |
462+
set -euo pipefail
463+
shopt -s nullglob
464+
packages=(iotdb-client/client-cpp/target/iotdb-session-cpp-*-${{ matrix.package_classifier }}.tar.gz)
465+
if [ "${#packages[@]}" -ne 1 ]; then
466+
echo "Expected exactly one package tarball, got: ${packages[*]:-(none)}"
467+
exit 1
468+
fi
469+
echo "path=${packages[0]}" >> "$GITHUB_OUTPUT"
470+
echo "name=$(basename "${packages[0]}" .tar.gz)" >> "$GITHUB_OUTPUT"
471+
sha512="${packages[0]}.sha512"
472+
if [ ! -f "${sha512}" ]; then
473+
echo "Expected checksum file: ${sha512}"
474+
exit 1
475+
fi
476+
echo "sha512_path=${sha512}" >> "$GITHUB_OUTPUT"
477+
- name: Upload tarball artifact
478+
uses: actions/upload-artifact@v6
479+
with:
480+
name: ${{ steps.pkg.outputs.name }}
481+
path: |
482+
${{ steps.pkg.outputs.path }}
483+
${{ steps.pkg.outputs.sha512_path }}
484+
if-no-files-found: error
458485
- name: Verify packaged examples
459486
shell: bash
460487
env:
461488
CMAKE_GENERATOR: ${{ matrix.cmake_generator }}
462489
run: |
463490
set -euxo pipefail
464-
PKG_TARBALL=$(find iotdb-client/client-cpp/target -maxdepth 1 -type f -name 'iotdb-session-cpp-*.tar.gz' -print -quit)
491+
PKG_TARBALL="${{ steps.pkg.outputs.path }}"
465492
test -n "${PKG_TARBALL}"
466493
if [ "${RUNNER_OS}" = "Windows" ]; then
467494
TEMP_BASE="$(cygpath -u "${RUNNER_TEMP}")"
@@ -514,30 +541,3 @@ jobs:
514541
test -n "${EXE}"
515542
"${EXE}"
516543
done
517-
- name: Resolve package tarball
518-
id: pkg
519-
shell: bash
520-
run: |
521-
set -euo pipefail
522-
shopt -s nullglob
523-
packages=(iotdb-client/client-cpp/target/iotdb-session-cpp-*-${{ matrix.package_classifier }}.tar.gz)
524-
if [ "${#packages[@]}" -ne 1 ]; then
525-
echo "Expected exactly one package tarball, got: ${packages[*]:-(none)}"
526-
exit 1
527-
fi
528-
echo "path=${packages[0]}" >> "$GITHUB_OUTPUT"
529-
echo "name=$(basename "${packages[0]}" .tar.gz)" >> "$GITHUB_OUTPUT"
530-
sha512="${packages[0]}.sha512"
531-
if [ ! -f "${sha512}" ]; then
532-
echo "Expected checksum file: ${sha512}"
533-
exit 1
534-
fi
535-
echo "sha512_path=${sha512}" >> "$GITHUB_OUTPUT"
536-
- name: Upload tarball artifact
537-
uses: actions/upload-artifact@v6
538-
with:
539-
name: ${{ steps.pkg.outputs.name }}
540-
path: |
541-
${{ steps.pkg.outputs.path }}
542-
${{ steps.pkg.outputs.sha512_path }}
543-
if-no-files-found: error

0 commit comments

Comments
 (0)