add multi-version testing for CI
This commit is contained in:
parent
3ebe2732c1
commit
4f52e2a7ab
2 changed files with 36 additions and 8 deletions
32
build.clj
32
build.clj
|
|
@ -37,19 +37,39 @@
|
|||
(b/jar {:class-dir class-dir
|
||||
:jar-file jar-file}))
|
||||
|
||||
(defn run-tests "Run regular tests." [_]
|
||||
(let [basis (b/create-basis {:aliases [:test]})
|
||||
combined (t/combine-aliases basis [:test])
|
||||
(defn- run-task
|
||||
[aliases]
|
||||
(println "\nRunning task for:" aliases)
|
||||
(let [basis (b/create-basis {:aliases aliases})
|
||||
combined (t/combine-aliases basis aliases)
|
||||
cmds (b/java-command {:basis basis
|
||||
:java-opts (:jvm-opts combined)
|
||||
:main 'clojure.main
|
||||
:main-args ["-m" "cognitect.test-runner"]})
|
||||
:main-args (:main-opts combined)})
|
||||
{:keys [exit]} (b/process cmds)]
|
||||
(when-not (zero? exit)
|
||||
(throw (ex-info "Tests failed" {})))))
|
||||
(throw (ex-info (str "Task failed for: " aliases) {})))))
|
||||
|
||||
|
||||
(defn run-tests
|
||||
"Run regular tests.
|
||||
|
||||
Optionally specify :aliases:
|
||||
[:1.10] -- test against Clojure 1.10.3 (the default)
|
||||
[:master] -- test against Clojure 1.11 master snapshot"
|
||||
[{:keys [aliases] :as opts}]
|
||||
(run-task (into [:test] aliases))
|
||||
opts)
|
||||
|
||||
(defn ci "Run the CI pipeline of tests (and build the JAR)." [opts]
|
||||
(-> opts (run-tests) (clean) (jar)))
|
||||
(-> opts
|
||||
(as-> opts
|
||||
(reduce (fn [opts alias]
|
||||
(run-tests (assoc opts :aliases [alias :runner])))
|
||||
opts
|
||||
[:1.10 :master]))
|
||||
(clean)
|
||||
(jar)))
|
||||
|
||||
(defn deploy "Deploy the JAR to Clojars." [opts]
|
||||
(dd/deploy (merge {:installer :remote :artifact jar-file
|
||||
|
|
|
|||
12
deps.edn
12
deps.edn
|
|
@ -9,8 +9,12 @@
|
|||
io.github.slipset/deps-deploy {:sha "b4359c5d67ca002d9ed0c4b41b710d7e5a82e3bf"}}
|
||||
:ns-default build}
|
||||
|
||||
;; versions to test against:
|
||||
:1.10 {:override-deps {org.clojure/clojure {:mvn/version "1.10.3"}}}
|
||||
:master {:override-deps {org.clojure/clojure {:mvn/version "1.11.1-master-SNAPSHOT"}}}
|
||||
|
||||
;; running tests/checks of various kinds:
|
||||
:test {:extra-paths ["test"]
|
||||
:test {:extra-paths ["test"] ; can also run clojure -X:test
|
||||
:extra-deps {org.clojure/test.check {:mvn/version "1.1.0"}
|
||||
io.github.cognitect-labs/test-runner
|
||||
{:git/tag "v0.4.0" :git/sha "334f2e2"}
|
||||
|
|
@ -44,4 +48,8 @@
|
|||
org.apache.logging.log4j/log4j-jul {:mvn/version "2.14.1"}
|
||||
org.apache.logging.log4j/log4j-slf4j-impl {:mvn/version "2.14.1"}}
|
||||
:jvm-opts ["-Dlog4j2.configurationFile=log4j2-info.properties"]
|
||||
:exec-fn cognitect.test-runner.api/test}}}
|
||||
:exec-fn cognitect.test-runner.api/test}
|
||||
|
||||
;; various "runners" for tests/CI:
|
||||
:runner
|
||||
{:main-opts ["-m" "cognitect.test-runner"]}}}
|
||||
|
|
|
|||
Loading…
Reference in a new issue