-
Notifications
You must be signed in to change notification settings - Fork 95
/
bb.edn
126 lines (123 loc) · 7.36 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
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
{:min-bb-version "0.8.2"
:paths ["script" "build"]
:deps {doric/doric {:mvn/version "0.9.0"}
org.clj-commons/pretty {:mvn/version "3.2.0"}
lread/status-line {:git/url "https://github.com/lread/status-line.git"
:sha "cf44c15f30ea3867227fa61ceb823e5e942c707f"}
dev.nubank/docopt {:mvn/version "0.6.1-fix7"}
org.babashka/http-server {:mvn/version "0.1.13"}
wevre/natural-compare {:mvn/version "0.0.10"}
io.github.babashka/neil {:git/tag "v0.3.68" :git/sha "78ffab1"}}
:tasks
{;; setup
:requires ([babashka.classpath :as cp]
[babashka.cli :as cli]
[babashka.fs :as fs]
[clojure.string :as string]
[helper.shell :as shell]
[lread.status-line :as status])
:init (do (defn parse-repl-args [args]
(let [cli-spec {:spec
{:host {:desc "Bind to host (use 0.0.0.0 to allow anyone to connect)"
:alias :h
:default "localhost"}}
:restrict true}]
(cli/parse-opts args cli-spec))))
:enter (let [{:keys [name task-decoration] :as f} (current-task)]
(when-not (= :none task-decoration)
(status/line :head "TASK %s" name)))
:leave (let [{:keys [name task-decoration] :as f} (current-task)]
(when-not (= :none task-decoration)
(status/line :detail "\nTASK %s done." name)))
;; commands
dev:jvm {:doc "start a Clojure nrepl server/prompt"
:task (let [opts (parse-repl-args *command-line-args*)
host (:host opts)]
(shell/command "clj" "-M:test:repl/cider" "-h" host "-b" host))}
dev:bb {:doc "start a Babashka nrepl server"
;; repeat :test paths from deps.edn
:extra-paths ["test" "env/test/resources"]
:extra-deps {;; inherit base deps from deps.edn
etaoin/etaoin {:local/root "."}
;; repeat necessary :test deps from deps.edn
io.github.cognitect-labs/test-runner {:git/tag "v0.5.1" :git/sha "dfb30dd"}}
:task (let [opts (parse-repl-args *command-line-args*)]
(babashka.nrepl.server/start-server! opts)
(deref (promise)))}
test:jvm {:doc "Runs tests under JVM Clojure [--help]"
:task test/test-jvm}
-test:bb {:doc "bb test runner, invoked within script/test.clj"
:task-decoration :none
:requires ([taoensso.timbre :as timbre])
;; repeat :test paths from deps.edn
:extra-paths ["test" "env/test/resources"]
:extra-deps {;; inherit base deps from deps.edn
etaoin/etaoin ({:local/root "."})
;; repeat necessary :test deps from deps.edn
io.github.cognitect-labs/test-runner {:git/tag "v0.5.1" :git/sha "dfb30dd"}}
:task (do
;; timbre default logging level is debug, which generates a lot of http logging noise
(timbre/set-level! :info)
(exec 'test-shared/test))
:org.babashka/cli {:coerce {:nses [:symbol]
:patterns [:string]
:vars [:symbol]}}}
test:bb {:doc "Runs tests under Babashka [--help]"
:task test/test-bb}
test-doc {:doc "Test code blocks in user guide"
:task test-doc/test-doc}
test-coverage {:doc "Run doc and unit tests on JVM and generate ./target/clofidence code coverage report"
:task test-coverage/-main}
test-matrix {:doc "Returns a test matrix for CI [--help]"
:task test-matrix/-main}
drivers {:doc "[list|kill] any running WebDrivers"
:task drivers/-main}
ps {:doc "List processes with matching names (handy for debugging)"
:requires ([helper.ps :as ps]
[doric.core :as doric]
[clojure.string :as str])
:task (let [pattern (re-pattern (str/join "|" *command-line-args*))]
(->> (ps/all-processes)
(filterv (fn [p] (re-find pattern (:command p))))
(doric/table [:pid :start-instant :is-alive :command :arguments])
println))}
lint-kondo {:doc "[--rebuild] lint source code with clj-kondo"
:task lint/-main}
lint-eastwood {:doc "Run Eastwood linter on source code"
:task (shell/clojure "-M:eastwood")}
lint {:doc "Run all linters"
:depends [lint-kondo lint-eastwood]}
cljdoc-preview {:doc "preview what docs will look like on cljdoc, use --help for args"
:task cljdoc-preview/-main}
tools-versions {:doc "report on tools versions"
:task tools-versions/-main}
download-deps {:doc "download all deps (useful for CI prep)"
:task (clojure "-T:build download-deps")}
outdated {:doc "report on outdated dependencies"
:task (shell/clojure {:continue true} "-M:outdated")}
docker-build {:doc "build etaoin docker image"
:task (shell/command "docker build --no-cache -t etaoin:latest .")}
-docker-install {:doc "helper to setup docker image"
:task-decoration :none
:task docker-install/-main}
docker-run {:doc "run etaoin docker image (specify no commmands for interactive)"
:task (let [{:keys [exit]} (apply shell/command {:continue true}
"docker run -it --rm --shm-size=1gb"
(str "-v" (fs/cwd) ":/etaoin")
"etaoin:latest"
*command-line-args*)]
(System/exit exit))}
test-server {:doc "Static server to support tests (automatically lanched by tests that need it)"
:task test-server/-main}
fake-driver {:doc "Fake driver to support testing"
:task-decoration :none
:task fake-driver/-main}
pubcheck {:task publish/pubcheck :doc "Run only publish checks (without publishing)"}
publish {:task publish/-main :doc "Publish a release (for maintainers)"}
;; let's not rely on a random version of neil
neil {:task babashka.neil/-main :doc "Pinned version of babashka/neil (used in scripting)"}
;; hidden tasks, no need for folks to be trying these ci invoked tasks
-ci-set-skip-tests {:task ci-publish/set-skip-tests :doc "used on ci to determine if tests need to be run"}
-ci-clojars-deploy {:task ci-publish/clojars-deploy :doc "triggered on ci by release tag"}
-ci-github-create-release {:task ci-publish/github-create-release :doc "triggered on ci by release tag"}
-ci-cljdoc-request-build {:task ci-publish/cljdoc-request-build :doc "ask cljdoc to build docs for new release"}}}