Workspaces page: - list the newest sessions across workspaces in the activity column; the daemon exposes GET /api/v1/sessions/recent as a disk projection and the browser enriches live rows from the per-workspace session relay - put recent activity first below 1100px and fix the mobile page-header flex-basis gap Smoke: - pin PI2_HOST=127.0.0.1 in both smoke scripts and make the startup-line assertion follow the configured host; the daemon default stays 0.0.0.0 Install: - standalone binary build/install scripts, packaging templates, CI/release hooks, CLI-first install docs and the supporting config/doctor changes
152 lines
4.4 KiB
YAML
152 lines
4.4 KiB
YAML
name: ci
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ci-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
check:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
cache-dependency-path: |
|
|
pnpm-lock.yaml
|
|
web/pnpm-lock.yaml
|
|
|
|
- name: Install daemon deps
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Install web deps
|
|
run: pnpm --dir web install --frozen-lockfile
|
|
|
|
- name: Typecheck daemon
|
|
run: pnpm typecheck
|
|
|
|
- name: Typecheck web
|
|
run: pnpm --dir web typecheck
|
|
|
|
- name: Unit tests (daemon)
|
|
run: pnpm test
|
|
|
|
- name: Unit tests (web)
|
|
run: pnpm --dir web exec vitest run
|
|
|
|
- name: Build daemon
|
|
run: pnpm build
|
|
|
|
- name: Build web
|
|
run: pnpm build:web
|
|
|
|
- name: Smoke (daemon + static UI round trip)
|
|
run: bash scripts/smoke.sh
|
|
|
|
# --ignore-scripts: everything is already built above, and prepack's build
|
|
# output would corrupt the JSON on stdout.
|
|
- name: Check the publishable tarball embeds dist + web/dist
|
|
run: |
|
|
node -e 'if (!require("./package.json").scripts.prepack) { console.error("prepack missing"); process.exit(1) }'
|
|
npm pack --dry-run --json --ignore-scripts > pack.json
|
|
node -e '
|
|
const [t] = require("./pack.json");
|
|
const files = t.files.map((f) => f.path);
|
|
for (const need of ["dist/cli/pi2.js", "web/dist/index.html", "docs/protocol.md"]) {
|
|
if (!files.includes(need)) {
|
|
console.error(`missing from tarball: ${need}`);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
if (files.some((f) => f.startsWith("src/") || f.startsWith("test/"))) {
|
|
console.error("tarball leaks source or tests");
|
|
process.exit(1);
|
|
}
|
|
console.log(`tarball ok: ${files.length} files`);
|
|
'
|
|
|
|
binary:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
cache-dependency-path: |
|
|
pnpm-lock.yaml
|
|
web/pnpm-lock.yaml
|
|
|
|
- uses: oven-sh/setup-bun@v2
|
|
|
|
- name: Install daemon deps
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Install web deps
|
|
run: pnpm --dir web install --frozen-lockfile
|
|
|
|
- name: Build standalone binary (musl)
|
|
run: bash scripts/build-binary.sh --target bun-linux-x64-musl
|
|
|
|
- name: Boot check
|
|
run: |
|
|
sudo apt-get update -y && sudo apt-get install -y musl
|
|
if [ ! -f /lib/ld-musl-x86_64.so.1 ]; then
|
|
MUSL_LIB="$(find /usr/lib /lib -name 'libc.musl*' -o -name 'ld-musl*' 2>/dev/null | head -n 1)"
|
|
if [ -n "$MUSL_LIB" ]; then
|
|
sudo ln -s "$MUSL_LIB" /lib/ld-musl-x86_64.so.1
|
|
fi
|
|
fi
|
|
|
|
TMP="$(mktemp -d)"
|
|
export PI2_RUNTIME_DIR="$TMP/run"
|
|
export PI2_DATA_DIR="$TMP/data"
|
|
export PI2_STATE_DIR="$TMP/state"
|
|
mkdir -p "$PI2_RUNTIME_DIR" "$PI2_DATA_DIR" "$PI2_STATE_DIR"
|
|
|
|
dist-bin/bin/pi2 daemon --port 0 > "$TMP/daemon.log" 2>&1 &
|
|
PID=$!
|
|
trap 'kill -TERM "$PID" 2>/dev/null || true; rm -rf "$TMP"' EXIT
|
|
|
|
for _ in $(seq 1 50); do
|
|
[ -f "$PI2_RUNTIME_DIR/daemon.json" ] && break
|
|
kill -0 "$PID" 2>/dev/null || break
|
|
sleep 0.1
|
|
done
|
|
|
|
if [ ! -f "$PI2_RUNTIME_DIR/daemon.json" ]; then
|
|
echo "daemon failed to start; log:" >&2
|
|
cat "$TMP/daemon.log" >&2
|
|
exit 1
|
|
fi
|
|
|
|
PORT="$(node -p 'require(process.env.PI2_RUNTIME_DIR + "/daemon.json").port')"
|
|
STATUS="$(curl -s -o /dev/null -w "%{http_code}" "http://127.0.0.1:${PORT}/api/v1/info")"
|
|
if [ "$STATUS" != "200" ]; then
|
|
echo "expected HTTP 200 from /api/v1/info, got $STATUS" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "Standalone binary boot check passed (HTTP $STATUS on port $PORT)"
|
|
kill -TERM "$PID" 2>/dev/null || true
|
|
wait "$PID" 2>/dev/null || true
|
|
trap - EXIT
|
|
rm -rf "$TMP"
|