mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-14 21:16:06 +00:00
* style: apply SwiftFormat 0.62.1 rules Refs #103202 * ci: enforce deterministic Swift lint Refs #103202 * refactor: keep gateway connect lint-clean Refs #103202 * style: keep iOS typography checks warning-free * ci: route MLX Swift changes through pre-push * fix: preserve native i18n extraction after Swift cleanup * refactor: keep rebased Swift surfaces lint-clean * style: format latest Swift additions * chore: refresh native i18n inventory * style: keep generated Swift formatter-clean * fix: preserve node route invalidation callbacks * fix: keep native translation IDs stable * fix: retain native translation identifiers * fix: preserve translations across Swift source moves
110 lines
3.0 KiB
Bash
110 lines
3.0 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 "$*"
|
|
"$@"
|
|
}
|
|
|
|
run_protocol_ci_mirror() {
|
|
local targets=(
|
|
"dist/protocol.schema.json"
|
|
"apps/shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swift"
|
|
)
|
|
local before after
|
|
before="$(git diff --no-ext-diff -- "${targets[@]}" || true)"
|
|
|
|
run_step pnpm protocol:gen
|
|
run_step pnpm protocol:gen:swift
|
|
|
|
after="$(git diff --no-ext-diff -- "${targets[@]}" || true)"
|
|
if [[ "$before" != "$after" ]]; then
|
|
echo "Protocol generation changed tracked outputs beyond the pre-run worktree." >&2
|
|
echo "Refresh generated protocol files and include the updated outputs before pushing." >&2
|
|
git --no-pager diff -- "${targets[@]}"
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
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/ios-write-swift-filelist.mjs
|
|
scripts/lint-swift.sh
|
|
)
|
|
|
|
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_protocol_ci_mirror
|
|
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
|
|
run_step swift test --package-path apps/macos --parallel
|
|
}
|
|
|
|
main() {
|
|
run_linux_ci_mirror
|
|
run_macos_ci_mirror
|
|
}
|
|
|
|
main "$@"
|