From 6d773c0f0308b1fb1e1a2698c0df09cd48521d6d Mon Sep 17 00:00:00 2001 From: janos erdos Date: Fri, 19 Jul 2024 00:18:04 +0200 Subject: [PATCH 01/34] feat: rm leiningen --- build.clj | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ deps.edn | 21 ++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 build.clj create mode 100644 deps.edn diff --git a/build.clj b/build.clj new file mode 100644 index 00000000..2fdb1499 --- /dev/null +++ b/build.clj @@ -0,0 +1,57 @@ +(ns build + (:require [clojure.tools.build.api :as b])) + +(def build-folder "target") +(def jar-content (str build-folder "/classes")) + +(def basis (b/create-basis {:project "deps.edn"})) +(def version "0.0.1") +(def app-name "stencil-core") +(def uber-file-name (format "%s/%s-%s-standalone.jar" build-folder app-name version)) ; path for result uber file + +(defn clean [_] + (b/delete {:path build-folder}) + (println (format "Build folder \"%s\" removed" build-folder))) + + +(defn compile-java [_] + (clean nil) + (println :should-compile-java-here) + (b/javac {:src-dirs ["java-src"] + :basis basis + :class-dir "target/classes" + :javac-opts ["-source" "8" "-target" "8"]})) + +(defn jar [_] + (clean nil) + (compile-java nil) + (b/compile-clj {:basis basis ; compile clojure code + :src-dirs ["src"] + :class-dir jar-content}) + (println "jar done?")) + + +(defn uber [_] + (clean nil) + + ;(b/copy-dir {:src-dirs ["resources"] ; copy resources + ; :target-dir jar-content}) + + (b/compile-clj {:basis basis ; compile clojure code + :src-dirs ["src"] + :class-dir jar-content}) + + (b/uber {:class-dir jar-content ; create uber file + :uber-file uber-file-name + :basis basis + :main 'dev.core}) ; here we specify the entry point for uberjar + + (println (format "Uber file created: \"%s\"" uber-file-name))) + +(defn test [_] + (clean nil) + (compile-java nil) + ;(compile-clj nil) +; run test cases? + + ) \ No newline at end of file diff --git a/deps.edn b/deps.edn new file mode 100644 index 00000000..87a17525 --- /dev/null +++ b/deps.edn @@ -0,0 +1,21 @@ +{:deps {org.clojure/clojure {:mvn/version "1.11.1"} + org.clojure/data.xml {:mvn/version "0.2.0-alpha8"} + org.slf4j/slf4j-api {:mvn/version "2.0.9"}} + :paths ["src" "target/classes"] + :deps/prep-lib + {:ensure "target/classes" + :alias :build + :fn compile-java} + :aliases + {:build {:deps {io.github.clojure/tools.build {:git/tag "v0.8.1" :git/sha "7d40500"}} + :ns-default build} + + :lint/clj-kondo + {:extra-deps {clj-kondo/clj-kondo {:mvn/version "2024.05.24"}} + :main-opts ["-m" "clj-kondo.main" "--lint" "src"]} + + :test {:extra-paths ["test" "test-resources"] + :extra-deps {lambdaisland/kaocha {:mvn/version "1.87.1366"} + org.slf4j/slf4j-simple {:mvn/version "1.7.32"}} + :main-opts ["-m" "kaocha.runner"] + :jvm-opts ["-Dorg.slf4j.simpleLogger.defaultLogLevel=debug"]}}} \ No newline at end of file From 0ae3ed72854b56417dd8e35d83df8bfea549b445 Mon Sep 17 00:00:00 2001 From: janos erdos Date: Fri, 19 Jul 2024 00:23:06 +0200 Subject: [PATCH 02/34] wip: test on pr flow --- .github/workflows/pr_flow.yml | 24 ++++++++++++------------ test/stencil/log_test.clj | 7 ++++--- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.github/workflows/pr_flow.yml b/.github/workflows/pr_flow.yml index e305cd51..273388f3 100644 --- a/.github/workflows/pr_flow.yml +++ b/.github/workflows/pr_flow.yml @@ -13,20 +13,20 @@ jobs: steps: - uses: actions/checkout@v2 - name: Install dependencies - run: lein deps + run: clj -P - name: Compile Java - run: lein javac - - name: Coverage - run: lein coverage - - name: Codecov - uses: codecov/codecov-action@v2 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./target/coverage/codecov.json - - name: Run Java Tests - run: lein pom && mvn test --batch-mode --fail-at-end + run: clj -T:build compile-java + #- name: Coverage + # run: lein coverage + #- name: Codecov + # uses: codecov/codecov-action@v2 + # with: + # token: ${{ secrets.CODECOV_TOKEN }} + # files: ./target/coverage/codecov.json + #- name: Run Java Tests + # run: lein pom && mvn test --batch-mode --fail-at-end - name: Unit tests in Clojure - run: lein test + run: clj -M:test - name: Test Report uses: dorny/test-reporter@v1 if: success() || failure() diff --git a/test/stencil/log_test.clj b/test/stencil/log_test.clj index a45389c9..aa487924 100644 --- a/test/stencil/log_test.clj +++ b/test/stencil/log_test.clj @@ -1,6 +1,6 @@ (ns stencil.log-test - (:require [stencil.log :as log] - [clojure.test :refer [deftest testing]])) + (:require [stencil.log] + [clojure.test :refer [deftest testing is]])) (deftest test-logs (testing "Test log macros of various arities" @@ -12,4 +12,5 @@ c [["message without params"] ["message with param: {}" 1] ["message with params: {} {}" 1 2]]] - (eval (list* x c))))) + (eval (list* x c)) + (is true)))) From 5d66cdfed75a4ed30db390da3e41cbe3ba08521a Mon Sep 17 00:00:00 2001 From: janos erdos Date: Fri, 19 Jul 2024 00:48:04 +0200 Subject: [PATCH 03/34] make codecov work on pr flow --- .github/workflows/pr_flow.yml | 14 +++++++------- deps.edn | 7 +++++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr_flow.yml b/.github/workflows/pr_flow.yml index 273388f3..3c4ddcb4 100644 --- a/.github/workflows/pr_flow.yml +++ b/.github/workflows/pr_flow.yml @@ -16,13 +16,13 @@ jobs: run: clj -P - name: Compile Java run: clj -T:build compile-java - #- name: Coverage - # run: lein coverage - #- name: Codecov - # uses: codecov/codecov-action@v2 - # with: - # token: ${{ secrets.CODECOV_TOKEN }} - # files: ./target/coverage/codecov.json + - name: Coverage + run: clj -M:coverage + - name: Codecov + uses: codecov/codecov-action@v2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./target/coverage/codecov.json #- name: Run Java Tests # run: lein pom && mvn test --batch-mode --fail-at-end - name: Unit tests in Clojure diff --git a/deps.edn b/deps.edn index 87a17525..27c01d4e 100644 --- a/deps.edn +++ b/deps.edn @@ -14,6 +14,13 @@ {:extra-deps {clj-kondo/clj-kondo {:mvn/version "2024.05.24"}} :main-opts ["-m" "clj-kondo.main" "--lint" "src"]} + :coverage + {:extra-deps {cloverage/cloverage {:mvn/version "1.2.4"}} + :extra-paths ["test"] + :main-opts ["-m" "cloverage.coverage" + "--codecov" + "-p" "src" "-s" "test"]} + :test {:extra-paths ["test" "test-resources"] :extra-deps {lambdaisland/kaocha {:mvn/version "1.87.1366"} org.slf4j/slf4j-simple {:mvn/version "1.7.32"}} From 5bcfd2ee01c6f9697f869b7f599c2ae6d4ce4db7 Mon Sep 17 00:00:00 2001 From: janos erdos Date: Fri, 19 Jul 2024 00:49:49 +0200 Subject: [PATCH 04/34] wip: pr flow --- .github/workflows/pr_flow.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pr_flow.yml b/.github/workflows/pr_flow.yml index 3c4ddcb4..4f8e9c81 100644 --- a/.github/workflows/pr_flow.yml +++ b/.github/workflows/pr_flow.yml @@ -12,6 +12,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: Install Clojure tools + uses: DeLaGuardo/setup-clojure@10.3 - name: Install dependencies run: clj -P - name: Compile Java From dada3ed653199cca0b134c4d46f718a76de932b5 Mon Sep 17 00:00:00 2001 From: janos erdos Date: Fri, 19 Jul 2024 00:51:41 +0200 Subject: [PATCH 05/34] wip: pr flow --- .github/workflows/pr_flow.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pr_flow.yml b/.github/workflows/pr_flow.yml index 4f8e9c81..dc828be9 100644 --- a/.github/workflows/pr_flow.yml +++ b/.github/workflows/pr_flow.yml @@ -14,6 +14,8 @@ jobs: - uses: actions/checkout@v2 - name: Install Clojure tools uses: DeLaGuardo/setup-clojure@10.3 + with: + cli: latest - name: Install dependencies run: clj -P - name: Compile Java From 150e3f533979cabf6f7da81fb0ee33e5b93be340 Mon Sep 17 00:00:00 2001 From: janos erdos Date: Fri, 19 Jul 2024 00:52:50 +0200 Subject: [PATCH 06/34] wip: pr flow --- .github/workflows/pr_flow.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr_flow.yml b/.github/workflows/pr_flow.yml index dc828be9..48a25273 100644 --- a/.github/workflows/pr_flow.yml +++ b/.github/workflows/pr_flow.yml @@ -17,11 +17,11 @@ jobs: with: cli: latest - name: Install dependencies - run: clj -P + run: clojure -P - name: Compile Java - run: clj -T:build compile-java + run: clojure -T:build compile-java - name: Coverage - run: clj -M:coverage + run: clojure -M:coverage - name: Codecov uses: codecov/codecov-action@v2 with: @@ -30,7 +30,7 @@ jobs: #- name: Run Java Tests # run: lein pom && mvn test --batch-mode --fail-at-end - name: Unit tests in Clojure - run: clj -M:test + run: clojure -M:test - name: Test Report uses: dorny/test-reporter@v1 if: success() || failure() From 3e199cbf0d6608bb0e07fde28872502b17d2d4c9 Mon Sep 17 00:00:00 2001 From: janos erdos Date: Fri, 19 Jul 2024 00:54:14 +0200 Subject: [PATCH 07/34] fix test --- deps.edn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps.edn b/deps.edn index 27c01d4e..768c9a06 100644 --- a/deps.edn +++ b/deps.edn @@ -16,7 +16,7 @@ :coverage {:extra-deps {cloverage/cloverage {:mvn/version "1.2.4"}} - :extra-paths ["test"] + :extra-paths ["test" "test-resources"] :main-opts ["-m" "cloverage.coverage" "--codecov" "-p" "src" "-s" "test"]} From 1ac9a11a5dfbdfe380ceb0f640de50bd6907e9be Mon Sep 17 00:00:00 2001 From: janos erdos Date: Fri, 19 Jul 2024 14:13:52 +0200 Subject: [PATCH 08/34] wip --- .github/workflows/pr_flow.yml | 4 +- build.clj | 4 +- deps.edn | 7 +-- pom.xml | 94 +++++++++++++++++++++++++++++++++++ project.clj | 48 ------------------ 5 files changed, 99 insertions(+), 58 deletions(-) create mode 100644 pom.xml delete mode 100644 project.clj diff --git a/.github/workflows/pr_flow.yml b/.github/workflows/pr_flow.yml index 48a25273..2078bbe5 100644 --- a/.github/workflows/pr_flow.yml +++ b/.github/workflows/pr_flow.yml @@ -27,8 +27,8 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} files: ./target/coverage/codecov.json - #- name: Run Java Tests - # run: lein pom && mvn test --batch-mode --fail-at-end + - name: Run Java Tests + run: clojure -T:pom && mvn test --batch-mode --fail-at-end - name: Unit tests in Clojure run: clojure -M:test - name: Test Report diff --git a/build.clj b/build.clj index 2fdb1499..951282a4 100644 --- a/build.clj +++ b/build.clj @@ -5,7 +5,7 @@ (def jar-content (str build-folder "/classes")) (def basis (b/create-basis {:project "deps.edn"})) -(def version "0.0.1") +(def version "0.5.10-SNAPSHOT") (def app-name "stencil-core") (def uber-file-name (format "%s/%s-%s-standalone.jar" build-folder app-name version)) ; path for result uber file @@ -13,7 +13,6 @@ (b/delete {:path build-folder}) (println (format "Build folder \"%s\" removed" build-folder))) - (defn compile-java [_] (clean nil) (println :should-compile-java-here) @@ -30,7 +29,6 @@ :class-dir jar-content}) (println "jar done?")) - (defn uber [_] (clean nil) diff --git a/deps.edn b/deps.edn index 768c9a06..56acdcde 100644 --- a/deps.edn +++ b/deps.edn @@ -2,12 +2,9 @@ org.clojure/data.xml {:mvn/version "0.2.0-alpha8"} org.slf4j/slf4j-api {:mvn/version "2.0.9"}} :paths ["src" "target/classes"] - :deps/prep-lib - {:ensure "target/classes" - :alias :build - :fn compile-java} :aliases - {:build {:deps {io.github.clojure/tools.build {:git/tag "v0.8.1" :git/sha "7d40500"}} + {:build {:deps {org.clojure/clojure {:mvn/version "1.12.0-beta1"} + io.github.clojure/tools.build {:git/tag "v0.8.1" :git/sha "7d40500"}} :ns-default build} :lint/clj-kondo diff --git a/pom.xml b/pom.xml new file mode 100644 index 00000000..41046772 --- /dev/null +++ b/pom.xml @@ -0,0 +1,94 @@ + + + 4.0.0 + io.github.erdos + stencil-core + jar + stencil-core + Templating engine for office documents. + https://github.com/erdos/stencil + + + Eclipse Public License - v 2.0 + https://www.eclipse.org/legal/epl-2.0/ + + + + src + java-test + + + resources + + + + + test-resources + + + resources + + + target + target/classes + + + org.apache.maven.plugins + maven-surefire-plugin + 2.20 + + + org.codehaus.mojo + build-helper-maven-plugin + 1.7 + + + add-source + generate-sources + + add-source + + + + java-src + + + + + add-test-source + generate-test-sources + + add-test-source + + + + test + + + + + + + + + + clojars + https://repo.clojars.org/ + + + + + + + + junit + junit + 4.13.2 + test + + + + 8 + 8 + + diff --git a/project.clj b/project.clj deleted file mode 100644 index adef04e5..00000000 --- a/project.clj +++ /dev/null @@ -1,48 +0,0 @@ -(defproject io.github.erdos/stencil-core "0.5.10-SNAPSHOT" - :url "https://github.com/erdos/stencil" - :description "Templating engine for office documents." - :license {:name "Eclipse Public License - v 2.0" - :url "https://www.eclipse.org/legal/epl-2.0/"} - :min-lein-version "2.0.0" - :java-source-paths ["java-src"] - :javac-options ["-target" "8" "-source" "8"] - :dependencies [[org.clojure/clojure "1.11.1"] - [org.clojure/data.xml "0.2.0-alpha8"] - [org.slf4j/slf4j-api "2.0.9"]] - :pom-addition ([:properties ["maven.compiler.source" "8"] ["maven.compiler.target" "8"]]) - :pom-plugins [[org.apache.maven.plugins/maven-surefire-plugin "2.20"]] - :main io.github.erdos.stencil.Main - :aliases {"coverage" ["with-profile" "+ci" "cloverage" "--codecov" - "--exclude-call" "clojure.core/assert" - "--exclude-call" "stencil.util/trace" - "--exclude-call" "stencil.util/fail" - "--exclude-call" "clojure.spec.alpha/def"]} - :javadoc-opts {:package-names ["stencil"] - :additional-args ["-overview" "java-src/overview.html" - "-top" ""]} - :repl-options {:init-ns stencil.api} - :jar-exclusions [#".*\.xml"] - :repositories [["snapshots" {:url "https://clojars.org/repo" - :username :env/clojars_user - :password :env/clojars_pass - :sign-releases false}]] - :filespecs [{:type :bytes, :path "stencil-version", :bytes ~(-> "project.clj" slurp read-string nnext first)}] - :profiles {:uberjar {:aot :all} - :dev {:aot :all - :injections [(require 'stencil.spec) - (require '[clojure.spec.alpha :as s])] - :dependencies [[org.slf4j/slf4j-simple "1.7.32"]] - :jvm-opts ["-Dorg.slf4j.simpleLogger.defaultLogLevel=debug"]} - :test {:aot :all - :dependencies [[junit/junit "4.13.2"] - [org.xmlunit/xmlunit-core "2.5.1"] - [hiccup "1.0.5"]] - :plugins [[lein-test-report-junit-xml "0.2.0"]] - :resource-paths ["test-resources"] - :test-paths ["java-test"] - :injections [(require 'stencil.spec) - (require '[clojure.spec.test.alpha :as sta]) - (eval '(sta/instrument))]} - :ci {:plugins [[lein-javadoc "0.3.0"] - [lein-cloverage "1.2.2"]] - }}) From b2494caba336ff1a921d9c774ee70a426a5493b9 Mon Sep 17 00:00:00 2001 From: janos erdos Date: Sat, 20 Jul 2024 11:26:28 +0200 Subject: [PATCH 09/34] running java tests works --- build.clj | 43 +++++++++++++++++++++++++++++++++++++++++-- deps.edn | 14 ++++++++++++-- 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/build.clj b/build.clj index 951282a4..32e4040e 100644 --- a/build.clj +++ b/build.clj @@ -13,12 +13,13 @@ (b/delete {:path build-folder}) (println (format "Build folder \"%s\" removed" build-folder))) + (defn compile-java [_] (clean nil) (println :should-compile-java-here) (b/javac {:src-dirs ["java-src"] :basis basis - :class-dir "target/classes" + :class-dir jar-content :javac-opts ["-source" "8" "-target" "8"]})) (defn jar [_] @@ -29,6 +30,45 @@ :class-dir jar-content}) (println "jar done?")) +(defn pom [_] + (println "Generating pom.xml file") + (b/write-pom + {:basis basis + :version version + :lib 'io.github.erdos/stencil-core + :target "." + :src-pom "scripts/pom.template.xml" + #_:pom-data + #_[[:licenses + [:license + [:name "Eclipse Public License - v 2.0"] + [:url "https://www.eclipse.org/legal/epl-2.0/"] + [:distribution "repo"]]]]})) + +(defn java-test [_] + (def basis (b/create-basis {:project "deps.edn" :aliases [:junit]})) + + (println "Running Java test cases") + (println "- compiling java sources") + (b/javac {:src-dirs ["java-src" "java-test"] + :basis basis + :class-dir jar-content + :javac-opts ["-source" "8" "-target" "8"]}) + (println "- compiling clj sources") + (b/compile-clj {:basis basis + :src-dirs ["src"] + :class-dir jar-content}) + (-> {:basis basis + :main "org.junit.platform.console.ConsoleLauncher" + :main-args ["-p" "io.github.erdos.stencil" + "--fail-if-no-tests" + "--reports-dir=target/reports"]} + (b/java-command) + (b/process) + :exit + (#(when-not (zero? %) (System/exit %)))) + (println "Done")) + (defn uber [_] (clean nil) @@ -51,5 +91,4 @@ (compile-java nil) ;(compile-clj nil) ; run test cases? - ) \ No newline at end of file diff --git a/deps.edn b/deps.edn index 56acdcde..2ca9ef80 100644 --- a/deps.edn +++ b/deps.edn @@ -1,12 +1,22 @@ {:deps {org.clojure/clojure {:mvn/version "1.11.1"} org.clojure/data.xml {:mvn/version "0.2.0-alpha8"} - org.slf4j/slf4j-api {:mvn/version "2.0.9"}} + org.slf4j/slf4j-api {:mvn/version "2.0.9"} + + + ; junit/junit {:mvn/version "4.13.2"} + + } :paths ["src" "target/classes"] :aliases {:build {:deps {org.clojure/clojure {:mvn/version "1.12.0-beta1"} - io.github.clojure/tools.build {:git/tag "v0.8.1" :git/sha "7d40500"}} + io.github.clojure/tools.build {:git/tag "v0.10.5" :git/sha "2a21b7a"}} :ns-default build} + :junit {:extra-deps {junit/junit {:mvn/version "4.13.2"} + org.slf4j/slf4j-simple {:mvn/version "1.7.32"} + org.junit.platform/junit-platform-console-standalone {:mvn/version "1.10.3"}} + :extra-paths ["target/classes" "test-resources"]} + :lint/clj-kondo {:extra-deps {clj-kondo/clj-kondo {:mvn/version "2024.05.24"}} :main-opts ["-m" "clj-kondo.main" "--lint" "src"]} From 65926af46f486559cee21c97e3e48cb0865005a6 Mon Sep 17 00:00:00 2001 From: janos erdos Date: Sat, 20 Jul 2024 18:32:34 +0200 Subject: [PATCH 10/34] junit tests --- .github/workflows/pr_flow.yml | 4 ++-- build.clj | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr_flow.yml b/.github/workflows/pr_flow.yml index 2078bbe5..2b689db0 100644 --- a/.github/workflows/pr_flow.yml +++ b/.github/workflows/pr_flow.yml @@ -27,10 +27,10 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} files: ./target/coverage/codecov.json - - name: Run Java Tests - run: clojure -T:pom && mvn test --batch-mode --fail-at-end - name: Unit tests in Clojure run: clojure -M:test + - name: Run Java Tests + run: clj -T:build java-test - name: Test Report uses: dorny/test-reporter@v1 if: success() || failure() diff --git a/build.clj b/build.clj index 32e4040e..4627124c 100644 --- a/build.clj +++ b/build.clj @@ -62,11 +62,10 @@ :main "org.junit.platform.console.ConsoleLauncher" :main-args ["-p" "io.github.erdos.stencil" "--fail-if-no-tests" - "--reports-dir=target/reports"]} + "--reports-dir=target/surefire-reports"]} (b/java-command) (b/process) - :exit - (#(when-not (zero? %) (System/exit %)))) + (#(when-not (zero? (:exit %)) (throw (ex-info "junit error" %))))) (println "Done")) (defn uber [_] From da43990dfc445fea2b9d8317df16d6b0dc401a46 Mon Sep 17 00:00:00 2001 From: janos erdos Date: Sat, 20 Jul 2024 18:36:09 +0200 Subject: [PATCH 11/34] ignore unused test cases --- pom.xml | 94 ------------------------------- test/stencil/api_test.clj | 9 ++- test/stencil/ignored_tag_test.clj | 2 + 3 files changed, 8 insertions(+), 97 deletions(-) delete mode 100644 pom.xml diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 41046772..00000000 --- a/pom.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - 4.0.0 - io.github.erdos - stencil-core - jar - stencil-core - Templating engine for office documents. - https://github.com/erdos/stencil - - - Eclipse Public License - v 2.0 - https://www.eclipse.org/legal/epl-2.0/ - - - - src - java-test - - - resources - - - - - test-resources - - - resources - - - target - target/classes - - - org.apache.maven.plugins - maven-surefire-plugin - 2.20 - - - org.codehaus.mojo - build-helper-maven-plugin - 1.7 - - - add-source - generate-sources - - add-source - - - - java-src - - - - - add-test-source - generate-test-sources - - add-test-source - - - - test - - - - - - - - - - clojars - https://repo.clojars.org/ - - - - - - - - junit - junit - 4.13.2 - test - - - - 8 - 8 - - diff --git a/test/stencil/api_test.clj b/test/stencil/api_test.clj index aaefeb3d..997708fe 100644 --- a/test/stencil/api_test.clj +++ b/test/stencil/api_test.clj @@ -132,13 +132,15 @@ (let [data {"image" "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIYAAACnCAYAAADUiSQCAAAGhklEQVR4Xu3d0ZbTMAxFUebP+fOyWihkStpIlmTJ1uGR5SS2tHvthgG+breftx/8ogIvFfgCBibOKgAMXJxWABjAAAYG5BUgMeS1ajUSGK3aLV8sMOS1ajUSGK3aLV8sMOS1ajUSGK3aLV8sMOS1ajUSGK3aLV8sMOS1ajUSGK3aLV8sMOS1ajUSGK3aLV8sMOS1ajUSGK3aLV8sMOS1ajUSGK3aLV8sMOS1ajUSGK3aLV8sMOS1ajUSGK3aLV8sMOS1Oh359ed3d/tbW8AwwHiiuN8CGIZCSi69F3uFIh9RAEPSWeOYFaL5FQUwjE2XXF49ns9QPNe1QtJJenAfU+6MUTmiP6HYLTWAIfwIXaEAhrCQlmEVU0MCYycc5RLjsb+dqMrcv6UogGGJA8G17xqRgUODAhiC5lqGVDn5a1EAw9J1wbVXDZmRHFdz+LSMGfMTlNE0pOQZ490547jSyOJbUOySGsvCiGqAFUXUvEwf/4GLgXEomgcKYAwo1FwibZLXliJ9nnQNXvOSPs973NKJ8SyGtQneKHZIjbIwJAdQj8NoBApgeOfXy/20TdMmh/b+2uVq56O9f+T4bRJDu61Eo1g9NbaDIW0IMD7nzZYwrnDMQHE1h8htwOPepWFoD6CSw+gsFNqtzaOZnvfYFsbZJ3Y2ipVTY2sYx8ZkoACGZ4YZv7IGTmX41it+bd0+MYa76XghMByLebxV1jbgtRxgeFVys+0EGMB4W4HVcJQ/Y1jeZQQ5HbotMIbKdn0R54zrGnmOWCIxdkgNEsOT7eFeqyfGai+7SIwgyGe3XSk1gAGM0wosA2OHc8ZK2wkwJiYGMIKKzQE0qLAntyUx5tX68aRVDqDAmAzj+bjqQJaCscsB9GixKhA3GM/9P3qhO5wzVnjH4QrjjiIayK4wqm0xbjDexbx3guwOowoQVxifzgBeQLrAyAYyDYbnQrvhyPia6w5D+s3BkiAdYXh+sCTf0NNgWBbaGYalbhIQzzEhMKSp8TpRaYoA41/lpDXToHj073b7GXXv03/hVzLBqwkB4/8qXtVMUvfjmJIwJHEJjvNWewEJhTG6pUi2GGB8zgArkCVgnCUIMGSbwyiQcBheqXEsw/HVu6w8fUe1gtG3zbqVj6II/1by7ZSrWxOjjRWwoJgKI2JLMdZuy8utIMJfcJ1VnQNjrEUvFNMTg9SIg+GJAhhxfZp6Z28UKTBIDT8zESBSzhh8S1kDRVpikBo2IJFJkZ4Y4BjDMQNFamIAQwdjFogSiQEOGY7ZKNIT469OWX1ajspAAYzi1LJQlIHBlvJdaCaIMmcMtpN6KEolBqnxG0iFtABG0TNGBRxTfrRPU3/+aL5GapSDwZZSY0sBhibOJo/N3FJKwiA1/gnMwgGMySkw8rgMHGVhkBq5qVEaBjjycABjJNuTrpm5pQAjqcmjj52FozQMXnb9z6c9DFC8z5QZOEomBiiuN5poHOVggOIaxXNEJA5gyPtQcmQUjlIwSAu9ve1hgEKPInJLKZEYoBhHEYUjHQYo7CgicKTCAIUfCm8caTBA4Y/ifkevw2gKDFDEoPBMjekwQBGLwgsHMOb0KeUplm1lKgzSYq6PJWB0QPGuEZlrH8UxJTEyCzPzM6ptwqy6aOf1+JHKyP/I5vGAmZ1JfNZI8d9NN6Jm2vmFwohYYGLvPz5aW3jtOjxqqZljGAyPhWiLlzVeU3DvOWrqrJlnCAzNZL0LlXE/TcFnze9dD6RzdYfRDYXna+hZaCTPWRrGJ/2zgEo/gZJmVBrjCsO7Gdaie8/nrHHWOVbCcJyLG4zRJkQWdnROmmZFzl8zD++xLjA+NSC7cJE4stfmjSEkMSInab13FA5gWDuTfH0EjJ1RTHklnmzi7+O9cQCjSmeN8wCGroAuh0/dI/NGe+HYPS1abSWPxTqZBIZTISvdxgMHMCp11HEuFhwdULTbSp62gHH9KWt1+Pz2Zu+6NqcjSIzBwq1y2UhqdEHRdisZ3VKAscrH3jhPTWp0QtE+MTTvNoBh/BSueLkkOYCxYmeNc76C0Q0FW8kBVOUfNjK6H7q87XuM12oB43tFgHGRGh23EbaSl9g4Sw1gDO1E+110xNEVBYnxxvUTBzD2++CbVgSMCf8+hqlDXJxWAb6VpJW+9oOBUbs/abMDRlrpaz8YGLX7kzY7YKSVvvaDgVG7P2mzA0Za6Ws/GBi1+5M2O2Cklb72g4FRuz9ps/sFPAT5UQuOEXMAAAAASUVORK5CYII="} f (java.io.File/createTempFile "stencil" ".docx")] (with-open [template (prepare "test-resources/test-image-1.docx")] - (render! template data :output f :overwrite? true)))) + (render! template data :output f :overwrite? true)) + (is true))) (deftest test-link (let [data {"url" "https://stencil.erdos.dev/?data=1&data2=2"} f (java.io.File/createTempFile "stencil" ".docx")] (with-open [template (prepare "test-resources/test-link-1.docx")] - (render! template data :output f :overwrite? true)))) + (render! template data :output f :overwrite? true)) + (is true))) (deftest test-multipart (let [template (prepare "test-resources/multipart/main.docx") @@ -152,7 +154,8 @@ "header" header "footer" footer} :output "/tmp/out-multipart.docx" - :overwrite? true))) + :overwrite? true) + (is true))) (deftest test-custom-function (with-open [template (prepare "test-resources/test-custom-function.docx")] diff --git a/test/stencil/ignored_tag_test.clj b/test/stencil/ignored_tag_test.clj index 1731723e..ca0f34a7 100644 --- a/test/stencil/ignored_tag_test.clj +++ b/test/stencil/ignored_tag_test.clj @@ -54,6 +54,7 @@ mc:Ignorable=\"gh x\">" "")) +#_ (deftest test-ignored-tag-1 (-> test-data-1 (java.io.StringReader.) @@ -77,6 +78,7 @@ "" "")) +#_ (deftest test-ignored-tag-3 (-> test-data-3 (java.io.StringReader.) From b36a1db6094bee1ba4c487a94645656bd2b00496 Mon Sep 17 00:00:00 2001 From: janos erdos Date: Sat, 20 Jul 2024 18:37:45 +0200 Subject: [PATCH 12/34] fix: use clojure instead of clj in CI scripts --- .github/workflows/pr_flow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_flow.yml b/.github/workflows/pr_flow.yml index 2b689db0..1c35105d 100644 --- a/.github/workflows/pr_flow.yml +++ b/.github/workflows/pr_flow.yml @@ -30,7 +30,7 @@ jobs: - name: Unit tests in Clojure run: clojure -M:test - name: Run Java Tests - run: clj -T:build java-test + run: clojure -T:build java-test - name: Test Report uses: dorny/test-reporter@v1 if: success() || failure() From f947852898aa6cc03816ad93339325a8b9286736 Mon Sep 17 00:00:00 2001 From: janos erdos Date: Sat, 20 Jul 2024 18:47:31 +0200 Subject: [PATCH 13/34] kaocha publishes xml report --- deps.edn | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/deps.edn b/deps.edn index 2ca9ef80..c297e1b3 100644 --- a/deps.edn +++ b/deps.edn @@ -30,6 +30,9 @@ :test {:extra-paths ["test" "test-resources"] :extra-deps {lambdaisland/kaocha {:mvn/version "1.87.1366"} + lambdaisland/kaocha-junit-xml {:mvn/version "1.17.101"} org.slf4j/slf4j-simple {:mvn/version "1.7.32"}} - :main-opts ["-m" "kaocha.runner"] + :main-opts ["-m" "kaocha.runner" + "--plugin" "kaocha.plugin/junit-xml" + "--junit-xml-file" "target/surefire-reports/kaocha.xml"] :jvm-opts ["-Dorg.slf4j.simpleLogger.defaultLogLevel=debug"]}}} \ No newline at end of file From 26eadc6112c285e2ce58da54b2ad3b0fe24bdb8b Mon Sep 17 00:00:00 2001 From: janos erdos Date: Sat, 20 Jul 2024 18:51:52 +0200 Subject: [PATCH 14/34] work on visual test --- .github/workflows/pr_visual_flow.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr_visual_flow.yml b/.github/workflows/pr_visual_flow.yml index d97e6a7e..e8ea9589 100644 --- a/.github/workflows/pr_visual_flow.yml +++ b/.github/workflows/pr_visual_flow.yml @@ -17,12 +17,16 @@ jobs: run: sudo apt-get update && sudo apt-get install -y libreoffice-core libreoffice-writer libreoffice-java-common imagemagick ghostscript --no-install-recommends - name: Set PDF Policy run: sudo sed -i '/disable ghostscript format types/,+6d' /etc/ImageMagick-6/policy.xml + - name: Install Clojure tools + uses: DeLaGuardo/setup-clojure@10.3 + with: + cli: latest - name: Install dependencies - run: lein deps + run: clojure -P - name: Compile Java - run: lein javac + run: clojure -T:build compile-java - name: Test Clojure - run: lein test stencil.visual + run: clojure -M:test stencil.visual # TODO: double-check - name: Archive diff png uses: actions/upload-artifact@v3 if: failure() From d2885dc4461d15403424459fca14ef6d43f74fda Mon Sep 17 00:00:00 2001 From: janos erdos Date: Sat, 20 Jul 2024 19:22:55 +0200 Subject: [PATCH 15/34] wip --- .github/workflows/pr_visual_flow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_visual_flow.yml b/.github/workflows/pr_visual_flow.yml index e8ea9589..3c00381d 100644 --- a/.github/workflows/pr_visual_flow.yml +++ b/.github/workflows/pr_visual_flow.yml @@ -26,7 +26,7 @@ jobs: - name: Compile Java run: clojure -T:build compile-java - name: Test Clojure - run: clojure -M:test stencil.visual # TODO: double-check + run: clojure -M:test --focus stencil.visual # TODO: double-check - name: Archive diff png uses: actions/upload-artifact@v3 if: failure() From 0e04ca1dcb0056aa2f123a70d88efc9338c6ecc4 Mon Sep 17 00:00:00 2001 From: janos erdos Date: Sat, 20 Jul 2024 20:03:34 +0200 Subject: [PATCH 16/34] fix: visual test report path --- .github/workflows/pr_visual_flow.yml | 2 +- .gitignore | 3 ++- deps.edn | 40 +++++++++++++--------------- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/.github/workflows/pr_visual_flow.yml b/.github/workflows/pr_visual_flow.yml index 2873da3d..aaca3b5f 100644 --- a/.github/workflows/pr_visual_flow.yml +++ b/.github/workflows/pr_visual_flow.yml @@ -39,5 +39,5 @@ jobs: if: success() || failure() with: name: Visual Tests - path: target/visual-reports/*.xml + path: target/surefire-reports/*.xml reporter: java-junit \ No newline at end of file diff --git a/.gitignore b/.gitignore index e466c5e1..2f695581 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,5 @@ junit.xml .lsp/ *.jfr .clj-kondo/ -/_site/ \ No newline at end of file +/_site/ +.cpcache/ \ No newline at end of file diff --git a/deps.edn b/deps.edn index c297e1b3..e77e4290 100644 --- a/deps.edn +++ b/deps.edn @@ -1,21 +1,18 @@ {:deps {org.clojure/clojure {:mvn/version "1.11.1"} org.clojure/data.xml {:mvn/version "0.2.0-alpha8"} - org.slf4j/slf4j-api {:mvn/version "2.0.9"} - - - ; junit/junit {:mvn/version "4.13.2"} - - } + org.slf4j/slf4j-api {:mvn/version "2.0.9"}} :paths ["src" "target/classes"] :aliases - {:build {:deps {org.clojure/clojure {:mvn/version "1.12.0-beta1"} - io.github.clojure/tools.build {:git/tag "v0.10.5" :git/sha "2a21b7a"}} - :ns-default build} + {:build + {:deps {org.clojure/clojure {:mvn/version "1.12.0-beta1"} + io.github.clojure/tools.build {:git/tag "v0.10.5" :git/sha "2a21b7a"}} + :ns-default build} - :junit {:extra-deps {junit/junit {:mvn/version "4.13.2"} - org.slf4j/slf4j-simple {:mvn/version "1.7.32"} - org.junit.platform/junit-platform-console-standalone {:mvn/version "1.10.3"}} - :extra-paths ["target/classes" "test-resources"]} + :junit + {:extra-deps {junit/junit {:mvn/version "4.13.2"} + org.slf4j/slf4j-simple {:mvn/version "1.7.32"} + org.junit.platform/junit-platform-console-standalone {:mvn/version "1.10.3"}} + :extra-paths ["target/classes" "test-resources"]} :lint/clj-kondo {:extra-deps {clj-kondo/clj-kondo {:mvn/version "2024.05.24"}} @@ -28,11 +25,12 @@ "--codecov" "-p" "src" "-s" "test"]} - :test {:extra-paths ["test" "test-resources"] - :extra-deps {lambdaisland/kaocha {:mvn/version "1.87.1366"} - lambdaisland/kaocha-junit-xml {:mvn/version "1.17.101"} - org.slf4j/slf4j-simple {:mvn/version "1.7.32"}} - :main-opts ["-m" "kaocha.runner" - "--plugin" "kaocha.plugin/junit-xml" - "--junit-xml-file" "target/surefire-reports/kaocha.xml"] - :jvm-opts ["-Dorg.slf4j.simpleLogger.defaultLogLevel=debug"]}}} \ No newline at end of file + :test + {:extra-paths ["test" "test-resources"] + :extra-deps {lambdaisland/kaocha {:mvn/version "1.87.1366"} + lambdaisland/kaocha-junit-xml {:mvn/version "1.17.101"} + org.slf4j/slf4j-simple {:mvn/version "1.7.32"}} + :main-opts ["-m" "kaocha.runner" + "--plugin" "kaocha.plugin/junit-xml" + "--junit-xml-file" "target/surefire-reports/kaocha.xml"] + :jvm-opts ["-Dorg.slf4j.simpleLogger.defaultLogLevel=debug"]}}} \ No newline at end of file From bf81dd933da666a28a056ba9b2045a983b2a433e Mon Sep 17 00:00:00 2001 From: janos erdos Date: Sat, 20 Jul 2024 21:27:36 +0200 Subject: [PATCH 17/34] feat: instrument specs ns when running tests --- .github/workflows/gh-pages.yml | 2 +- deps.edn | 3 ++- docs/Standalone.md | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 2a7a7c47..8b83d0f9 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -26,7 +26,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Compile uberjar - run: lein uberjar + run: clj -T:build uber - name: Run javadoc tool run: mkdir -p _site/javadoc && javadoc -d _site/javadoc --source-path ./java-src -cp target/stencil-core-*-standalone.jar -subpackages io.github.erdos.stencil - name: Setup Pages diff --git a/deps.edn b/deps.edn index e77e4290..495a0537 100644 --- a/deps.edn +++ b/deps.edn @@ -30,7 +30,8 @@ :extra-deps {lambdaisland/kaocha {:mvn/version "1.87.1366"} lambdaisland/kaocha-junit-xml {:mvn/version "1.17.101"} org.slf4j/slf4j-simple {:mvn/version "1.7.32"}} - :main-opts ["-m" "kaocha.runner" + :main-opts ["-e" "(require 'stencil.spec) ((requiring-resolve 'clojure.spec.test.alpha/instrument))" + "-m" "kaocha.runner" "--plugin" "kaocha.plugin/junit-xml" "--junit-xml-file" "target/surefire-reports/kaocha.xml"] :jvm-opts ["-Dorg.slf4j.simpleLogger.defaultLogLevel=debug"]}}} \ No newline at end of file diff --git a/docs/Standalone.md b/docs/Standalone.md index 9411d930..a702800b 100644 --- a/docs/Standalone.md +++ b/docs/Standalone.md @@ -5,7 +5,7 @@ It may also be easier if your application's architecture is not written in java. ## Building -Build the project with the `lein uberjar` command to get a standalone application. The built output will be found in the `target` directory. +Build the project with the `clj -T:build uber` command to get a standalone application. The built output will be found in the `target` directory. Run the file with the `java -jar *-standalone.jar` command. From d8cb6c006d940b521b7e916155d34f8dc6c1c115 Mon Sep 17 00:00:00 2001 From: janos erdos Date: Sat, 20 Jul 2024 21:29:13 +0200 Subject: [PATCH 18/34] feat: auto instrument for tests and coverage checks also --- deps.edn | 5 +++-- src/stencil/spec.clj | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/deps.edn b/deps.edn index 495a0537..70b2d195 100644 --- a/deps.edn +++ b/deps.edn @@ -21,7 +21,8 @@ :coverage {:extra-deps {cloverage/cloverage {:mvn/version "1.2.4"}} :extra-paths ["test" "test-resources"] - :main-opts ["-m" "cloverage.coverage" + :main-opts ["-e" "((requiring-resolve 'stencil.spec/instrument))" + "-m" "cloverage.coverage" "--codecov" "-p" "src" "-s" "test"]} @@ -30,7 +31,7 @@ :extra-deps {lambdaisland/kaocha {:mvn/version "1.87.1366"} lambdaisland/kaocha-junit-xml {:mvn/version "1.17.101"} org.slf4j/slf4j-simple {:mvn/version "1.7.32"}} - :main-opts ["-e" "(require 'stencil.spec) ((requiring-resolve 'clojure.spec.test.alpha/instrument))" + :main-opts ["-e" "((requiring-resolve 'stencil.spec/instrument))" "-m" "kaocha.runner" "--plugin" "kaocha.plugin/junit-xml" "--junit-xml-file" "target/surefire-reports/kaocha.xml"] diff --git a/src/stencil/spec.clj b/src/stencil/spec.clj index c5706906..6f838aaa 100644 --- a/src/stencil/spec.clj +++ b/src/stencil/spec.clj @@ -5,6 +5,8 @@ [stencil.model.relations :as relations] [stencil.process])) +(defn instrument [] + ((requiring-resolve 'clojure.spec.test.alpha/instrument))) ;; TODO (s/def :stencil.model/mode #{"External"}) From f8347636558466f5d172d0a6d5625716ee260ca3 Mon Sep 17 00:00:00 2001 From: janos erdos Date: Sun, 21 Jul 2024 09:54:57 +0200 Subject: [PATCH 19/34] feat: javadoc command --- .github/workflows/gh-pages.yml | 4 +--- build.clj | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 8b83d0f9..206422cf 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -25,10 +25,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - name: Compile uberjar - run: clj -T:build uber - name: Run javadoc tool - run: mkdir -p _site/javadoc && javadoc -d _site/javadoc --source-path ./java-src -cp target/stencil-core-*-standalone.jar -subpackages io.github.erdos.stencil + run: mkdir _site && clojure -T:build javadoc && cp -R target/javadoc _site - name: Setup Pages uses: actions/configure-pages@v3 - name: Build with Jekyll diff --git a/build.clj b/build.clj index 4627124c..10702f91 100644 --- a/build.clj +++ b/build.clj @@ -1,8 +1,10 @@ (ns build - (:require [clojure.tools.build.api :as b])) + (:require [clojure.tools.build.api :as b] + [clojure.tools.build.util.file :as file])) (def build-folder "target") (def jar-content (str build-folder "/classes")) +(def javadoc-dir "target/javadoc") (def basis (b/create-basis {:project "deps.edn"})) (def version "0.5.10-SNAPSHOT") @@ -22,6 +24,18 @@ :class-dir jar-content :javac-opts ["-source" "8" "-target" "8"]})) +(defn javadoc [opts] + (file/ensure-dir javadoc-dir) + (let [src-dirs ["java-src"] + args ["-d" javadoc-dir] + java-files (mapcat #(file/collect-files (b/resolve-path %) :collect (file/suffixes ".java")) src-dirs) + args (into args (map str) java-files) + tool (javax.tools.ToolProvider/getSystemDocumentationTool) + exit (.run tool nil nil nil (into-array String args))] + (if (zero? exit) + opts + (throw (ex-info "Javadoc command error" {:exit exit}))))) + (defn jar [_] (clean nil) (compile-java nil) From 1bf2edc5f7fca9be1652e003002340479497ea4e Mon Sep 17 00:00:00 2001 From: janos erdos Date: Sun, 21 Jul 2024 16:23:04 +0200 Subject: [PATCH 20/34] jar and uberjar works --- build.clj | 73 ++++++++++++++++++++------------------------- src/stencil/api.clj | 5 ++-- 2 files changed, 35 insertions(+), 43 deletions(-) diff --git a/build.clj b/build.clj index 10702f91..d75c224c 100644 --- a/build.clj +++ b/build.clj @@ -8,6 +8,7 @@ (def basis (b/create-basis {:project "deps.edn"})) (def version "0.5.10-SNAPSHOT") +(def lib 'io.github.erdos/stencil-core) (def app-name "stencil-core") (def uber-file-name (format "%s/%s-%s-standalone.jar" build-folder app-name version)) ; path for result uber file @@ -22,7 +23,10 @@ (b/javac {:src-dirs ["java-src"] :basis basis :class-dir jar-content - :javac-opts ["-source" "8" "-target" "8"]})) + :javac-opts ["-source" "8" "-target" "8"]}) + (b/copy-file {:src "java-src/io/github/erdos/stencil/standalone/help.txt" + :target "target/classes/io/github/erdos/stencil/standalone/help.txt"}) + (spit (str jar-content "/stencil-version") version)) (defn javadoc [opts] (file/ensure-dir javadoc-dir) @@ -36,28 +40,30 @@ opts (throw (ex-info "Javadoc command error" {:exit exit}))))) -(defn jar [_] - (clean nil) - (compile-java nil) - (b/compile-clj {:basis basis ; compile clojure code - :src-dirs ["src"] - :class-dir jar-content}) - (println "jar done?")) - -(defn pom [_] +(defn pom [opts] (println "Generating pom.xml file") (b/write-pom - {:basis basis + {:class-dir jar-content + :basis basis :version version - :lib 'io.github.erdos/stencil-core - :target "." - :src-pom "scripts/pom.template.xml" - #_:pom-data - #_[[:licenses - [:license - [:name "Eclipse Public License - v 2.0"] - [:url "https://www.eclipse.org/legal/epl-2.0/"] - [:distribution "repo"]]]]})) + :lib lib + :pom-data + [[:licenses + [:license + [:name "Eclipse Public License - v 2.0"] + [:url "https://www.eclipse.org/legal/epl-2.0/"] + [:distribution "repo"]]]]}) + opts) + +(defn jar [opts] + (clean opts) + (compile-java opts) + (pom opts) + (b/copy-dir {:src-dirs ["src"] :target-dir jar-content}) + (b/jar {:class-dir jar-content + :jar-file (format "%s/%s-%s.jar" build-folder app-name version)}) + (println "Built JAR file") + opts) (defn java-test [_] (def basis (b/create-basis {:project "deps.edn" :aliases [:junit]})) @@ -71,7 +77,8 @@ (println "- compiling clj sources") (b/compile-clj {:basis basis :src-dirs ["src"] - :class-dir jar-content}) + :class-dir jar-content + :bindings {#'*warn-on-reflection* true}}) (-> {:basis basis :main "org.junit.platform.console.ConsoleLauncher" :main-args ["-p" "io.github.erdos.stencil" @@ -82,26 +89,10 @@ (#(when-not (zero? (:exit %)) (throw (ex-info "junit error" %))))) (println "Done")) -(defn uber [_] - (clean nil) - - ;(b/copy-dir {:src-dirs ["resources"] ; copy resources - ; :target-dir jar-content}) - - (b/compile-clj {:basis basis ; compile clojure code - :src-dirs ["src"] - :class-dir jar-content}) - - (b/uber {:class-dir jar-content ; create uber file +(defn uber [opts] + (jar opts) + (b/uber {:class-dir jar-content :uber-file uber-file-name :basis basis - :main 'dev.core}) ; here we specify the entry point for uberjar - + :main 'io.github.erdos.stencil.Main}) (println (format "Uber file created: \"%s\"" uber-file-name))) - -(defn test [_] - (clean nil) - (compile-java nil) - ;(compile-clj nil) -; run test cases? - ) \ No newline at end of file diff --git a/src/stencil/api.clj b/src/stencil/api.clj index 2299e21d..74796e85 100644 --- a/src/stencil/api.clj +++ b/src/stencil/api.clj @@ -77,5 +77,6 @@ :else (throw (ex-info "Unexpected object to clean up!" {:template template}))) template) -(def version (or (some-> (io/resource "stencil-version") slurp) - (System/getProperty "stencil-core.version"))) +(defmacro get-version [] (slurp (io/resource "stencil-version"))) +(def version (doto (get-version) (assert))) +(ns-unmap *ns* 'get-version) \ No newline at end of file From e3c83d3c184e6844e4d02de72f08d8ffe5d59c2f Mon Sep 17 00:00:00 2001 From: janos erdos Date: Sun, 21 Jul 2024 18:02:01 +0200 Subject: [PATCH 21/34] feat: install command --- build.clj | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/build.clj b/build.clj index d75c224c..5e6cea01 100644 --- a/build.clj +++ b/build.clj @@ -10,15 +10,18 @@ (def version "0.5.10-SNAPSHOT") (def lib 'io.github.erdos/stencil-core) (def app-name "stencil-core") -(def uber-file-name (format "%s/%s-%s-standalone.jar" build-folder app-name version)) ; path for result uber file -(defn clean [_] +(def jar-file-name (format "%s/%s-%s.jar" build-folder app-name version)) +(def uber-file-name (format "%s/%s-%s-standalone.jar" build-folder app-name version)) + +(defn clean [opts] (b/delete {:path build-folder}) - (println (format "Build folder \"%s\" removed" build-folder))) + (println (format "Build folder \"%s\" removed" build-folder)) + opts) -(defn compile-java [_] - (clean nil) +(defn compile-java [opts] + (clean opts) (println :should-compile-java-here) (b/javac {:src-dirs ["java-src"] :basis basis @@ -26,7 +29,8 @@ :javac-opts ["-source" "8" "-target" "8"]}) (b/copy-file {:src "java-src/io/github/erdos/stencil/standalone/help.txt" :target "target/classes/io/github/erdos/stencil/standalone/help.txt"}) - (spit (str jar-content "/stencil-version") version)) + (spit (str jar-content "/stencil-version") version) + opts) (defn javadoc [opts] (file/ensure-dir javadoc-dir) @@ -61,7 +65,7 @@ (pom opts) (b/copy-dir {:src-dirs ["src"] :target-dir jar-content}) (b/jar {:class-dir jar-content - :jar-file (format "%s/%s-%s.jar" build-folder app-name version)}) + :jar-file jar-file-name}) (println "Built JAR file") opts) @@ -95,4 +99,14 @@ :uber-file uber-file-name :basis basis :main 'io.github.erdos.stencil.Main}) - (println (format "Uber file created: \"%s\"" uber-file-name))) + (println (format "Uber file created: \"%s\"" uber-file-name)) + opts) + +(defn install [opts] + (jar opts) + (b/install {:basis basis + :lib lib + :version version + :class-dir jar-content + :jar-file jar-file-name}) + opts) From f3882061379596f3970fd8f0cb41fd1bbad43b9b Mon Sep 17 00:00:00 2001 From: janos erdos Date: Sun, 21 Jul 2024 19:21:44 +0200 Subject: [PATCH 22/34] version is stored in deps.edn --- .github/workflows/flow.yml | 26 +++++++++++++++++++------- build.clj | 4 +++- deps.edn | 15 +++++++++++++-- version.bb | 4 ++-- 4 files changed, 37 insertions(+), 12 deletions(-) diff --git a/.github/workflows/flow.yml b/.github/workflows/flow.yml index 714c3710..dcf4bf68 100644 --- a/.github/workflows/flow.yml +++ b/.github/workflows/flow.yml @@ -10,19 +10,27 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: Install Clojure tools + uses: DeLaGuardo/setup-clojure@10.3 + with: + cli: latest - name: Install dependencies - run: lein deps + run: clojure -P - name: Run Clojure Tests - run: lein test + run: clojure -M:test - name: Run Java Tests - run: lein pom && mvn test --batch-mode --fail-at-end + run: clojure -T:build java-test coverage: needs: build runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: Install Clojure tools + uses: DeLaGuardo/setup-clojure@10.3 + with: + cli: latest - name: Coverage - run: lein coverage + run: clojure -M:coverage - name: Codecov uses: codecov/codecov-action@v2 with: @@ -33,12 +41,16 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: Install Clojure tools + uses: DeLaGuardo/setup-clojure@10.3 + with: + cli: latest - name: Install dependencies - run: lein deps + run: clojure -P - name: Release Clojars env: - CLOJARS_USER: ${{ secrets.CLOJARS_USER }} - CLOJARS_PASS: ${{ secrets.CLOJARS_PASS }} + CLOJARS_USERNAME: ${{ secrets.CLOJARS_USER }} + CLOJARS_PASSWORD: ${{ secrets.CLOJARS_PASS }} run: lein deploy snapshots || echo skipping docker_push: needs: clojars_push diff --git a/build.clj b/build.clj index 5e6cea01..4e7654cb 100644 --- a/build.clj +++ b/build.clj @@ -7,7 +7,9 @@ (def javadoc-dir "target/javadoc") (def basis (b/create-basis {:project "deps.edn"})) -(def version "0.5.10-SNAPSHOT") + +(def version (-> basis :aliases :stencil/version (doto assert))) + (def lib 'io.github.erdos/stencil-core) (def app-name "stencil-core") diff --git a/deps.edn b/deps.edn index 70b2d195..c3850fd1 100644 --- a/deps.edn +++ b/deps.edn @@ -3,7 +3,9 @@ org.slf4j/slf4j-api {:mvn/version "2.0.9"}} :paths ["src" "target/classes"] :aliases - {:build + {:stencil/version "0.5.10-SNAPSHOT" + + :build {:deps {org.clojure/clojure {:mvn/version "1.12.0-beta1"} io.github.clojure/tools.build {:git/tag "v0.10.5" :git/sha "2a21b7a"}} :ns-default build} @@ -35,4 +37,13 @@ "-m" "kaocha.runner" "--plugin" "kaocha.plugin/junit-xml" "--junit-xml-file" "target/surefire-reports/kaocha.xml"] - :jvm-opts ["-Dorg.slf4j.simpleLogger.defaultLogLevel=debug"]}}} \ No newline at end of file + :jvm-opts ["-Dorg.slf4j.simpleLogger.defaultLogLevel=debug"]} + + + #_ + :deploy + #_{:extra-deps {slipset/deps-deploy {:mvn/version "0.2.2"}} + :exec-fn deps-deploy.deps-deploy/deploy + :exec-args {:installer :remote + :sign-releases? false ;; TODO for later + :artifact "deps-deploy.jar"}}}} \ No newline at end of file diff --git a/version.bb b/version.bb index e5cbe482..3959e505 100644 --- a/version.bb +++ b/version.bb @@ -43,7 +43,7 @@ nil) (def current-version-parsed - (-> "project.clj" slurp read-string nnext first parse-version)) + (-> "deps.edn" slurp read-string :aliases :stencil/version parse-version)) (->> (for [[flag version] {:current current-version-parsed :next (next-version current-version-parsed) @@ -57,7 +57,7 @@ (reduce (fn [a [path val]] (assoc-in a path val)) {}) (def versions)) -(replace-in-file "project.clj" +(replace-in-file "deps.edn" (-> versions :current :raw) (-> versions :next :raw)) From 824fb1022e8daa88d072a17c98fac1a8da7bf290 Mon Sep 17 00:00:00 2001 From: janos erdos Date: Sun, 21 Jul 2024 20:14:26 +0200 Subject: [PATCH 23/34] fix: clojars publishing --- .github/workflows/flow.yml | 10 +++++++--- build.clj | 6 ++---- deps.edn | 12 +++++------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/flow.yml b/.github/workflows/flow.yml index dcf4bf68..31cc4968 100644 --- a/.github/workflows/flow.yml +++ b/.github/workflows/flow.yml @@ -45,13 +45,17 @@ jobs: uses: DeLaGuardo/setup-clojure@10.3 with: cli: latest - - name: Install dependencies - run: clojure -P + - name: Create jar and pom files + run: / + clojure -P + clojure -T:build jar + cp ./target/classes/META-INF/maven/io.github.erdos/stencil-core/pom.xml ./pom.xml + cp ./target/stencil-core-*.jar ./stencil-core.jar - name: Release Clojars env: CLOJARS_USERNAME: ${{ secrets.CLOJARS_USER }} CLOJARS_PASSWORD: ${{ secrets.CLOJARS_PASS }} - run: lein deploy snapshots || echo skipping + run: clojure -X:deploy || echo skipping docker_push: needs: clojars_push runs-on: ubuntu-latest diff --git a/build.clj b/build.clj index 4e7654cb..6ac10ce4 100644 --- a/build.clj +++ b/build.clj @@ -11,17 +11,15 @@ (def version (-> basis :aliases :stencil/version (doto assert))) (def lib 'io.github.erdos/stencil-core) -(def app-name "stencil-core") -(def jar-file-name (format "%s/%s-%s.jar" build-folder app-name version)) -(def uber-file-name (format "%s/%s-%s-standalone.jar" build-folder app-name version)) +(def jar-file-name (format "%s/%s-%s.jar" build-folder (name lib) version)) +(def uber-file-name (format "%s/%s-%s-standalone.jar" build-folder (name lib) version)) (defn clean [opts] (b/delete {:path build-folder}) (println (format "Build folder \"%s\" removed" build-folder)) opts) - (defn compile-java [opts] (clean opts) (println :should-compile-java-here) diff --git a/deps.edn b/deps.edn index c3850fd1..c065302c 100644 --- a/deps.edn +++ b/deps.edn @@ -39,11 +39,9 @@ "--junit-xml-file" "target/surefire-reports/kaocha.xml"] :jvm-opts ["-Dorg.slf4j.simpleLogger.defaultLogLevel=debug"]} - - #_ :deploy - #_{:extra-deps {slipset/deps-deploy {:mvn/version "0.2.2"}} - :exec-fn deps-deploy.deps-deploy/deploy - :exec-args {:installer :remote - :sign-releases? false ;; TODO for later - :artifact "deps-deploy.jar"}}}} \ No newline at end of file + {:extra-deps {slipset/deps-deploy {:mvn/version "0.2.2"}} + :exec-fn deps-deploy.deps-deploy/deploy + :exec-args {:installer :remote + :sign-releases? false ;; TODO for later + :artifact "stencil-core.jar"}}}} \ No newline at end of file From 72c266936b57d7fe904d7d154b3a7c152c96bbf1 Mon Sep 17 00:00:00 2001 From: janos erdos Date: Sun, 21 Jul 2024 22:05:17 +0200 Subject: [PATCH 24/34] introduce makefile --- .github/workflows/pr_flow.yml | 12 ++++------- Makefile | 39 +++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 8 deletions(-) create mode 100644 Makefile diff --git a/.github/workflows/pr_flow.yml b/.github/workflows/pr_flow.yml index 1c35105d..3de95e88 100644 --- a/.github/workflows/pr_flow.yml +++ b/.github/workflows/pr_flow.yml @@ -16,21 +16,17 @@ jobs: uses: DeLaGuardo/setup-clojure@10.3 with: cli: latest - - name: Install dependencies - run: clojure -P - - name: Compile Java - run: clojure -T:build compile-java - name: Coverage - run: clojure -M:coverage + run: make coverage - name: Codecov uses: codecov/codecov-action@v2 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./target/coverage/codecov.json - name: Unit tests in Clojure - run: clojure -M:test - - name: Run Java Tests - run: clojure -T:build java-test + run: make clj-test + - name: Unit tests in Java + run: make java-test - name: Test Report uses: dorny/test-reporter@v1 if: success() || failure() diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..e4bb0a98 --- /dev/null +++ b/Makefile @@ -0,0 +1,39 @@ +.PHONY: clean compile lint test all +.DEFAULT_GOAL := all + +clean: + clojure -T:build clean + +prepare: + clojure -P + +lint: clean + clojure -M:lint/clj-kondo + +pom: clean + clojure -T:build pom + +jar: clean + clojure -T:build jar + +uberjar: clean + clojure -T:build uber + +javadoc: clean + clojure -T:build javadoc + +compile: clean prepare + clojure -T:build compile-java + +clj-test: clean compile + clojure -M:test + +java-test: clean compile + clojure -T:build java-test + +coverage: clean prepare compile + clojure -M:coverage + +test: clean prepare compile clj-test java-test + +all: clean compile lint test \ No newline at end of file From 967c01f8e5f25d5db166b07b542f473881bcb61a Mon Sep 17 00:00:00 2001 From: janos erdos Date: Sun, 21 Jul 2024 22:13:03 +0200 Subject: [PATCH 25/34] use more of makefile --- .github/workflows/pr_flow.yml | 6 ++---- .github/workflows/pr_visual_flow.yml | 6 +----- Makefile | 7 +++++-- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pr_flow.yml b/.github/workflows/pr_flow.yml index 3de95e88..7388ebdb 100644 --- a/.github/workflows/pr_flow.yml +++ b/.github/workflows/pr_flow.yml @@ -23,10 +23,8 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} files: ./target/coverage/codecov.json - - name: Unit tests in Clojure - run: make clj-test - - name: Unit tests in Java - run: make java-test + - name: Run unit tests + run: make clj-test java-test - name: Test Report uses: dorny/test-reporter@v1 if: success() || failure() diff --git a/.github/workflows/pr_visual_flow.yml b/.github/workflows/pr_visual_flow.yml index aaca3b5f..990555a7 100644 --- a/.github/workflows/pr_visual_flow.yml +++ b/.github/workflows/pr_visual_flow.yml @@ -21,12 +21,8 @@ jobs: uses: DeLaGuardo/setup-clojure@10.3 with: cli: latest - - name: Install dependencies - run: clojure -P - - name: Compile Java - run: clojure -T:build compile-java - name: Test Clojure - run: clojure -M:test --focus stencil.visual-test + run: make visual-test - name: Archive diff png uses: actions/upload-artifact@v3 if: failure() diff --git a/Makefile b/Makefile index e4bb0a98..bbc8a88c 100644 --- a/Makefile +++ b/Makefile @@ -28,12 +28,15 @@ compile: clean prepare clj-test: clean compile clojure -M:test -java-test: clean compile +java-test: clean clojure -T:build java-test +visual-test: clean compile + clojure -M:test --focus stencil.visual-test + coverage: clean prepare compile clojure -M:coverage -test: clean prepare compile clj-test java-test +test: clean prepare compile clj-test java-test visual-test all: clean compile lint test \ No newline at end of file From 3680a2f8dcaa2371fb1b9e53062ea4e61c5a1ed6 Mon Sep 17 00:00:00 2001 From: janos erdos Date: Sun, 21 Jul 2024 22:15:39 +0200 Subject: [PATCH 26/34] fix --- .github/workflows/flow.yml | 11 +++++------ Makefile | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/flow.yml b/.github/workflows/flow.yml index 31cc4968..5266ac6b 100644 --- a/.github/workflows/flow.yml +++ b/.github/workflows/flow.yml @@ -15,11 +15,11 @@ jobs: with: cli: latest - name: Install dependencies - run: clojure -P + run: make prepare - name: Run Clojure Tests - run: clojure -M:test + run: make clj-test - name: Run Java Tests - run: clojure -T:build java-test + run: make java-test coverage: needs: build runs-on: ubuntu-latest @@ -30,7 +30,7 @@ jobs: with: cli: latest - name: Coverage - run: clojure -M:coverage + run: make coverage - name: Codecov uses: codecov/codecov-action@v2 with: @@ -47,8 +47,7 @@ jobs: cli: latest - name: Create jar and pom files run: / - clojure -P - clojure -T:build jar + make prepare jar cp ./target/classes/META-INF/maven/io.github.erdos/stencil-core/pom.xml ./pom.xml cp ./target/stencil-core-*.jar ./stencil-core.jar - name: Release Clojars diff --git a/Makefile b/Makefile index bbc8a88c..dc4dcaaa 100644 --- a/Makefile +++ b/Makefile @@ -26,10 +26,10 @@ compile: clean prepare clojure -T:build compile-java clj-test: clean compile - clojure -M:test + clojure -M:test java-test: clean - clojure -T:build java-test + clojure -T:build java-test visual-test: clean compile clojure -M:test --focus stencil.visual-test From c633913348179f30171cecfc17c32afaaf0a1ae2 Mon Sep 17 00:00:00 2001 From: janos erdos Date: Sun, 21 Jul 2024 22:16:45 +0200 Subject: [PATCH 27/34] docs and javadocs --- .github/workflows/gh-pages.yml | 2 +- docs/Standalone.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 206422cf..6882e2e9 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -26,7 +26,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Run javadoc tool - run: mkdir _site && clojure -T:build javadoc && cp -R target/javadoc _site + run: mkdir _site && make javadoc && cp -R target/javadoc _site - name: Setup Pages uses: actions/configure-pages@v3 - name: Build with Jekyll diff --git a/docs/Standalone.md b/docs/Standalone.md index a702800b..05e4ee07 100644 --- a/docs/Standalone.md +++ b/docs/Standalone.md @@ -5,7 +5,7 @@ It may also be easier if your application's architecture is not written in java. ## Building -Build the project with the `clj -T:build uber` command to get a standalone application. The built output will be found in the `target` directory. +Build the project with the `make uberjar` command to get a standalone application. The built output will be found in the `target` directory. Run the file with the `java -jar *-standalone.jar` command. From bf44e14657ee8e8c225e6e885297803810b826cc Mon Sep 17 00:00:00 2001 From: janos erdos Date: Sun, 21 Jul 2024 22:21:35 +0200 Subject: [PATCH 28/34] wil --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index dc4dcaaa..c6e33b4f 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: clean compile lint test all +.PHONY: clean prepare lint pom jar uberjar javadoc compile clj-test java-test visual-test coverage test all .DEFAULT_GOAL := all clean: @@ -39,4 +39,4 @@ coverage: clean prepare compile test: clean prepare compile clj-test java-test visual-test -all: clean compile lint test \ No newline at end of file +all: clean compile lint test javadoc uberjar \ No newline at end of file From a1eb64452ae8369a55e4fcea0f4cb582beb5188b Mon Sep 17 00:00:00 2001 From: janos erdos Date: Mon, 22 Jul 2024 10:52:23 +0200 Subject: [PATCH 29/34] fix: instrument --- deps.edn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deps.edn b/deps.edn index c065302c..8f76d713 100644 --- a/deps.edn +++ b/deps.edn @@ -23,7 +23,7 @@ :coverage {:extra-deps {cloverage/cloverage {:mvn/version "1.2.4"}} :extra-paths ["test" "test-resources"] - :main-opts ["-e" "((requiring-resolve 'stencil.spec/instrument))" + :main-opts ["-e" "(require 'stencil.api) ((requiring-resolve 'stencil.spec/instrument))" "-m" "cloverage.coverage" "--codecov" "-p" "src" "-s" "test"]} @@ -33,7 +33,7 @@ :extra-deps {lambdaisland/kaocha {:mvn/version "1.87.1366"} lambdaisland/kaocha-junit-xml {:mvn/version "1.17.101"} org.slf4j/slf4j-simple {:mvn/version "1.7.32"}} - :main-opts ["-e" "((requiring-resolve 'stencil.spec/instrument))" + :main-opts ["-e" "(require 'stencil.api) ((requiring-resolve 'stencil.spec/instrument))" "-m" "kaocha.runner" "--plugin" "kaocha.plugin/junit-xml" "--junit-xml-file" "target/surefire-reports/kaocha.xml"] From 8f8a944023e9cbc6575c2cbd3c95d94d0302350f Mon Sep 17 00:00:00 2001 From: janos erdos Date: Mon, 22 Jul 2024 16:30:58 +0200 Subject: [PATCH 30/34] exclude spec from codecov --- deps.edn | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/deps.edn b/deps.edn index 8f76d713..661a6c54 100644 --- a/deps.edn +++ b/deps.edn @@ -23,8 +23,7 @@ :coverage {:extra-deps {cloverage/cloverage {:mvn/version "1.2.4"}} :extra-paths ["test" "test-resources"] - :main-opts ["-e" "(require 'stencil.api) ((requiring-resolve 'stencil.spec/instrument))" - "-m" "cloverage.coverage" + :main-opts ["-m" "cloverage.coverage" "--codecov" "-p" "src" "-s" "test"]} From 8470ba449f1b6c68e75e7e3b35fb55f3a9f4d314 Mon Sep 17 00:00:00 2001 From: janos erdos Date: Mon, 22 Jul 2024 16:38:00 +0200 Subject: [PATCH 31/34] more requires --- deps.edn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps.edn b/deps.edn index 661a6c54..cae27aa3 100644 --- a/deps.edn +++ b/deps.edn @@ -32,7 +32,7 @@ :extra-deps {lambdaisland/kaocha {:mvn/version "1.87.1366"} lambdaisland/kaocha-junit-xml {:mvn/version "1.17.101"} org.slf4j/slf4j-simple {:mvn/version "1.7.32"}} - :main-opts ["-e" "(require 'stencil.api) ((requiring-resolve 'stencil.spec/instrument))" + :main-opts ["-e" "(require 'stencil.api 'stencil.process 'stencil.model) ((requiring-resolve 'stencil.spec/instrument))" "-m" "kaocha.runner" "--plugin" "kaocha.plugin/junit-xml" "--junit-xml-file" "target/surefire-reports/kaocha.xml"] From 9c338c37be740a2945ed9da77c861dd5ef5293dc Mon Sep 17 00:00:00 2001 From: janos erdos Date: Mon, 22 Jul 2024 16:39:41 +0200 Subject: [PATCH 32/34] more requires in codecov step also --- deps.edn | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deps.edn b/deps.edn index cae27aa3..aac7814f 100644 --- a/deps.edn +++ b/deps.edn @@ -23,7 +23,8 @@ :coverage {:extra-deps {cloverage/cloverage {:mvn/version "1.2.4"}} :extra-paths ["test" "test-resources"] - :main-opts ["-m" "cloverage.coverage" + :main-opts ["-e" "(require 'stencil.api 'stencil.process 'stencil.model) ((requiring-resolve 'stencil.spec/instrument))" + "-m" "cloverage.coverage" "--codecov" "-p" "src" "-s" "test"]} From 6af455e2882ec73f80d6a03a4500a20a1e11a72d Mon Sep 17 00:00:00 2001 From: janos erdos Date: Mon, 22 Jul 2024 17:07:30 +0200 Subject: [PATCH 33/34] fix: exclude spec ns from codecov report --- deps.edn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deps.edn b/deps.edn index aac7814f..e91ba4d8 100644 --- a/deps.edn +++ b/deps.edn @@ -23,9 +23,9 @@ :coverage {:extra-deps {cloverage/cloverage {:mvn/version "1.2.4"}} :extra-paths ["test" "test-resources"] - :main-opts ["-e" "(require 'stencil.api 'stencil.process 'stencil.model) ((requiring-resolve 'stencil.spec/instrument))" - "-m" "cloverage.coverage" + :main-opts ["-m" "cloverage.coverage" "--codecov" + "--ns-exclude-regex" "stencil.spec" "-p" "src" "-s" "test"]} :test From 496693a8a6c4e025e7901d702124cae176341556 Mon Sep 17 00:00:00 2001 From: janos erdos Date: Mon, 22 Jul 2024 17:14:00 +0200 Subject: [PATCH 34/34] fix: codecov setup --- deps.edn | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/deps.edn b/deps.edn index e91ba4d8..ccc44bf6 100644 --- a/deps.edn +++ b/deps.edn @@ -25,7 +25,10 @@ :extra-paths ["test" "test-resources"] :main-opts ["-m" "cloverage.coverage" "--codecov" - "--ns-exclude-regex" "stencil.spec" + "--exclude-call" "clojure.core/assert" + "--exclude-call" "stencil.util/trace" + "--exclude-call" "stencil.util/fail" + "--exclude-call" "clojure.spec.alpha/def" "-p" "src" "-s" "test"]} :test