#!/usr/bin/env bash # test.sh [part] — run gate checks for a pipeline part. # server -> go test # client -> flutter analyze # (none) -> both (backwards compatible) set -euo pipefail export PATH="/opt/homebrew/bin:$PATH" export GOPROXY="${GOPROXY:-https://goproxy.cn,direct}" export PUB_HOSTED_URL="${PUB_HOSTED_URL:-https://pub.flutter-io.cn}" export FLUTTER_STORAGE_BASE_URL="${FLUTTER_STORAGE_BASE_URL:-https://storage.flutter-io.cn}" PART="${1:-all}" run_server() { echo "==> test: go test" cd backend go test ./... cd .. } run_client() { echo "==> test: flutter analyze" cd client flutter analyze --no-fatal-infos --no-fatal-warnings cd .. } case "$PART" in server) run_server ;; client) run_client ;; site) echo "==> test: site has no test gate (build is the gate)" ;; all) run_server; run_client ;; *) echo "unknown part: $PART" >&2; exit 1 ;; esac echo "==> test: done"