mirror of
https://github.com/stablyai/orca.git
synced 2026-11-15 18:37:24 +00:00
chore(cloud): premerge re-runs itself from the merged worktree and lists the tests it selected
A branch cut before #437 ran its own old copy of premerge-check.sh (the integration merge only happened in the temp worktree), so #440's first gate selected 0 tests although the merged gate selects the parity test. The script now merges, then execs the merged copy; it also prints every targeted test file.
This commit is contained in:
@@ -5,17 +5,27 @@
|
||||
# pnpm typecheck, the full pnpm lint suite (pre-commit hooks only lint staged files), and vitest for the tests your
|
||||
# branch touched: changed *.test.ts(x), every test in the folder of each changed source, every test that imports a
|
||||
# changed module, and each touched cloud/apps/* package's own suite. PREMERGE_FULL=1 runs the whole vitest suite.
|
||||
# The merged copy of this script is what runs, so the gate is always integration's current one.
|
||||
# Prints "premerge OK" only when everything passes. Nothing here reads /tmp state. On macOS (no flock) wrap heavy runs
|
||||
# as /tmp/vdrv/heavy.sh 'config/scripts/cloud-integration/premerge-check.sh'.
|
||||
set -euo pipefail
|
||||
branch=$(git rev-parse --abbrev-ref HEAD)
|
||||
git fetch -q private +cloud/integration:refs/remotes/private/cloud/integration
|
||||
base=private/cloud/integration
|
||||
dir=$(mktemp -d "${TMPDIR:-/tmp}/cloud-premerge-XXXX")
|
||||
trap 'git worktree remove --force "$dir" >/dev/null 2>&1 || true' EXIT
|
||||
git worktree add -q --detach "$dir" HEAD
|
||||
if [[ -z "${PREMERGE_IN_WORKTREE:-}" ]]; then
|
||||
branch=$(git rev-parse --abbrev-ref HEAD)
|
||||
git fetch -q private +cloud/integration:refs/remotes/private/cloud/integration
|
||||
dir=$(mktemp -d "${TMPDIR:-/tmp}/cloud-premerge-XXXX")
|
||||
git worktree add -q --detach "$dir" HEAD
|
||||
if ! (cd "$dir" && git merge -q --no-edit "$base"); then
|
||||
git worktree remove --force "$dir" >/dev/null 2>&1 || true
|
||||
exit 1
|
||||
fi
|
||||
# Re-run the MERGED copy of this script, so a branch cut before a gate change still gets the current gate.
|
||||
exec env PREMERGE_IN_WORKTREE="$dir" PREMERGE_BRANCH="$branch" bash "$dir/config/scripts/cloud-integration/premerge-check.sh"
|
||||
fi
|
||||
dir=$PREMERGE_IN_WORKTREE
|
||||
branch=${PREMERGE_BRANCH:-unknown}
|
||||
trap 'git -C "$dir" worktree remove --force "$dir" >/dev/null 2>&1 || true' EXIT
|
||||
cd "$dir"
|
||||
git merge -q --no-edit "$base"
|
||||
pnpm install --frozen-lockfile >/dev/null
|
||||
pnpm typecheck
|
||||
pnpm lint
|
||||
@@ -47,6 +57,8 @@ else
|
||||
done < <(git diff --name-only --diff-filter=AMR "$base"...HEAD -- 'src/*')
|
||||
if ((${#tests[@]} > 0)); then
|
||||
tests=($(printf "%s\n" "${tests[@]}" | sort -u)) # repo paths have no spaces
|
||||
echo "premerge: ${#tests[@]} targeted test file(s):"
|
||||
printf " %s\n" "${tests[@]}"
|
||||
node config/scripts/workspace-package-build/build-workspace-packages.mjs >/dev/null
|
||||
node config/scripts/native-build/node-addons/ensure-native-runtime.mjs --runtime=node >/dev/null
|
||||
# run-vitest.mjs applies the repo's test env policy (e.g. ORCA_BACKGROUND_LAUNCH=1); bare vitest gives false failures.
|
||||
|
||||
Reference in New Issue
Block a user