diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..eb7f438 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,47 @@ +name: Clojure Tests + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + test: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + java-version: '17' + distribution: 'temurin' + + - name: Install clojure tools + uses: DeLaGuardo/setup-clojure@12.5 + with: + cli: 1.11.2.1446 # Clojure CLI based on tools.deps + clj-kondo: 2022.05.31 + cljfmt: 0.10.2 + cljstyle: 0.15.0 + cmd-exe-workaround: 'latest' + zprint: 1.2.3 + + - name: Cache clojure dependencies + uses: actions/cache@v3 + with: + path: | + ~/.m2/repository + ~/.gitlibs + ~/.deps.clj + key: cljdeps-${{ hashFiles('deps.edn') }} + restore-keys: cljdeps- + + - name: Install libassimp + run: sudo apt-get update && sudo apt-get install -y libassimp-dev + + - name: Run tests + run: clojure -M:dev:test diff --git a/deps.edn b/deps.edn index 0b4a40a..988d646 100644 --- a/deps.edn +++ b/deps.edn @@ -2,7 +2,6 @@ :deps {net.mikera/core.matrix {:mvn/version "0.62.0"} ;; org.clojars.cartesiantheatrics/clj-manifold3d {:local/root "../clj-manifold3d"} org.clojars.cartesiantheatrics/clj-manifold3d {:mvn/version "0.0.18"} - camel-snake-kebab/camel-snake-kebab {:mvn/version "0.4.3"} net.mikera/vectorz-clj {:mvn/version "0.48.0"} metosin/malli {:mvn/version "0.11.0"} scad-clj/scad-clj {:mvn/version "0.5.3"}} @@ -11,6 +10,11 @@ {:extra-deps {org.clojars.cartesiantheatrics/manifold3d$linux-x86_64 {:mvn/version "1.0.77"}}} + :test {:extra-paths ["test/main"] + :extra-deps {lambdaisland/kaocha {:mvn/version "1.88.1376"} + org.clojure/clojure {:mvn/version "1.11.2"}} + :main-opts ["-m" "kaocha.runner"]} + :deploy {:extra-paths ["build"] :extra-deps {badigeon/badigeon {:mvn/version "1.7"} diff --git a/src/main/plexus/core.clj b/src/main/plexus/core.clj index c30756d..6c7acfc 100644 --- a/src/main/plexus/core.clj +++ b/src/main/plexus/core.clj @@ -2,12 +2,12 @@ (:refer-clojure :exclude [set]) (:require [clojure.java.io :as io] - [plexus.utils :as u] [plexus.schema :as schema :refer [validate-form]] - [plexus.transforms :as tf] [clj-manifold3d.core :as m] [malli.core :as ma] - [plexus.impl :as impl]) + [plexus.impl :as impl] + [clojure.repl :refer [demunge]] + [clojure.string :as s]) (:import [plexus.impl Form])) @@ -16,10 +16,10 @@ (cond (vector? fn-object) (into [(first fn-object)] (map pretty-demunge (subvec fn-object 1))) :else - (let [dem-fn (clojure.repl/demunge (str fn-object)) + (let [dem-fn (demunge (str fn-object)) pretty (second (re-find #"(.*?\/.*?)(--\d+)?[@].*" dem-fn))] (symbol - (if pretty (peek (clojure.string/split pretty #"/")) dem-fn))))) + (if pretty (peek (s/split pretty #"/")) dem-fn))))) (defn- get-map-key-schemas [schema] diff --git a/src/test/plexus/core_test.clj b/test/main/plexus/core_test.clj similarity index 88% rename from src/test/plexus/core_test.clj rename to test/main/plexus/core_test.clj index 35b5c44..986d5d9 100644 --- a/src/test/plexus/core_test.clj +++ b/test/main/plexus/core_test.clj @@ -1,4 +1,4 @@ -(ns plexus.core_test +(ns plexus.core-test (:require [clj-manifold3d.core :as m] [clojure.test :as t] @@ -14,7 +14,6 @@ (def pi Math/PI) (def pi|2 (/ pi 2)) -(def pi|2 (/ pi 2)) (def pi|3 (/ pi 3)) (def pi|4 (/ pi 4)) (def pow #(Math/pow %1 %2)) @@ -61,19 +60,3 @@ 1 (p/right :angle pi|2) 2 (p/up :angle pi|2) 3 (p/down :angle pi|2)))))))))) - - -(t/deftest test-hull) - -(t/deftest test-loft) - -(t/deftest test-translate) - -(t/deftest test-rotate) - -(t/deftest test-offset) - -(t/deftest test-insert) - -(t/deftest test-) -(test-extrudes) diff --git a/tests.edn b/tests.edn new file mode 100644 index 0000000..40b0a5b --- /dev/null +++ b/tests.edn @@ -0,0 +1 @@ +#kaocha/v1 {:test-paths "test/main"}