Skip to content

Commit 0284683

Browse files
authored
fix: make release script more robust (#717)
1 parent 3fd8a49 commit 0284683

5 files changed

Lines changed: 80 additions & 30 deletions

File tree

ci/scripts/build_example.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ set -eux
2121

2222
source_dir=${1}
2323
build_dir=${1}/build
24+
run_example=${ICEBERG_RUN_EXAMPLE:-OFF}
2425

2526
mkdir ${build_dir}
2627
pushd ${build_dir}
@@ -44,8 +45,18 @@ fi
4445
cmake "${CMAKE_ARGS[@]}" ${source_dir}
4546
if is_windows; then
4647
cmake --build . --config Release
48+
if [[ "${run_example}" == "ON" ]]; then
49+
if [[ -x ./demo_example.exe ]]; then
50+
./demo_example.exe
51+
else
52+
./Release/demo_example.exe
53+
fi
54+
fi
4755
else
4856
cmake --build .
57+
if [[ "${run_example}" == "ON" ]]; then
58+
./demo_example
59+
fi
4960
fi
5061

5162
popd

ci/scripts/build_iceberg.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ build_dir=${1}/build
2626
build_rest_integration_test=${2:-OFF}
2727
build_enable_sccache=${3:-OFF}
2828
build_enable_s3=${4:-OFF}
29+
run_tests=${ICEBERG_RUN_TESTS:-ON}
2930

3031
mkdir ${build_dir}
3132
pushd ${build_dir}
@@ -60,13 +61,22 @@ if [[ "${build_enable_sccache}" == "ON" ]]; then
6061
CMAKE_ARGS+=("-DCMAKE_C_COMPILER_LAUNCHER=sccache")
6162
fi
6263

64+
if [[ -n "${ICEBERG_EXTRA_CMAKE_ARGS:-}" ]]; then
65+
read -r -a EXTRA_CMAKE_ARGS <<< "${ICEBERG_EXTRA_CMAKE_ARGS}"
66+
CMAKE_ARGS+=("${EXTRA_CMAKE_ARGS[@]}")
67+
fi
68+
6369
cmake "${CMAKE_ARGS[@]}" ${source_dir}
6470
if is_windows; then
6571
cmake --build . --config Release --target install
66-
ctest --output-on-failure -C Release
72+
if [[ "${run_tests}" == "ON" ]]; then
73+
ctest --output-on-failure -C Release
74+
fi
6775
else
6876
cmake --build . --target install
69-
ctest --output-on-failure
77+
if [[ "${run_tests}" == "ON" ]]; then
78+
ctest --output-on-failure
79+
fi
7080
fi
7181

7282
popd

cmake_modules/IcebergThirdpartyToolchain.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,13 +464,18 @@ function(resolve_cpr_dependency)
464464
set(CPR_ENABLE_CURL_HTTP_ONLY ON)
465465
set(CPR_ENABLE_SSL ON)
466466
set(CPR_USE_SYSTEM_CURL ON)
467+
set(CPR_USE_EXISTING_CURL_TARGET ON)
467468

468469
if(DEFINED ENV{ICEBERG_CPR_URL})
469470
set(CPR_URL "$ENV{ICEBERG_CPR_URL}")
470471
else()
471472
set(CPR_URL "https://github.com/libcpr/cpr/archive/refs/tags/1.14.1.tar.gz")
472473
endif()
473474

475+
if(NOT TARGET CURL::libcurl)
476+
find_package(CURL REQUIRED)
477+
endif()
478+
474479
fetchcontent_declare(cpr
475480
${FC_DECLARE_COMMON_OPTIONS}
476481
URL ${CPR_URL}

dev/release/release_rc.sh

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ rc=$2
4444
: "${RELEASE_PUSH_TAG:=${RELEASE_DEFAULT}}"
4545
: "${RELEASE_SIGN:=${RELEASE_DEFAULT}}"
4646
: "${RELEASE_UPLOAD:=${RELEASE_DEFAULT}}"
47-
: "${RELEASE_WATCH:=${RELEASE_DEFAULT}}"
4847
: "${RELEASE_WATCH_INTERVAL:=30}"
4948

5049
cd "${SOURCE_TOP_DIR}"
@@ -83,6 +82,9 @@ if [ "${RELEASE_SIGN}" -gt 0 ]; then
8382
repository="${repository%.git}"
8483

8584
echo "Looking for GitHub Actions workflow on ${repository}:${rc_tag}"
85+
# If this script is interrupted or times out after the RC tag is pushed,
86+
# resume from the existing GitHub Actions run without creating the tag again:
87+
# RELEASE_PULL=0 RELEASE_PUSH_TAG=0 RELEASE_RUN_ID=<run_id> ./dev/release/release_rc.sh <version> <rc>
8688
run_id="${RELEASE_RUN_ID:-}"
8789
while [ -z "${run_id}" ]; do
8890
echo "Waiting for run to start..."
@@ -95,33 +97,29 @@ if [ "${RELEASE_SIGN}" -gt 0 ]; then
9597
done
9698

9799
echo "Found GitHub Actions workflow with ID: ${run_id}"
98-
if [ "${RELEASE_WATCH}" -gt 0 ]; then
99-
gh run watch --repo "${repository}" --exit-status "${run_id}"
100-
else
101-
while true; do
102-
run_status=$(gh run view \
103-
--repo "${repository}" \
104-
--json 'status,conclusion' \
105-
--jq '.status + " " + (.conclusion // "")' \
106-
"${run_id}")
107-
echo "$(date -u '+%Y-%m-%dT%H:%M:%SZ') GitHub Actions workflow status: ${run_status}"
108-
gh run view \
109-
--repo "${repository}" \
110-
--json jobs \
111-
--jq '.jobs[] | " " + .name + ": " + .status + " " + (.conclusion // "")' \
112-
"${run_id}"
113-
case "${run_status}" in
114-
"completed success")
115-
break
116-
;;
117-
completed\ *)
118-
echo "GitHub Actions workflow did not complete successfully: ${run_status}"
119-
exit 1
120-
;;
121-
esac
122-
sleep "${RELEASE_WATCH_INTERVAL}"
123-
done
124-
fi
100+
while true; do
101+
run_status=$(gh run view \
102+
--repo "${repository}" \
103+
--json 'status,conclusion' \
104+
--jq '.status + " " + (.conclusion // "")' \
105+
"${run_id}")
106+
echo "$(date -u '+%Y-%m-%dT%H:%M:%SZ') GitHub Actions workflow status: ${run_status}"
107+
gh run view \
108+
--repo "${repository}" \
109+
--json jobs \
110+
--jq '.jobs[] | " " + .name + ": " + .status + " " + (.conclusion // "")' \
111+
"${run_id}"
112+
case "${run_status}" in
113+
"completed success")
114+
break
115+
;;
116+
completed\ *)
117+
echo "GitHub Actions workflow did not complete successfully: ${run_status}"
118+
exit 1
119+
;;
120+
esac
121+
sleep "${RELEASE_WATCH_INTERVAL}"
122+
done
125123

