From c810a1b23df7aaf4a77745b0b5ecde3c651f1b5b Mon Sep 17 00:00:00 2001 From: Gert Goet Date: Fri, 27 Oct 2023 12:30:15 +0200 Subject: [PATCH 1/2] Rename ns dk.thinkcreate.* -> malli-select.* This is more in line with malli. --- README.md | 4 ++-- .../thinkcreate/malli_select.clj => malli_select/core.clj} | 2 +- .../malli_select_test.clj => malli_select/core_test.clj} | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) rename src/{dk/thinkcreate/malli_select.clj => malli_select/core.clj} (99%) rename test/{dk/thinkcreate/malli_select_test.clj => malli_select/core_test.clj} (99%) diff --git a/README.md b/README.md index e547b09..78da1d0 100644 --- a/README.md +++ b/README.md @@ -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?] @@ -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 diff --git a/src/dk/thinkcreate/malli_select.clj b/src/malli_select/core.clj similarity index 99% rename from src/dk/thinkcreate/malli_select.clj rename to src/malli_select/core.clj index f97537e..59f69c2 100644 --- a/src/dk/thinkcreate/malli_select.clj +++ b/src/malli_select/core.clj @@ -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] diff --git a/test/dk/thinkcreate/malli_select_test.clj b/test/malli_select/core_test.clj similarity index 99% rename from test/dk/thinkcreate/malli_select_test.clj rename to test/malli_select/core_test.clj index a96b9b8..b9dc36b 100644 --- a/test/dk/thinkcreate/malli_select_test.clj +++ b/test/malli_select/core_test.clj @@ -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])) From 1b44f748dd7128211dd7c759cd044c15fd55d129 Mon Sep 17 00:00:00 2001 From: Gert Goet Date: Fri, 27 Oct 2023 14:31:16 +0200 Subject: [PATCH 2/2] Refactor ci --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 7 +++---- build.clj | 34 +++++++++++++++++++++------------- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ede2a6e..6b83a0c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,4 +16,4 @@ jobs: with: cli: latest - name: Run tests - run: clojure -X:test + run: clojure -T:build test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ae389fa..01a0293 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,5 @@ --- -name: Release +name: Test, build and (possibly) deploy on: push: @@ -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 diff --git a/build.clj b/build.clj index 3f4ce47..fd356be 100644 --- a/build.clj +++ b/build.clj @@ -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") @@ -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) @@ -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