diet-guard/scripts/deploy.sh
Krzysztof kuhy Rudnicki 5add5fa55f
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
file-length / file length <= 250 lines (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (mypy, mypy, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint) (push) Waiting to run
Tests / test (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
Report sync failures; dev extra; deploy script
The phone showed "Not syncing" with no way to learn why: a release
build keeps no log. attemptSync now records the outcome and files a
sync.failed report to the board with the exception. A refresh error
after a landed sync no longer marks it failed.

Also: hypothesis in pyproject's dev extra; gatelock 0.16.0,
claude-agent-sdk 0.2.184 and stale app pins bumped;
scripts/deploy.sh as the CLAUDE.md deploy command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 22:32:07 +01:00

38 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# ============================================================================
# Deploy main everywhere it runs on this PC, then prove it.
#
# 1. Pull the durable clone the gate timer runs from (editable install).
# 2. Reinstall it into system Python's user site: diet-guard-gate.service
# runs /usr/bin/python, not a venv (CLAUDE.md, the 2026-06-19 outage).
# 3. Rebuild and reinstall the desktop app package (app/install_arch.sh).
#
# The phone APK ships through CI (release-apk.yml) and phone_deploy.sh.
# Idempotent; exits non-zero unless every health check passes.
# ============================================================================
set -euo pipefail
readonly REPO="$HOME/src/diet-guard"
readonly PY=/usr/bin/python3
fail() {
echo "deploy: $*" >&2
exit 1
}
git -C "$REPO" pull --ff-only
"$PY" -m pip install --user --break-system-packages -q -e "$REPO"
(cd "$REPO/app" && bash install_arch.sh)
# Health: the gate's own interpreter imports the code the timer will run...
"$PY" -c 'import diet_guard._cli, diet_guard._errors, diet_guard._gatelock' \
|| fail "system python cannot import the gate"
systemctl --user is-enabled --quiet diet-guard-gate.timer \
|| fail "diet-guard-gate.timer is not enabled"
# ...and the desktop package is the version this checkout builds.
want="$(sed -n 's/^version:[[:space:]]*\([^+]*\).*/\1/p' "$REPO/app/pubspec.yaml")"
have="$(pacman -Q diet-guard-app | awk '{print $2}')"
[[ "$have" == "$want-1" ]] || fail "desktop app is $have, want $want-1"
echo "deploy: ok (gate imports, timer enabled, desktop app $have)"