c277ee37c2
Gradle project in android/ with every module of SPEC §6.2 (build-logic convention plugins, version catalog, architecture check in check), :core:model types and repository interfaces of §14.2.4 and §14.5, :domain implementing §14.5.2 and §14.5.4 (125 vector cases), scenario-driven fakes with the empty scenario, Room 3 entities and KvittDatabase v1 with exported schema, :app shell with Hilt, en/sv strings with MissingTranslation as a lint error, Roborazzi goldens of the empty screen in light and dark. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
1.7 KiB
Bash
Executable File
36 lines
1.7 KiB
Bash
Executable File
#!/bin/sh
|
||
# Kvitt pre-commit hook: the fast subset of both gates. Installed by tools/install-git-hooks.sh.
|
||
# Each check runs only when its project exists, so the hook works on branches before android/ or server/ exist.
|
||
set -e
|
||
top=$(git rev-parse --show-toplevel)
|
||
|
||
# Secrets and personal data never reach git (CLAUDE.md › Never commit).
|
||
bad=$(git -C "$top" ls-files --cached -- '*local.properties' '*.jks' '*.keystore' '*.p12' '*.aar' 'models/' 'export/' \
|
||
'*service-account*.json' '*google-services.json' '*.pem' '*.sqlite' '*.db' 'infra/secrets/' | head -5)
|
||
if [ -n "$bad" ]; then
|
||
echo "pre-commit: a secret, keystore, vendor binary or personal-data file is staged or tracked:" >&2
|
||
echo "$bad" >&2
|
||
echo "Unstage with: git rm --cached <file>" >&2
|
||
exit 1
|
||
fi
|
||
|
||
# Android: the pure model tests, on the pinned JDK (android/gradle.properties); the shell's java may be a stub.
|
||
if [ -x "$top/android/gradlew" ] && [ -d "$top/android/core/model" ]; then
|
||
case "$("${JAVA_HOME:+$JAVA_HOME/bin/}java" -version 2>&1 | head -1)" in
|
||
*\"25*) ;;
|
||
*) [ -d /opt/homebrew/opt/openjdk@25 ] && export JAVA_HOME=/opt/homebrew/opt/openjdk@25/libexec/openjdk.jdk/Contents/Home ;;
|
||
esac
|
||
(cd "$top/android" && ./gradlew --quiet :core:model:test :domain:test) || {
|
||
echo "pre-commit: Android fast tests failed (see above). Run tools/gradle-serial.sh check for the full picture." >&2
|
||
exit 1
|
||
}
|
||
fi
|
||
|
||
# Server: the pure domain crate tests.
|
||
if [ -f "$top/server/Cargo.toml" ] && [ -d "$top/server/crates/kvitt-domain" ] && command -v cargo >/dev/null 2>&1; then
|
||
(cd "$top/server" && cargo test --quiet -p kvitt-domain) || {
|
||
echo "pre-commit: kvitt-domain tests failed (see above). Run the server gate for the full picture." >&2
|
||
exit 1
|
||
}
|
||
fi
|