chore: sync ci.yml and bundle-a2ui.sh with upstream main
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
1d83e78377
commit
808e678952
11
.github/workflows/ci.yml
vendored
11
.github/workflows/ci.yml
vendored
@ -76,7 +76,7 @@ jobs:
|
|||||||
command: pnpm lint
|
command: pnpm lint
|
||||||
- runtime: node
|
- runtime: node
|
||||||
task: test
|
task: test
|
||||||
command: pnpm test
|
command: pnpm canvas:a2ui:bundle && pnpm test
|
||||||
- runtime: node
|
- runtime: node
|
||||||
task: build
|
task: build
|
||||||
command: pnpm build
|
command: pnpm build
|
||||||
@ -88,7 +88,7 @@ jobs:
|
|||||||
command: pnpm format
|
command: pnpm format
|
||||||
- runtime: bun
|
- runtime: bun
|
||||||
task: test
|
task: test
|
||||||
command: bunx vitest run
|
command: pnpm canvas:a2ui:bundle && bunx vitest run
|
||||||
- runtime: bun
|
- runtime: bun
|
||||||
task: build
|
task: build
|
||||||
command: bunx tsc -p tsconfig.json
|
command: bunx tsc -p tsconfig.json
|
||||||
@ -188,6 +188,7 @@ jobs:
|
|||||||
runs-on: blacksmith-4vcpu-windows-2025
|
runs-on: blacksmith-4vcpu-windows-2025
|
||||||
env:
|
env:
|
||||||
NODE_OPTIONS: --max-old-space-size=4096
|
NODE_OPTIONS: --max-old-space-size=4096
|
||||||
|
CLAWDBOT_TEST_WORKERS: 1
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: bash
|
shell: bash
|
||||||
@ -200,7 +201,7 @@ jobs:
|
|||||||
command: pnpm lint
|
command: pnpm lint
|
||||||
- runtime: node
|
- runtime: node
|
||||||
task: test
|
task: test
|
||||||
command: pnpm test
|
command: pnpm canvas:a2ui:bundle && pnpm test
|
||||||
- runtime: node
|
- runtime: node
|
||||||
task: build
|
task: build
|
||||||
command: pnpm build
|
command: pnpm build
|
||||||
@ -277,8 +278,6 @@ jobs:
|
|||||||
checks-macos:
|
checks-macos:
|
||||||
if: github.event_name == 'pull_request'
|
if: github.event_name == 'pull_request'
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
env:
|
|
||||||
NODE_OPTIONS: --max-old-space-size=4096
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@ -344,6 +343,8 @@ jobs:
|
|||||||
pnpm install --frozen-lockfile --ignore-scripts=false --config.engine-strict=false --config.enable-pre-post-scripts=true || pnpm install --frozen-lockfile --ignore-scripts=false --config.engine-strict=false --config.enable-pre-post-scripts=true
|
pnpm install --frozen-lockfile --ignore-scripts=false --config.engine-strict=false --config.enable-pre-post-scripts=true || pnpm install --frozen-lockfile --ignore-scripts=false --config.engine-strict=false --config.enable-pre-post-scripts=true
|
||||||
|
|
||||||
- name: Run ${{ matrix.task }}
|
- name: Run ${{ matrix.task }}
|
||||||
|
env:
|
||||||
|
NODE_OPTIONS: --max-old-space-size=4096
|
||||||
run: ${{ matrix.command }}
|
run: ${{ matrix.command }}
|
||||||
|
|
||||||
macos-app:
|
macos-app:
|
||||||
|
|||||||
@ -1,55 +1,87 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
on_error() {
|
||||||
|
echo "A2UI bundling failed. Re-run with: pnpm canvas:a2ui:bundle" >&2
|
||||||
|
echo "If this persists, verify pnpm deps and try again." >&2
|
||||||
|
}
|
||||||
|
trap on_error ERR
|
||||||
|
|
||||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||||
HASH_FILE="$ROOT_DIR/src/canvas-host/a2ui/.bundle.hash"
|
HASH_FILE="$ROOT_DIR/src/canvas-host/a2ui/.bundle.hash"
|
||||||
|
OUTPUT_FILE="$ROOT_DIR/src/canvas-host/a2ui/a2ui.bundle.js"
|
||||||
|
A2UI_RENDERER_DIR="$ROOT_DIR/vendor/a2ui/renderers/lit"
|
||||||
|
A2UI_APP_DIR="$ROOT_DIR/apps/shared/OpenClawKit/Tools/CanvasA2UI"
|
||||||
|
|
||||||
|
# Docker builds exclude vendor/apps via .dockerignore.
|
||||||
|
# In that environment we must keep the prebuilt bundle.
|
||||||
|
if [[ ! -d "$A2UI_RENDERER_DIR" || ! -d "$A2UI_APP_DIR" ]]; then
|
||||||
|
echo "A2UI sources missing; keeping prebuilt bundle."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
INPUT_PATHS=(
|
INPUT_PATHS=(
|
||||||
"$ROOT_DIR/package.json"
|
"$ROOT_DIR/package.json"
|
||||||
"$ROOT_DIR/pnpm-lock.yaml"
|
"$ROOT_DIR/pnpm-lock.yaml"
|
||||||
"$ROOT_DIR/vendor/a2ui/renderers/lit"
|
"$A2UI_RENDERER_DIR"
|
||||||
"$ROOT_DIR/apps/shared/ClawdbotKit/Tools/CanvasA2UI"
|
"$A2UI_APP_DIR"
|
||||||
)
|
)
|
||||||
|
|
||||||
collect_files() {
|
compute_hash() {
|
||||||
local path
|
ROOT_DIR="$ROOT_DIR" node --input-type=module - "${INPUT_PATHS[@]}" <<'NODE'
|
||||||
for path in "${INPUT_PATHS[@]}"; do
|
import { createHash } from "node:crypto";
|
||||||
if [[ -d "$path" ]]; then
|
import { promises as fs } from "node:fs";
|
||||||
find "$path" -type f -print0
|
import path from "node:path";
|
||||||
else
|
|
||||||
printf '%s\0' "$path"
|
const rootDir = process.env.ROOT_DIR ?? process.cwd();
|
||||||
fi
|
const inputs = process.argv.slice(2);
|
||||||
done
|
const files = [];
|
||||||
|
|
||||||
|
async function walk(entryPath) {
|
||||||
|
const st = await fs.stat(entryPath);
|
||||||
|
if (st.isDirectory()) {
|
||||||
|
const entries = await fs.readdir(entryPath);
|
||||||
|
for (const entry of entries) {
|
||||||
|
await walk(path.join(entryPath, entry));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
files.push(entryPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
compute_hash() {
|
for (const input of inputs) {
|
||||||
# Use sha256sum on Linux/Windows (Git Bash), shasum on macOS
|
await walk(input);
|
||||||
local sha_cmd
|
}
|
||||||
if command -v sha256sum &>/dev/null; then
|
|
||||||
sha_cmd="sha256sum"
|
function normalize(p) {
|
||||||
elif command -v shasum &>/dev/null; then
|
return p.split(path.sep).join("/");
|
||||||
sha_cmd="shasum -a 256"
|
}
|
||||||
else
|
|
||||||
echo "No sha256 tool found (sha256sum or shasum)" >&2
|
files.sort((a, b) => normalize(a).localeCompare(normalize(b)));
|
||||||
exit 1
|
|
||||||
fi
|
const hash = createHash("sha256");
|
||||||
collect_files \
|
for (const filePath of files) {
|
||||||
| LC_ALL=C sort -z \
|
const rel = normalize(path.relative(rootDir, filePath));
|
||||||
| xargs -0 $sha_cmd \
|
hash.update(rel);
|
||||||
| $sha_cmd \
|
hash.update("\0");
|
||||||
| awk '{print $1}'
|
hash.update(await fs.readFile(filePath));
|
||||||
|
hash.update("\0");
|
||||||
|
}
|
||||||
|
|
||||||
|
process.stdout.write(hash.digest("hex"));
|
||||||
|
NODE
|
||||||
}
|
}
|
||||||
|
|
||||||
current_hash="$(compute_hash)"
|
current_hash="$(compute_hash)"
|
||||||
if [[ -f "$HASH_FILE" ]]; then
|
if [[ -f "$HASH_FILE" ]]; then
|
||||||
previous_hash="$(cat "$HASH_FILE")"
|
previous_hash="$(cat "$HASH_FILE")"
|
||||||
if [[ "$previous_hash" == "$current_hash" ]]; then
|
if [[ "$previous_hash" == "$current_hash" && -f "$OUTPUT_FILE" ]]; then
|
||||||
echo "A2UI bundle up to date; skipping."
|
echo "A2UI bundle up to date; skipping."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pnpm -s exec tsc -p vendor/a2ui/renderers/lit/tsconfig.json
|
pnpm -s exec tsc -p "$A2UI_RENDERER_DIR/tsconfig.json"
|
||||||
rolldown -c apps/shared/ClawdbotKit/Tools/CanvasA2UI/rolldown.config.mjs
|
rolldown -c "$A2UI_APP_DIR/rolldown.config.mjs"
|
||||||
|
|
||||||
echo "$current_hash" > "$HASH_FILE"
|
echo "$current_hash" > "$HASH_FILE"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user