mirror of
https://github.com/openclaw/openclaw.git
synced 2026-10-03 17:53:39 +00:00
dist/protocol.schema.json is gitignored and never committed, so the trailing `git diff --exit-code` guard in protocol:check exited 0 unconditionally. The Swift and Kotlin halves work because those files are tracked; the JSON half read as verification while it could not fail, leaving schema drift to the slow QA-lab scenario. scripts/prepush-ci.sh carried the same dead guard: its before/after diff covered only the untracked artifact and a file that protocol:check:swift never writes. The artifact is a build output with no committed baseline, so it gets a contract check instead of a diff. scripts/lib/protocol-schema-document.mts owns the published document; protocol-gen builds through it, asserts required frame definitions, frame ordering, discriminator mapping, and a non-empty method catalog before writing through the shared generated-output helper. The QA-lab verifier drops its duplicate envelope copy and compares the packed tarball against that same owner. The generated artifact is byte-identical to before.
95 lines
2.6 KiB
Bash
95 lines
2.6 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
|
|
cd "$ROOT_DIR"
|
|
|
|
log_step() {
|
|
printf '\n==> %s\n' "$*"
|
|
}
|
|
|
|
run_step() {
|
|
log_step "$*"
|
|
"$@"
|
|
}
|
|
|
|
has_native_swift_changes() {
|
|
local native_paths=(
|
|
apps/macos
|
|
apps/macos-mlx-tts
|
|
apps/ios
|
|
apps/shared/OpenClawKit
|
|
apps/swabble
|
|
config/swiftformat
|
|
config/swiftlint.yml
|
|
scripts/check-swift-tools.sh
|
|
scripts/format-swift.sh
|
|
scripts/install-swift-tools.sh
|
|
scripts/install-xcodegen.sh
|
|
scripts/ios-write-swift-filelist.mjs
|
|
scripts/ios-write-swift-filelist.mts
|
|
scripts/lint-swift.sh
|
|
scripts/test-macos-native.mts
|
|
)
|
|
|
|
if git rev-parse --verify --quiet origin/main >/dev/null; then
|
|
if git diff --name-only --relative origin/main...HEAD -- "${native_paths[@]}" | rg -q .; then
|
|
return 0
|
|
fi
|
|
fi
|
|
|
|
if git rev-parse --verify --quiet HEAD^ >/dev/null; then
|
|
git diff --name-only --relative HEAD^..HEAD -- "${native_paths[@]}" | rg -q .
|
|
return $?
|
|
fi
|
|
|
|
git show --name-only --relative --pretty='' HEAD -- "${native_paths[@]}" | rg -q .
|
|
}
|
|
|
|
run_linux_ci_mirror() {
|
|
run_step pnpm check
|
|
run_step pnpm build:strict-smoke
|
|
run_step pnpm lint:ui:no-raw-window-open
|
|
run_step pnpm protocol:gen
|
|
run_step pnpm protocol:check:swift
|
|
run_step pnpm plugins:assets:build
|
|
run_step node scripts/run-vitest.mjs run --config test/vitest/vitest.extensions.config.ts --maxWorkers=1
|
|
run_step env CI=true node scripts/run-vitest.mjs run --config test/vitest/vitest.unit.config.ts --maxWorkers=1
|
|
|
|
log_step "OPENCLAW_VITEST_MAX_WORKERS=${OPENCLAW_VITEST_MAX_WORKERS:-1} NODE_OPTIONS=${NODE_OPTIONS:---max-old-space-size=6144} pnpm test"
|
|
OPENCLAW_VITEST_MAX_WORKERS="${OPENCLAW_VITEST_MAX_WORKERS:-1}" \
|
|
NODE_OPTIONS="${NODE_OPTIONS:---max-old-space-size=6144}" \
|
|
pnpm test
|
|
}
|
|
|
|
run_macos_ci_mirror() {
|
|
if [[ "${OPENCLAW_PREPUSH_SKIP_MACOS:-0}" == "1" ]]; then
|
|
log_step "Skipping macOS mirror because OPENCLAW_PREPUSH_SKIP_MACOS=1"
|
|
return 0
|
|
fi
|
|
|
|
if [[ "$(uname -s)" != "Darwin" ]]; then
|
|
log_step "Skipping macOS mirror on non-Darwin host"
|
|
return 0
|
|
fi
|
|
|
|
if ! has_native_swift_changes; then
|
|
log_step "Skipping macOS mirror because no native Swift paths changed"
|
|
return 0
|
|
fi
|
|
|
|
run_step pnpm lint:swift
|
|
run_step pnpm format:swift
|
|
run_step swift build --package-path apps/macos --configuration release
|
|
echo "Native tests were NOT run: use the disposable macos-swift GitHub CI job for this exact commit." >&2
|
|
echo "Local lint/build passed; prepush cannot certify the native suite on an operator desktop." >&2
|
|
return 1
|
|
}
|
|
|
|
main() {
|
|
run_linux_ci_mirror
|
|
run_macos_ci_mirror
|
|
}
|
|
|
|
main "$@"
|