126124
mkdir -p "${rc_id}"
127125

dev/release/verify_rc.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ ARCHIVE_BASE_NAME="apache-iceberg-cpp-${VERSION}"
4848
: "${VERIFY_DEFAULT:=1}"
4949
: "${VERIFY_DOWNLOAD:=${VERIFY_DEFAULT}}"
5050
: "${VERIFY_SIGN:=${VERIFY_DEFAULT}}"
51+
: "${VERIFY_REST:=${VERIFY_DEFAULT}}"
52+
: "${VERIFY_SQL:=0}"
53+
: "${VERIFY_INSTALL_SMOKE:=0}"
5154

5255
VERIFY_SUCCESS=no
5356

@@ -116,12 +119,27 @@ ensure_source_directory() {
116119
test_source_distribution() {
117120
echo "Building and testing Apache Iceberg C++..."
118121

122+
if [ "${VERIFY_REST}" -gt 0 ]; then
123+
verify_rest=ON
124+
else
125+
verify_rest=OFF
126+
fi
127+
128+
if [ "${VERIFY_SQL}" -gt 0 ]; then
129+
verify_sql=ON
130+
else
131+
verify_sql=OFF
132+
fi
133+
119134
# Configure build
120135
cmake -S . -B build \
121136
-DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations" \
122137
-DCMAKE_BUILD_TYPE=Release \
123138
-DICEBERG_BUILD_STATIC=ON \
124139
-DICEBERG_BUILD_SHARED=ON \
140+
-DICEBERG_BUILD_REST="${verify_rest}" \
141+
-DICEBERG_BUILD_SQL_CATALOG="${verify_sql}" \
142+
-DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=NEVER \
125143
--compile-no-warning-as-error
126144

127145
# Build
@@ -134,6 +152,14 @@ test_source_distribution() {
134152
mkdir -p ./install_test
135153
cmake --install build --prefix ./install_test
136154

155+
if [ "${VERIFY_INSTALL_SMOKE}" -gt 0 ]; then
156+
cmake -S example -B example_build \
157+
-DCMAKE_PREFIX_PATH="${PWD}/install_test" \
158+
-DCMAKE_BUILD_TYPE=Release
159+
cmake --build example_build --parallel $(nproc || sysctl -n hw.ncpu || echo 4)
160+
./example_build/demo_example
161+
fi
162+
137163
echo "Build, test and install completed successfully!"
138164
}
139165

0 commit comments

Comments
 (0)