From 078a9f94430e6da2c61292cedfcc047cca15994c Mon Sep 17 00:00:00 2001 From: JMassa Date: Thu, 23 Mar 2023 00:20:23 +0100 Subject: [PATCH 1/5] fix: use backward compatible abs function --- src/datahike/query_stats.cljc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/datahike/query_stats.cljc b/src/datahike/query_stats.cljc index f45734d93..f1ad0de61 100644 --- a/src/datahike/query_stats.cljc +++ b/src/datahike/query_stats.cljc @@ -1,4 +1,5 @@ (ns datahike.query-stats + (:refer-clojure :exclude [abs]) (:require [clojure.set :as set] [datahike.tools :as dt])) @@ -7,6 +8,11 @@ :cljs (let [y (Math/pow 10 precision)] (/ (.round js/Math (* y x)) y)))) +(defn abs + "Only available since Clojure 1.11 and ClojureScript 1.11.10 in core namespaces." + [x] + (Math/abs x)) + (defn get-stats [context] {:rels (mapv (fn [rel] {:rows (count (:tuples rel)) :bound (set (keys (:attrs rel)))}) From 5c8441c78e5e9b53075cee0639ae36807111fa87 Mon Sep 17 00:00:00 2001 From: JMassa Date: Thu, 23 Mar 2023 01:15:14 +0100 Subject: [PATCH 2/5] chore: add clj backwards compatibility tests --- bb/src/tools/test.clj | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/bb/src/tools/test.clj b/bb/src/tools/test.clj index 22a54712b..b3f03c78f 100644 --- a/bb/src/tools/test.clj +++ b/bb/src/tools/test.clj @@ -2,15 +2,12 @@ (:refer-clojure :exclude [test]) (:require [babashka.fs :as fs] [babashka.process :as p] + [clojure.string :as str] [tools.build :as build])) (defn clj [opts & args] (apply p/shell opts "clojure" args)) (defn git [opts & args] (apply p/shell opts "git" args)) -(defn kaocha [& args] - (apply clj {:extra-env {"TIMBRE_LEVEL" ":warn"}} - "-M:test" "-m" "kaocha.runner" args)) - (defn back-compat [config] (println "Testing backwards compatibility") (let [old-version-dir "datahike-old" @@ -49,12 +46,27 @@ (p/shell "./bb/resources/native-image-tests/run-native-image-tests") (println "Native image cli missing. Please run 'bb ni-cli' and try again."))) +(defn kaocha-with-aliases [aliases & args] + (apply clj {:extra-env {"TIMBRE_LEVEL" ":warn"}} + (str "-M:test" (str/join (map #(str ":" (name %)) aliases))) + "-m" "kaocha.runner" args)) + +(defn kaocha [& args] + (apply kaocha-with-aliases [] args)) + (defn specs [] (kaocha "--focus" "specs" "--plugin" "kaocha.plugin/orchestra")) +(defn clj-back-compat + "version-alias must be defined in deps.edn" + [version-alias & args] + (apply kaocha-with-aliases [version-alias] args)) + (defn all [config] (kaocha "--skip" "specs") (specs) + (clj-back-compat :1.10) + (clj-back-compat :1.9) (back-compat config) (native-image)) @@ -63,6 +75,7 @@ (case (first args) "native-image" (native-image) "back-compat" (back-compat config) + "clj" (apply clj-back-compat (rest args)) "specs" (specs) (apply kaocha "--focus" args)) (all config))) From 465fb911dfde092a7a8bc457336f6524b91b3201 Mon Sep 17 00:00:00 2001 From: JMassa Date: Thu, 23 Mar 2023 01:15:36 +0100 Subject: [PATCH 3/5] ci: add clj back-compat tests --- .circleci/config.yml | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 163818f2b..1d458527b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -138,13 +138,39 @@ jobs: - attach_workspace: at: /home/circleci - run: - name: Run unittests for hitchhiker-tree index + name: Run unittests with specs activated command: bb test specs no_output_timeout: 5m - save_cache: key: deps-{{ checksum "deps.edn" }} paths: - /home/circleci/.m2 + clj-1.10-test: + executor: tools/clojurecli + steps: + - attach_workspace: + at: /home/circleci + - run: + name: Run unittests with clojure 1.10.0 + command: bb test clj :1.10 + no_output_timeout: 5m + - save_cache: + key: deps-{{ checksum "deps.edn" }} + paths: + - /home/circleci/.m2 + clj-1.9-test: + executor: tools/clojurecli + steps: + - attach_workspace: + at: /home/circleci + - run: + name: Run unittests with clojure 1.9.0 + command: bb test clj :1.9 + no_output_timeout: 5m + - save_cache: + key: deps-{{ checksum "deps.edn" }} + paths: + - /home/circleci/.m2 native-image-test: executor: tools/clojurecli steps: From 9e93a041e302a2b482af19f4d882e1036ec6b0fc Mon Sep 17 00:00:00 2001 From: JMassa Date: Thu, 23 Mar 2023 01:25:26 +0100 Subject: [PATCH 4/5] fix: tests in ci pipeline --- .circleci/config.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1d458527b..cd8088a2b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -145,7 +145,7 @@ jobs: key: deps-{{ checksum "deps.edn" }} paths: - /home/circleci/.m2 - clj-1.10-test: + clj-1-10-test: executor: tools/clojurecli steps: - attach_workspace: @@ -158,7 +158,7 @@ jobs: key: deps-{{ checksum "deps.edn" }} paths: - /home/circleci/.m2 - clj-1.9-test: + clj-1-9-test: executor: tools/clojurecli steps: - attach_workspace: @@ -269,6 +269,18 @@ workflows: context: dockerhub-deploy requires: - build + - specs-test: + context: dockerhub-deploy + requires: + - build + - clj-1-10-test: + context: dockerhub-deploy + requires: + - build + - clj-1-9-test: + context: dockerhub-deploy + requires: + - build - native-image-test: context: dockerhub-deploy requires: @@ -294,6 +306,9 @@ workflows: - format - persistent-set-test - hitchhiker-tree-test + - specs-test + - clj-1-10-test + - clj-1-9-test - backward-compatibility-test - native-image-test - integration-test From 771542986e7b94bac9a648c34a3aaf968c6f3fa1 Mon Sep 17 00:00:00 2001 From: JMassa Date: Thu, 23 Mar 2023 01:27:04 +0100 Subject: [PATCH 5/5] fix: tests in ci pipeline --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index cd8088a2b..1ccaa95e0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -269,7 +269,7 @@ workflows: context: dockerhub-deploy requires: - build - - specs-test: + - spec-test: context: dockerhub-deploy requires: - build @@ -306,7 +306,7 @@ workflows: - format - persistent-set-test - hitchhiker-tree-test - - specs-test + - spec-test - clj-1-10-test - clj-1-9-test - backward-compatibility-test