-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathformat-and-test.sh
More file actions
executable file
·44 lines (39 loc) · 1.44 KB
/
format-and-test.sh
File metadata and controls
executable file
·44 lines (39 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash
# ──────────────────────────────────────────────────────────────
# format-and-test.sh
#
# Convenience script that runs the full quality pipeline:
# 1. spotless:apply (auto-format code)
# 2. mvn clean verify (compile + test + checkstyle + spotbugs)
#
# Usage: ./.github/scripts/format-and-test.sh
# ./.github/scripts/format-and-test.sh --format-only
# ./.github/scripts/format-and-test.sh --test-only
# ./.github/scripts/format-and-test.sh --debug (uses -Pdebug)
# ──────────────────────────────────────────────────────────────
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
cd "$ROOT_DIR"
FORMAT=true
TEST=true
MVN_PROFILE=""
for arg in "$@"; do
case "$arg" in
--format-only) TEST=false ;;
--test-only) FORMAT=false ;;
--debug) MVN_PROFILE="-Pdebug" ;;
*) echo "Unknown option: $arg"; exit 1 ;;
esac
done
if $FORMAT; then
echo "▸ Running Spotless (format)…"
mvn spotless:apply
fi
if $TEST; then
echo "▸ Running mvn clean verify $MVN_PROFILE …"
mvn clean verify $MVN_PROFILE
echo ""
echo "✅ All checks passed."
else
echo "✅ Formatting complete."
fi