Files
RustBox/scripts/build-release.sh
T
Mateusz Gruszczyński 47c3cd7f65
RustBox CI / rustbox (push) Canceled after 0s
v0.2.5
2026-10-31 23:53:40 +01:00

63 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"
# Keep Cargo.lock for reproducible application/package builds.
# Generate it only when missing.
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
if [[ -e "$ROOT/src/web/app.js" || ! -f "$ROOT/src/web/js/manifest.txt" ]]; then
echo "error: browser JavaScript must be modularized under src/web/js/" >&2
exit 1
fi
if command -v python3 >/dev/null 2>&1; then
python3 scripts/validate-release-static.py
else
echo "error: python3 is required for static release validation" >&2
exit 1
fi
if [[ ! -f Cargo.lock ]]; then
echo "Cargo.lock not found - generating it..."
cargo generate-lockfile
fi
cargo fmt --all
cargo fmt --all -- --check
cargo test --locked
cargo clippy \
--locked \
--all-targets \
-- \
-D warnings
cargo build \
--release \
--locked
BIN="$ROOT/target/release/rustbox"
if [[ ! -x "$BIN" ]]; then
echo "error: RustBox binary was not produced: $BIN" >&2
exit 1
fi
"$BIN" --version
printf 'Built RustBox: %s\n' "$BIN"
printf 'Cargo.lock retained: %s\n' "$ROOT/Cargo.lock"