-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgo
executable file
·81 lines (59 loc) · 1.32 KB
/
go
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
set -e
set -o nounset
set -o pipefail
SCRIPT_DIR=$(cd "$(dirname "$0")" ; pwd -P)
# shellcheck source=./go.helpers
source "${SCRIPT_DIR}/go.helpers"
goal_build() {
./gradlew build -x test -x detekt
}
goal_containerize() {
docker build . -t cookery2-backend
}
goal_run() {
./gradlew bootRun
}
goal_outdated() {
./gradlew dependencyUpdates
}
goal_linter-kt() {
./gradlew detekt
}
goal_test-unit() {
./gradlew clean test
}
goal_test-container() {
bundle install
bundle exec rubocop
bundle exec rspec spec
}
goal_test-pact() {
trap "stop_server" EXIT
goal_build
start_server
./gradlew pactVerify
}
goal_help() {
echo "usage: $0 <goal>
goal:
build -- Build the deployable artifacts
containerize -- Build the docker container for the app
run -- Start the backend application
outdated -- Check which dependencies are outdated
linter-kt -- Run the linter for kotlin files
test-unit -- Run unit tests
test-container -- Run container tests
test-pact -- Verify pact
"
exit 1
}
main() {
TARGET=${1:-}
if [ -n "${TARGET}" ] && type -t "goal_$TARGET" &>/dev/null; then
"goal_$TARGET" "${@:2}"
else
goal_help
fi
}
main "$@"