hephaestus/.forgejo/scripts/build
Erich Blume bbac338f76
Some checks failed
Build / validate (pull_request) Failing after 3s
Scaffold cargo workspace + heph-core foundation
Kick off Phase 1 (v1 prototype) per tech-spec §11.1. Sets up the Cargo
workspace and the first TDD slice of heph-core:

- Migration runner + §4.5 SQLite schema (nodes, tasks, links, aliases,
  users, oplog, sync_state, conflicts), versioned via PRAGMA user_version.
- Clock-injected `Clock` trait (no ambient wall-clock reads; §2).
- `Store` trait + `LocalStore` SQLite backend with node create/get,
  bootstrapping the single local user (oidc_sub NULL, §13).
- Node model (kinds: doc/task/project/tag/journal).

Repo housekeeping: fill AGENTS.md Project Structure (last template TODO),
ignore /target, add self-bootstrapping .forgejo/scripts/build that runs
cargo fmt/clippy/test in CI (§9), changelog fragment.

Tests green: 4 unit tests (migration version, local-user idempotency,
create/get round-trip, missing-node None).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-31 18:52:15 -07:00

30 lines
979 B
Bash
Executable file

#!/usr/bin/env bash
#
# Project build hook (tech-spec §9): run the Rust workspace checks in CI.
#
# Invoked by .forgejo/workflows/build.yaml after the generic `prek` pass.
# Bootstraps a minimal Rust toolchain via rustup when the runner image lacks
# one, so the suite runs without a bespoke CI image. The headless nvim e2e
# suite is added here once heph.nvim exists.
set -euo pipefail
if ! command -v cargo >/dev/null 2>&1; then
echo "cargo not found; bootstrapping Rust toolchain via rustup..."
export RUSTUP_HOME="${RUSTUP_HOME:-$HOME/.rustup}"
export CARGO_HOME="${CARGO_HOME:-$HOME/.cargo}"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- -y --profile minimal
# shellcheck disable=SC1091
. "$CARGO_HOME/env"
rustup component add clippy rustfmt
fi
echo "== cargo fmt --check =="
cargo fmt --all --check
echo "== cargo clippy =="
cargo clippy --all-targets --all-features -- -D warnings
echo "== cargo test =="
cargo test --all