Files
AIOA/scripts/verify-all.sh
2026-07-18 19:20:07 +08:00

64 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
java_home_default='/usr/local/opt/openjdk@21/libexec/openjdk.jdk/Contents/Home'
if [[ -z "${JAVA_HOME:-}" && -d "${java_home_default}" ]]; then
export JAVA_HOME="${java_home_default}"
fi
if [[ -z "${JAVA_HOME:-}" ]]; then
echo 'JDK 21 is required. Set JAVA_HOME before running verification.' >&2
exit 1
fi
echo '[1/5] Backend tests'
(
cd "${root_dir}/backend"
./gradlew --no-daemon test
)
echo '[2/5] AI service tests'
(
cd "${root_dir}/ai-service"
if [[ -x .venv/bin/python ]]; then
.venv/bin/python -m compileall -q app tests
.venv/bin/python -m pytest
else
python3 -m compileall -q app tests
python3 -m pytest
fi
)
echo '[3/5] Flutter formatting, analysis and tests'
(
cd "${root_dir}/mobile"
dart format --output=none --set-exit-if-changed lib test
flutter analyze
flutter test
)
echo '[4/5] Contract and whitespace checks'
(
cd "${root_dir}"
ruby -e "require 'yaml'; YAML.load_file('contracts/openapi/aioa-v1.yaml')"
git diff --check
)
echo '[5/5] Optional platform builds'
if [[ "${AIOA_FULL_BUILD:-0}" == '1' ]]; then
(
cd "${root_dir}/mobile"
flutter build apk --debug
if [[ "$(uname -s)" == 'Darwin' ]]; then
flutter build ios --simulator --no-codesign
fi
)
else
echo 'Skipped. Set AIOA_FULL_BUILD=1 to build Android and iOS simulator artifacts.'
fi
echo 'AIOA verification completed successfully.'