diff --git a/.circleci/config.yml b/.circleci/config.yml index 0018583..2798c19 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,10 +10,10 @@ jobs: - checkout - restore_cache: key: next-jdbc-{{ checksum "deps.edn" }} - - run: clojure -P -A:test + - run: clojure -P -M:build:test - save_cache: paths: - ~/.m2 - ~/.gitlibs key: next-jdbc-{{ checksum "deps.edn" }} - - run: clojure -X:test + - run: clojure -T:build ci diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2dbf790..b903abf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: with: tools-deps: '1.10.3.933' - name: Run Tests - run: clojure -X:test + run: clojure -T:build ci build-graalvm-old: runs-on: ubuntu-latest @@ -39,7 +39,7 @@ jobs: with: tools-deps: '1.10.3.933' - name: Run Tests - run: clojure -X:test + run: clojure -T:build ci build-graalvm-new: runs-on: ubuntu-latest @@ -59,4 +59,4 @@ jobs: with: tools-deps: '1.10.3.933' - name: Run Tests - run: clojure -X:test + run: clojure -T:build ci diff --git a/CHANGELOG.md b/CHANGELOG.md index 741cdba..e1c6ac0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ Only accretive/fixative changes will be made from now on. +* 1.2.next in progress + * Switch to `tools.build` for running tests and JAR building etc. + * 1.2.689 -- 2021-08-01 * Address #173 by extending `DatafiableRow` to `ResultSet` so there's a public method to call on (rows of) a JDBC result set directly. * Address #171 by clarifying that you cannot use `clojure.java.jdbc` functions inside `next.jdbc/with-transaction` and discuss how to migrate transaction-based code in the **Migration** guide. diff --git a/build.clj b/build.clj index 3473fbe..94c1e79 100644 --- a/build.clj +++ b/build.clj @@ -1,4 +1,13 @@ (ns build + "next.jdbc's build script. + + clojure -T:build run-tests + + clojure -T:build ci + + For more information, run: + + clojure -A:deps -T:build help/doc" (:require [clojure.tools.build.api :as b] [clojure.tools.deps.alpha :as t])) @@ -8,11 +17,11 @@ (def basis (b/create-basis {:project "deps.edn"})) (def jar-file (format "target/%s-%s.jar" (name lib) version)) -(defn clean [_] +(defn clean "Remove the target folder." [_] (println "\nCleaning target...") (b/delete {:path "target"})) -(defn jar [_] +(defn jar "Build the library JAR file." [_] (println "\nWriting pom.xml...") (b/write-pom {:class-dir class-dir :lib lib @@ -26,8 +35,7 @@ (b/jar {:class-dir class-dir :jar-file jar-file})) -(defn run-tests - [_] +(defn run-tests "Run regular tests." [_] (let [basis (b/create-basis {:aliases [:test]}) combined (t/combine-aliases basis [:test]) cmds (b/java-command {:basis basis @@ -38,5 +46,5 @@ (when-not (zero? exit) (throw (ex-info "Tests failed" {}))))) -(defn ci [opts] +(defn ci "Run the CI pipeline of tests (and build the JAR)." [opts] (-> opts (run-tests) (clean) (jar))) diff --git a/deps.edn b/deps.edn index cddf73d..d0236dc 100644 --- a/deps.edn +++ b/deps.edn @@ -4,8 +4,11 @@ camel-snake-kebab/camel-snake-kebab {:mvn/version "0.4.2"}} :aliases - {:build {:deps {io.github.clojure/tools.build {:git/tag "v0.1.7" :git/sha "8a3abc2"}} + {;; for help: clojure -A:deps -T:build help/doc + :build {:deps {io.github.clojure/tools.build {:git/tag "v0.1.7" :git/sha "8a3abc2"}} :ns-default build} + + ;; running tests/checks of various kinds: :test {:extra-paths ["test"] :extra-deps {org.clojure/test.check {:mvn/version "1.1.0"} io.github.cognitect-labs/test-runner @@ -40,10 +43,15 @@ 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} + ;; so we can run both ways: + :exec-fn cognitect.test-runner.api/test + :main-opts ["-m" "cognitect.test-runner"]} + + ;; first run: clojure -T:build ci + ;; then: clojure -T:deploy target/n :deploy - {:replace-deps {slipset/deps-deploy {:git/url "https://github.com/slipset/deps-deploy" - :sha "b4359c5d67ca002d9ed0c4b41b710d7e5a82e3bf"}} + {:deps {slipset/deps-deploy {:git/url "https://github.com/slipset/deps-deploy" + :sha "b4359c5d67ca002d9ed0c4b41b710d7e5a82e3bf"}} :exec-fn deps-deploy.deps-deploy/deploy :exec-args {:installer :remote :pom-file "target/classes/META-INF/maven/com.github.seancorfield/next.jdbc/pom.xml"}}}}