switch to tools.build for ci

This commit is contained in:
Sean Corfield 2021-08-12 19:43:04 -07:00
parent 237ff37988
commit 4b50f19e39
5 changed files with 33 additions and 14 deletions

View file

@ -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

View file

@ -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

View file

@ -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.

View file

@ -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)))

View file

@ -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,9 +43,14 @@
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<TAB>
:deploy
{:replace-deps {slipset/deps-deploy {:git/url "https://github.com/slipset/deps-deploy"
{: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