Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/script/seekdb/collect_result.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Collect result: read fail_cases.output and write seekdb_result.json.
# Usage: collect_result.sh <output_json_path>
# Required env: GITHUB_WORKSPACE, GITHUB_RUN_ID, SEEKDB_TASK_DIR
set -e

OUT_PATH="${1:-$GITHUB_WORKSPACE/seekdb_result.json}"
TASK_DIR="${SEEKDB_TASK_DIR:?}"
WORKSPACE="${GITHUB_WORKSPACE:-.}"

FAIL_FILE="$TASK_DIR/fail_cases.output"

failed_cases=()
if [[ -f "$FAIL_FILE" ]] && [[ -s "$FAIL_FILE" ]]; then
while IFS= read -r line; do
[[ -n "$line" ]] && failed_cases+=("$line")
done < "$FAIL_FILE"
fi

success="true"
[[ ${#failed_cases[@]} -gt 0 ]] && success="false"

# Build JSON (escape quotes in case names)
cs=""
for c in "${failed_cases[@]}"; do
esc="${c//\"/\\\"}"
[[ -n "$cs" ]] && cs="$cs,"
cs="$cs\"$esc\""
done
echo "{\"success\":$success,\"run_id\":\"${GITHUB_RUN_ID:-0}\",\"failed_cases\":[$cs]}" > "$OUT_PATH"

echo "[collect_result.sh] Result written to $OUT_PATH (success=$success, failed=${#failed_cases[@]})."c
63 changes: 63 additions & 0 deletions .github/script/seekdb/compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/usr/bin/env bash
# Compile: 步骤与 .github/workflows/buildbase 一致(init → build.sh $TARGET → cd build_* && make)。
# Required env: GITHUB_WORKSPACE, SEEKDB_TASK_DIR
# Optional: RELEASE_MODE, FORWARDING_HOST, MAKE, MAKE_ARGS
set -e

WORKSPACE="${GITHUB_WORKSPACE:?}"
TASK_DIR="${SEEKDB_TASK_DIR:?}"

# 调试:便于排查 k8s/container 下 No build.sh
echo "[compile.sh] WORKSPACE=$WORKSPACE"
echo "[compile.sh] pwd=$(pwd)"
ls -la "$WORKSPACE/" 2>/dev/null | head -20 || true
echo "[compile.sh] build.sh: -f=$([[ -f "$WORKSPACE/build.sh" ]] && echo 1 || echo 0) -x=$([[ -x "$WORKSPACE/build.sh" ]] && echo 1 || echo 0)"

export GITHUB_WORKSPACE="$WORKSPACE"
export SEEKDB_TASK_DIR="$TASK_DIR"
export PACKAGE_TYPE="${RELEASE_MODE:+release}"
export PACKAGE_TYPE="${PACKAGE_TYPE:-debug}"
export MAKE="${MAKE:-make}"
export MAKE_ARGS="${MAKE_ARGS:--j32}"
export PATH="$WORKSPACE/deps/3rd/usr/local/oceanbase/devtools/bin:$PATH"
[[ -n "$FORWARDING_HOST" ]] && echo "$FORWARDING_HOST mirrors.oceanbase.com" >> /etc/hosts 2>/dev/null || true

cd "$WORKSPACE"
mkdir -p "$TASK_DIR"

BUILD_TARGET="${PACKAGE_TYPE:-debug}"
BUILD_DIR="build_${BUILD_TARGET}"
compile_ret=0

# 存在即可(不要求 -x),用 bash 执行
if [[ ! -f "$WORKSPACE/build.sh" ]]; then
echo "[compile.sh] No build.sh at $WORKSPACE/build.sh, skip."
else
# Step 1: Build init(与 buildbase 一致,只传 init,先拉取/安装 deps 再才能用 cmake)
bash "$WORKSPACE/build.sh" init 2>&1 | tee "$TASK_DIR/compile_init.output"
[[ ${PIPESTATUS[0]} -ne 0 ]] && exit 1
bash "$WORKSPACE/build.sh" "$BUILD_TARGET" -DOB_USE_CCACHE=ON -DNEED_PARSER_CACHE=OFF 2>&1 | tee "$TASK_DIR/compile_configure.output"
[[ ${PIPESTATUS[0]} -ne 0 ]] && exit 1
set +e
command -v ccache >/dev/null 2>&1 && ccache -z || true
(cd "$WORKSPACE/$BUILD_DIR" && $MAKE $MAKE_ARGS observer) 2>&1 | tee "$TASK_DIR/compile.output"
compile_ret=${PIPESTATUS[0]}
command -v ccache >/dev/null 2>&1 && ccache -s || true
set -e
fi

# 产物落到 build_*,打包 observer/obproxy 为 zst 并拷贝到任务目录
for binary in observer obproxy; do
for base in . build_debug build_release build; do
if [[ -f "$WORKSPACE/$base/$binary" ]]; then
cp -f "$WORKSPACE/$base/$binary" "$WORKSPACE/$binary" 2>/dev/null || true
break
fi
done
if [[ -f "$WORKSPACE/$binary" ]]; then
command -v zstd >/dev/null 2>&1 && zstd -f "$WORKSPACE/$binary" || true
[[ -f "$WORKSPACE/$binary.zst" ]] && cp -f "$WORKSPACE/$binary.zst" "$TASK_DIR/" || true
fi
done

exit "$compile_ret"
29 changes: 29 additions & 0 deletions .github/script/seekdb/mysqltest_slice.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
# Run one mysqltest slice (slice index from SLICE_IDX).
# Required env: GITHUB_WORKSPACE, SEEKDB_TASK_DIR, SLICE_IDX, SLICES, BRANCH
# Optional: FORWARDING_HOST
set -e

WORKSPACE="${GITHUB_WORKSPACE:?}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SCRIPTS_DIR="$SCRIPT_DIR/scripts"

export GITHUB_WORKSPACE="$WORKSPACE"
export SEEKDB_TASK_DIR="${SEEKDB_TASK_DIR:?}"
export SLICE_IDX="${SLICE_IDX:-0}"
export SLICES="${SLICES:-4}"
export BRANCH="${BRANCH:-master}"


# Copy compile artifacts from task dir to workspace if running in container
for f in observer.zst obproxy.zst; do
if [[ -f "$SEEKDB_TASK_DIR/$f" ]] && [[ ! -f "$WORKSPACE/$f" ]]; then
cp -f "$SEEKDB_TASK_DIR/$f" "$WORKSPACE/" || true
fi
done

if [[ -f "$SCRIPTS_DIR/mysqltest_for_seekdb.sh" ]]; then
bash "$SCRIPTS_DIR/mysqltest_for_seekdb.sh" "$@"
else
echo "[mysqltest_slice.sh] No mysqltest_for_seekdb.sh, skip slice $SLICE_IDX."
fi
27 changes: 27 additions & 0 deletions .github/script/seekdb/prepare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
# Prepare: create task dir and generate jobargs.output / run_jobs.output
# Required env: GITHUB_WORKSPACE, GITHUB_RUN_ID, MYSQLTEST_SLICES, SEEKDB_TASK_DIR
set -e

WORKSPACE="${GITHUB_WORKSPACE:?}"
RUN_ID="${GITHUB_RUN_ID:?}"
SLICES="${MYSQLTEST_SLICES:-4}"
TASK_DIR="${SEEKDB_TASK_DIR:?}"

mkdir -p "$TASK_DIR"

# run_jobs.output: compile + N mysqltest slices (align with seekdb.groovy)
echo '++compile++' > "$TASK_DIR/run_jobs.output"
for i in $(seq 0 $((SLICES - 1))); do
echo "++mysqltest++${i}++" >> "$TASK_DIR/run_jobs.output"
done

# jobargs.output: build options (align with seekdb.groovy)
{
echo '++is_cmake++'
echo '++need_agentserver++0'
echo '++need_libobserver_so++0'
echo '++need_liboblog++0'
} > "$TASK_DIR/jobargs.output"

echo "[prepare.sh] SEEKDB_TASK_DIR=$TASK_DIR run_jobs and jobargs written."
13 changes: 13 additions & 0 deletions .github/script/seekdb/scripts/farm_compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
# Farm compile: build observer / obproxy in workspace.
# Expects: WORKSPACE, SEEKDB_TASK_DIR, PACKAGE_TYPE (debug|release), REPO=server
set -e

cd "$WORKSPACE"
# Use repo build.sh; debug or release from PACKAGE_TYPE
build_type="${PACKAGE_TYPE:-debug}"
if [[ -x "$WORKSPACE/build.sh" ]]; then
bash "$WORKSPACE/build.sh" "$build_type" --init --make
else
echo "[farm_compile.sh] No build.sh in $WORKSPACE, skip."
fi
Loading
Loading