Skip to content

Commit

Permalink
Merge pull request #7 from eval/rename-ns
Browse files Browse the repository at this point in the history
Rename ns
  • Loading branch information
eval authored Oct 27, 2023
2 parents 2d6993e + 1b44f74 commit 99e2b84
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
with:
cli: latest
- name: Run tests
run: clojure -X:test
run: clojure -T:build test
7 changes: 3 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Release
name: Test, build and (possibly) deploy

on:
push:
Expand All @@ -22,9 +22,8 @@ jobs:
with:
cli: latest

- name: Build and deploy to clojars
continue-on-error: true
- name: Test, build and (possibly) deploy to clojars
env:
CLOJARS_USERNAME: ${{ secrets.CLOJARS_USERNAME }}
CLOJARS_PASSWORD: ${{ secrets.CLOJARS_PASSWORD }}
run: clojure -T:build release :git-version $(printf '"%s"' $(git describe --tags))
run: clojure -T:build release :git-version $(printf '"%s"' $(git describe --tags)) :deploy/only-jar-version-type :full-and-snapshot
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Try it out using [deps-try](https://github.com/eval/deps-try/blob/master/README.
``` clojure
$ deps-try io.github.eval/malli-select metosin/malli

user=> (require '[dk.thinkcreate.malli-select :as ms])
user=> (require '[malli-select.core :as ms])
user=> (def Person
[:map
[:name string?]
Expand Down Expand Up @@ -83,7 +83,7 @@ Available:
user=> (ms/select Person [:a] {:verify-selection false})
```

See [the tests](./test/dk/thinkcreate/malli_select_test.clj) for more.
See [the tests](./test/malli_select/core_test.clj) for more.


## LICENSE
Expand Down
34 changes: 21 additions & 13 deletions build.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
[deps-deploy.deps-deploy :as dd]
[clojure.java.io :as io]))

(set! clojure.core/*print-namespace-maps* false)

;; Monkey patch to have provided dependencies in the POM
;; SOURCE https://clojurians.zulipchat.com/#narrow/stream/180378-slack-archive/topic/tools-deps/near/326868214
(xml/alias-uri 'pom "http://maven.apache.org/POM/4.0.0")
Expand All @@ -28,7 +30,7 @@
cmds (b/java-command
{:basis basis
:main 'clojure.main
:main-args (doto (reduce into ["-m" "cognitect.test-runner"] opts) prn)})
:main-args (doto (reduce into ["-m" "cognitect.test-runner"] opts) #_prn)})
{:keys [exit]} (b/process cmds)]
(when-not (zero? exit) (throw (ex-info "Tests failed" {}))))
opts)
Expand Down Expand Up @@ -110,27 +112,33 @@
:content
first))

(defn deploy "Deploy the JAR to Clojars." [opts]
(defn deploy [{:deploy/keys [only-jar-version-type] :or {only-jar-version-type :full} :as opts}]
{:pre [(#{:full-and-snapshot :full :all} only-jar-version-type)]}
(let [{:keys [jar-file] :as opts} (jar-opts opts)
pom-file (b/pom-path (select-keys opts [:lib :class-dir]))
version (pom-path->version pom-file)
deployable-version-re #"^\d+\.\d+\.\d+(-SNAPSHOT)?$"]
(when-not (re-find deployable-version-re version)
(throw (ex-info (str "Can't deploy build-version"
" (version: "
(pr-str version) ")") {})))
(dd/deploy {:installer :remote
:artifact (b/resolve-path jar-file)
:pom-file pom-file}))
opts)
[v s] (re-find #"^\d+\.\d+\.\d+(-SNAPSHOT)?$" version)
deploy? (or (= :all only-jar-version-type)
(and (= :full-and-snapshot only-jar-version-type) v)
(and (= :full only-jar-version-type)
v
(not s)))]
(if deploy?
(dd/deploy {:installer :remote
:artifact (b/resolve-path jar-file)
:pom-file pom-file})
(println (str \newline "Skipping deploy of version " version " given only-jar-release-type " only-jar-version-type)))
opts))


(defn release
"build&deploy"
"Test, build and deploy"
[opts]
(prn :release-opts opts)
(deploy (build (test opts))))

(comment
(set! clojure.core/*print-namespace-maps* false)


(def jopts (jar-opts {}))
jopts
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns dk.thinkcreate.malli-select
(ns malli-select.core
"Select a subset of a malli schema."
(:require [clojure.pprint :refer [pprint]]
[malli.core :as m]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
(ns dk.thinkcreate.malli-select-test
(ns malli-select.core-test
(:require
[clojure.pprint :refer [pprint]]
[clojure.test :as t :refer [deftest is testing]]
[dk.thinkcreate.malli-select :as sut :refer [select selector]]
[malli-select.core :as sut :refer [select selector]]
[malli.core :as m]
[malli.util :as mu]))

Expand Down

0 comments on commit 99e2b84

Please sign in to comment.