first commit
RustBox CI / rustbox (push) Waiting to run

This commit is contained in:
Mateusz Gruszczyński committed 2026-10-29 15:24:59 +01:00
commit bc5fbd6ba9
180 files changed
+63750

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"
if ! command -v cargo >/dev/null 2>&1; then
echo "error: Rust/Cargo is required" >&2
exit 1
fi
if find "$ROOT" -type f \( -name '*.ts' -o -name '*.tsx' \) -print -quit | grep -q .; then
echo "error: TypeScript source found in RustBox" >&2
exit 1
fi
cargo test --locked
cargo build --release --locked
BIN="$ROOT/target/release/rustbox"
test -x "$BIN"
"$BIN" --version
printf 'Built RustBox: %s\n' "$BIN"
+81
View File
@@ -0,0 +1,81 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"
UI_REVIEWED=0
ROOT_REVIEWED=0
SKIP_BUILD=0
for arg in "$@"; do
case "$arg" in
--ui-reviewed) UI_REVIEWED=1 ;;
--root-reviewed) ROOT_REVIEWED=1 ;;
--skip-build) SKIP_BUILD=1 ;;
*) echo "usage: $0 [--ui-reviewed] [--root-reviewed] [--skip-build]" >&2; exit 2 ;;
esac
done
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
echo "error: not a Git checkout" >&2
exit 1
fi
PENDING_FILE="$(git rev-parse --git-path rustbox-upstream-pending)"
if [ ! -f "$PENDING_FILE" ]; then
echo "error: no pending Oxi sync; run ./scripts/sync-upstream.sh first" >&2
exit 1
fi
BASE="$(sed -n 's/^base=//p' "$PENDING_FILE")"
TARGET_SHA="$(sed -n 's/^target=//p' "$PENDING_FILE")"
BRANCH="$(sed -n 's/^branch=//p' "$PENDING_FILE")"
CURRENT_BRANCH="$(git branch --show-current)"
if [ -z "$BASE" ] || [ -z "$TARGET_SHA" ] || [ -z "$BRANCH" ]; then
echo "error: invalid pending sync metadata" >&2
exit 1
fi
if [ "$CURRENT_BRANCH" != "$BRANCH" ]; then
echo "error: pending Oxi sync belongs to branch '$BRANCH'; current branch is '$CURRENT_BRANCH'" >&2
exit 1
fi
if git diff --name-only --diff-filter=U | grep -q .; then
echo "error: unresolved merge conflicts remain" >&2
git diff --name-only --diff-filter=U >&2
exit 1
fi
if find . -path ./.git -prune -o -type f \( -name '*.ts' -o -name '*.tsx' \) -print -quit | grep -q .; then
echo "error: TypeScript source exists in RustBox" >&2
exit 1
fi
if ! git diff --quiet "$BASE..$TARGET_SHA" -- frontend/; then
if [ "$UI_REVIEWED" -ne 1 ]; then
echo "error: Oxi frontend changed between $BASE and $TARGET_SHA." >&2
echo "Review/port the relevant behavior, then rerun with --ui-reviewed." >&2
git diff --name-status "$BASE..$TARGET_SHA" -- frontend/ >&2 || true
exit 1
fi
fi
if ! git diff --quiet "$BASE..$TARGET_SHA" -- . ':(exclude)backend/**' ':(exclude)frontend/**'; then
if [ "$ROOT_REVIEWED" -ne 1 ]; then
echo "error: Oxi root-level files changed between $BASE and $TARGET_SHA." >&2
echo "Review relevant build/config/docs changes, then rerun with --root-reviewed." >&2
git diff --name-status "$BASE..$TARGET_SHA" -- . ':(exclude)backend/**' ':(exclude)frontend/**' >&2 || true
exit 1
fi
fi
if [ "$SKIP_BUILD" -ne 1 ]; then
./scripts/build-release.sh
else
echo "warning: build gate skipped by explicit --skip-build" >&2
fi
printf '%s\n' "$TARGET_SHA" > UPSTREAM_BASE
git add UPSTREAM_BASE
rm -f "$PENDING_FILE"
printf 'Oxi sync review completed: %s -> %s\n' "$BASE" "$TARGET_SHA"
printf 'UPSTREAM_BASE is staged. Review git status and commit the sync.\n'
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
BIN="$ROOT/target/release/rustbox"
if [ "$(id -u)" -ne 0 ]; then
echo "error: run as root (sudo ./scripts/install-systemd.sh)" >&2
exit 1
fi
if [ ! -x "$BIN" ]; then
echo "error: $BIN not found; run ./scripts/build-release.sh first" >&2
exit 1
fi
getent group rustbox >/dev/null || groupadd --system rustbox
id rustbox >/dev/null 2>&1 || useradd --system --gid rustbox --home-dir /var/lib/rustbox --shell /usr/sbin/nologin rustbox
install -d -o root -g rustbox -m 0750 /etc/rustbox
install -m 0755 "$BIN" /usr/local/bin/rustbox
install -m 0644 "$ROOT/packaging/systemd/rustbox.service" /etc/systemd/system/rustbox.service
if [ ! -f /etc/rustbox/rustbox.toml ]; then
install -o root -g rustbox -m 0640 "$ROOT/config.example.toml" /etc/rustbox/rustbox.toml
fi
RUSTBOX_CONFIG=/etc/rustbox/rustbox.toml /usr/local/bin/rustbox --check-config
systemctl daemon-reload
echo "Installed. Review /etc/rustbox/rustbox.toml, then: systemctl enable --now rustbox"
+59
View File
@@ -0,0 +1,59 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"
REMOTE="upstream-oxi"
COMMIT="${1:-}"
if [ -z "$COMMIT" ]; then
echo "usage: $0 <oxi-commit>" >&2
exit 2
fi
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
echo "error: not a Git checkout" >&2
exit 1
fi
if ! git diff --quiet || ! git diff --cached --quiet; then
echo "error: working tree must be clean before porting an Oxi commit" >&2
exit 1
fi
if ! git remote get-url "$REMOTE" >/dev/null 2>&1; then
echo "error: Oxi remote is not configured; run ./scripts/setup-upstream.sh" >&2
exit 1
fi
git fetch "$REMOTE" --tags >/dev/null
SHA="$(git rev-parse "$COMMIT^{commit}")"
PARENT="$(git rev-parse "$SHA^1")"
branch="port/oxi-${SHA:0:12}"
git switch -c "$branch"
tmp_raw="$(mktemp)"
tmp_mapped="$(mktemp)"
cleanup() { rm -f "$tmp_raw" "$tmp_mapped"; }
trap cleanup EXIT
git diff --binary --find-renames "$PARENT..$SHA" -- backend/ > "$tmp_raw"
sed \
-e 's#^diff --git a/backend/#diff --git a/#' \
-e 's# b/backend/# b/#' \
-e 's#^--- a/backend/#--- a/#' \
-e 's#^+++ b/backend/#+++ b/#' \
-e 's#^rename from backend/#rename from #' \
-e 's#^rename to backend/#rename to #' \
-e 's#^copy from backend/#copy from #' \
-e 's#^copy to backend/#copy to #' \
-e 's#^Binary files a/backend/#Binary files a/#' \
-e 's# and b/backend/# and b/#' \
"$tmp_raw" > "$tmp_mapped"
if [ ! -s "$tmp_mapped" ]; then
echo "Oxi commit $SHA has no backend/ changes to map."
else
git apply --3way --index "$tmp_mapped"
fi
printf 'Ported backend portion of Oxi commit %s onto branch %s.\n' "$SHA" "$branch"
printf 'UPSTREAM_BASE was intentionally NOT changed.\n'
printf 'Review the original commit, especially frontend changes: git show %s -- frontend/\n' "$SHA"
+42
View File
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"
REMOTE="upstream-oxi"
TARGET="${1:-upstream-oxi/main}"
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
echo "error: not a Git checkout" >&2
exit 1
fi
if ! git remote get-url "$REMOTE" >/dev/null 2>&1; then
echo "error: Oxi remote is not configured; run ./scripts/setup-upstream.sh" >&2
exit 1
fi
git fetch "$REMOTE" --tags >/dev/null
BASE="$(tr -d '[:space:]' < UPSTREAM_BASE)"
TARGET_SHA="$(git rev-parse "$TARGET^{commit}")"
if ! git merge-base --is-ancestor "$BASE" "$TARGET_SHA"; then
echo "error: recorded Oxi base is not an ancestor of $TARGET ($TARGET_SHA)" >&2
exit 1
fi
printf 'RustBox Oxi status\n'
printf ' consumed: %s\n' "$BASE"
printf ' target: %s\n' "$TARGET_SHA"
printf ' commits: %s\n' "$(git rev-list --count "$BASE..$TARGET_SHA")"
printf '\nOxi backend changes that can be mapped into RustBox root:\n'
git diff --name-status "$BASE..$TARGET_SHA" -- backend/ || true
printf '\nOxi frontend changes requiring manual RustBox UI port:\n'
git diff --name-status "$BASE..$TARGET_SHA" -- frontend/ || true
printf '\nOther Oxi repository changes to review manually:\n'
git diff --name-status "$BASE..$TARGET_SHA" -- . ':(exclude)backend/**' ':(exclude)frontend/**' || true
printf '\nUpstream commits:\n'
git log --oneline --decorate --no-merges "$BASE..$TARGET_SHA" || true
+41
View File
@@ -0,0 +1,41 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"
REMOTE="upstream-oxi"
URL="https://github.com/c0h1b4/oxi.git"
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
echo "error: RustBox must be a Git checkout before configuring Oxi upstream." >&2
echo "Initialize it first:" >&2
echo " git init" >&2
echo " git add ." >&2
echo " git commit -m 'RustBox 0.0.1 baseline'" >&2
exit 1
fi
if git remote get-url "$REMOTE" >/dev/null 2>&1; then
current="$(git remote get-url "$REMOTE")"
if [ "$current" != "$URL" ]; then
echo "error: remote '$REMOTE' already points to: $current" >&2
echo "expected: $URL" >&2
exit 1
fi
else
git remote add "$REMOTE" "$URL"
fi
git fetch "$REMOTE" --tags
BASE="$(tr -d '[:space:]' < UPSTREAM_BASE)"
if ! git cat-file -e "$BASE^{commit}" 2>/dev/null; then
echo "error: recorded Oxi base commit is not available after fetch: $BASE" >&2
exit 1
fi
printf 'Oxi upstream configured.\n'
printf 'Remote: %s -> %s\n' "$REMOTE" "$URL"
printf 'Consumed Oxi baseline: %s\n' "$BASE"
printf 'Latest upstream-oxi/main: %s\n' "$(git rev-parse upstream-oxi/main)"
+90
View File
@@ -0,0 +1,90 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"
REMOTE="upstream-oxi"
TARGET="${1:-upstream-oxi/main}"
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
echo "error: run this inside a RustBox Git checkout" >&2
exit 1
fi
if ! git rev-parse --verify HEAD >/dev/null 2>&1; then
echo "error: create the initial RustBox commit before syncing Oxi" >&2
exit 1
fi
if ! git diff --quiet || ! git diff --cached --quiet; then
echo "error: working tree must be clean before Oxi sync" >&2
exit 1
fi
if ! git remote get-url "$REMOTE" >/dev/null 2>&1; then
echo "error: Oxi remote is not configured; run ./scripts/setup-upstream.sh" >&2
exit 1
fi
git fetch "$REMOTE" --tags
BASE="$(tr -d '[:space:]' < UPSTREAM_BASE)"
TARGET_SHA="$(git rev-parse "$TARGET^{commit}")"
if [ "$BASE" = "$TARGET_SHA" ]; then
echo "RustBox already consumes Oxi $TARGET_SHA"
exit 0
fi
if ! git merge-base --is-ancestor "$BASE" "$TARGET_SHA"; then
echo "error: $TARGET_SHA does not descend from recorded Oxi base $BASE" >&2
echo "Refuse automatic mapping; review the upstream history manually." >&2
exit 1
fi
branch="sync/oxi-$(date -u +%Y%m%d-%H%M%S)"
git switch -c "$branch"
tmp_raw="$(mktemp)"
tmp_mapped="$(mktemp)"
cleanup() { rm -f "$tmp_raw" "$tmp_mapped"; }
trap cleanup EXIT
# RustBox flattened Oxi's backend/ crate into the repository root. Generate
# only the upstream backend delta, then rewrite patch metadata from
# backend/<path> to <path>. File contents are not rewritten.
git diff --binary --find-renames "$BASE..$TARGET_SHA" -- backend/ > "$tmp_raw"
sed \
-e 's#^diff --git a/backend/#diff --git a/#' \
-e 's# b/backend/# b/#' \
-e 's#^--- a/backend/#--- a/#' \
-e 's#^+++ b/backend/#+++ b/#' \
-e 's#^rename from backend/#rename from #' \
-e 's#^rename to backend/#rename to #' \
-e 's#^copy from backend/#copy from #' \
-e 's#^copy to backend/#copy to #' \
-e 's#^Binary files a/backend/#Binary files a/#' \
-e 's# and b/backend/# and b/#' \
"$tmp_raw" > "$tmp_mapped"
PENDING_FILE="$(git rev-parse --git-path rustbox-upstream-pending)"
printf 'base=%s\ntarget=%s\nbranch=%s\n' "$BASE" "$TARGET_SHA" "$branch" > "$PENDING_FILE"
if [ -s "$tmp_mapped" ]; then
if ! git apply --3way --index "$tmp_mapped"; then
echo >&2
echo "Oxi backend changes produced conflicts on branch $branch." >&2
echo "Resolve them in the flat RustBox paths, then run ./scripts/finish-upstream.sh." >&2
echo "UPSTREAM_BASE has NOT been advanced." >&2
exit 1
fi
fi
if find . -path ./.git -prune -o -type f \( -name '*.ts' -o -name '*.tsx' \) -print -quit | grep -q .; then
echo "error: TypeScript appeared in the RustBox source tree; remove/port it before continuing" >&2
exit 1
fi
printf '\nMapped Oxi backend %s -> %s into RustBox on branch %s.\n' "$BASE" "$TARGET_SHA" "$branch"
printf 'UPSTREAM_BASE remains at %s until the review is explicitly finished.\n' "$BASE"
printf '\nFrontend changes were NOT imported. Review them with:\n'
printf ' git diff --name-status %s..%s -- frontend/\n' "$BASE" "$TARGET_SHA"
printf ' git diff %s..%s -- frontend/\n' "$BASE" "$TARGET_SHA"
printf '\nOther Oxi root changes were NOT imported. Review them with:\n'
printf " git diff %s..%s -- . ':(exclude)backend/**' ':(exclude)frontend/**'\n" "$BASE" "$TARGET_SHA"
printf '\nAfter resolving/porting and testing, run ./scripts/finish-upstream.sh.\n'