-
-
Notifications
You must be signed in to change notification settings - Fork 97
/
bb.edn
68 lines (53 loc) · 3.4 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
{:tasks
{:requires [[babashka.fs :as fs]
[babashka.process :as p]]
:init (do (def clj-version
"The clj version to use with lein tasks."
(or (first *command-line-args*) (System/getenv "VERSION") "1.11"))
(def bump
"The release BUMP field."
(or (second *command-line-args*) (System/getenv "BUMP") "patch"))
(def lein
"The full path to lein."
(str (or (fs/which "lein")
(throw (Exception. "Cannot find lein in PATH."))))))
*DEFAULTS* {:doc "[Clojure VERSION]: the VERSION env var or \"1.11\". [BUMP field]: the BUMP env var or \"patch\"."}
kaocha {:doc "Run the kaocha test runner with [kaocha ARGS...]."
:task (apply shell lein "kaocha" *command-line-args*)}
test {:doc "Run tests for [Clojure VERSION]."
:task
;; We use kaocha on Clojure 1.9+, but revert to lein's built in
;; runner with Clojure 1.7 and 1.8.
(if (#{"1.7" "1.8"} clj-version)
(do
(shell lein "with-profile" (str "-user,+" clj-version ",+test") "test")
(shell lein "with-profile" (str "-user,+" clj-version ",+test,+junixsocket") "test"))
(do
(shell lein "with-profile" (str "-user,+" clj-version ",+test") "run" "-m" "kaocha.runner")
(shell lein
"with-profile" (str "-user,+" clj-version ",+test,+junixsocket") "run" "-m" "kaocha.runner")))}
eastwood {:doc "Run eastwood for [Clojure VERSION]."
:task (shell lein "with-profile" (str "-user,+" clj-version ",+eastwood") "eastwood")}
cljfmt {:doc "Run cljfmt for [Clojure VERSION]."
:task (shell lein "with-profile" (str "-user,+" clj-version ",+cljfmt") "cljfmt" "check")}
kondo {:doc "Run clj-kondo for [Clojure VERSION]."
:task (shell lein "with-profile" "+clj-kondo" "run" "-m" "clj-kondo.main" "--lint" "src")}
cloverage {:doc "Run cloverage for [Clojure VERSION]."
:task (shell lein "with-profile" (str "-user,+" clj-version ",+cloverage") "cloverage" "--codecov")}
check {:doc "Run all tests and linters for [Clojure VERSION]."
;; Roughly match what runs in CI using the current JVM check
:task (doseq [task '[test eastwood kondo cljfmt cloverage]]
(println :running-task task)
(run task))}
verify_cljdoc (-> (p/shell {:out :string}
"curl -fsSL https://raw.githubusercontent.com/cljdoc/cljdoc/master/script/verify-cljdoc-edn")
(p/shell "bash -s doc/cljdoc.edn"))
release {:doc "Perform lein release tasks for [Clojure VERSION] and [BUMP field]. BUMP controls which field in the version string will be incremented in the *next* snapshot version. Typically this is either \"major\", \"minor\", or \"patch\"."
:tasks (shell lein "with-profile" (str "-user,+" clj-version) "release" bump)}
deploy {:doc "Deploy to clojars for [Clojure VERSION]. Auth is controlled by the `clojars_username` and `clojars_password` env vars."
;; Deploying requires the caller to set environment variables as
;; specified in project.clj to provide a login and password to the
;; artifact repository.
:task (shell lein "with-profile" (str "-user,+" clj-version) "deploy" "clojars")}
clean {:doc "Clean artifacts."
:task (shell lein "clean")}}}