-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.clj
41 lines (35 loc) · 1.18 KB
/
build.clj
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
(ns build
(:require [clojure.tools.build.api :as b]
[org.corfield.build :as bb]))
(defn- process-result
[{:keys [exit out err]}]
(when out (println out))
(when err (println err))
(when-not (zero? exit)
(System/exit exit)))
(defn test-clj
[opts]
(println "\nRunning CLJ Tests...")
(bb/run-tests opts)
opts)
(defn test-cljs
[opts]
(println "\nRunning CLJS Tests...")
(process-result (b/process {:command-args ["clojure" "-M:test-cljs" "compile" "test"]}))
(process-result (b/process {:command-args ["node" "out/node-tests.js"]}))
opts)
(defn example
[opts]
;; @todo Pass args to example file.
(process-result (b/process {:command-args ["clojure" "-M:examples" "-m" (name (:ns opts))]})))
(defn examples
[opts]
(doseq [example-ns ['erp12.ga-clj.examples.alphabet
'erp12.ga-clj.examples.symbolic-regression
'erp12.ga-clj.examples.alphabet-annealing]]
(println "\nRunning example" example-ns)
;; @todo Pass smaller population sizes and max generations to examples via command args to keep CI fast.
(example (assoc opts :ns example-ns))))
(defn ci
[opts]
(-> opts test-clj test-cljs examples))