-
Notifications
You must be signed in to change notification settings - Fork 16
/
bb.edn
39 lines (38 loc) · 2.52 KB
/
bb.edn
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
; Copyright 2018- Rahul De
;
; Use of this source code is governed by an MIT-style
; license that can be found in the LICENSE file or at
; https://opensource.org/licenses/MIT.
{:paths ["../tasks"]
:tasks {:requires ([tasks :as t])
cclean {:doc "Cleans up cluster containers"
:task (do (t/scrun "kill bob-test-storage bob-test-queue artifact-local")
(t/scrun "rm bob-test-storage bob-test-queue artifact-local")
(t/scrun "network rm bob-net")
(t/scrun "volume prune -f"))}
prep {:doc "Prepares the deps"
:task (do (clojure "-P" "-A:build")
(clojure "-P" "-M" "-A:test")
(clojure "-P"))}
test {:doc "Sets up the cluster and runs tests"
:task (try
(run 'cclean)
(t/scrun "network create bob-net")
(t/crun "run -d --name bob-test-storage -p 5433:5432 -e POSTGRES_DB=bob-test -e POSTGRES_USER=bob -e POSTGRES_PASSWORD=bob --network bob-net postgres:alpine")
(t/crun "run -d --name bob-test-queue -p 5673:5672 -p 5552:5552 --network bob-net -e RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS='-rabbitmq_stream advertised_host localhost' --entrypoint sh rabbitmq:management-alpine -c 'rabbitmq-plugins enable --offline rabbitmq_stream && rabbitmq-server'")
(t/crun "run -d --name artifact-local -p 8001:8001 --network bob-net ghcr.io/bob-cd/artifact-local")
(println "Waiting for cluster readiness.")
(t/wait-for {"artifact-store" "http://localhost:8001/ping"
"postgres" "tcp://127.0.0.1:5433"
"rabbitmq" "tcp://127.0.0.1:5673"})
(t/crun "exec bob-test-queue rabbitmq-plugins enable rabbitmq_stream")
(apply shell "clojure -M:test" *command-line-args*)
(finally (run 'cclean)))}
compile {:doc "Builds the compiled aritfact"
:task (clojure "-T:build" "uber")}
image {:doc "Build and push the docker image"
:task (shell "docker buildx build --push --platform linux/amd64,linux/arm64 -t ghcr.io/bob-cd/apiserver -f Containerfile .")}
clean {:doc "Cleans up"
:task (do (clojure "-T:build" "clean")
(shell "rm -rf .cpcache")
(t/scrun "rmi ghcr.io/bob-cd/apiserver"))}}}