-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: tests in main flow
- Loading branch information
Showing
16 changed files
with
268 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,19 +10,25 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install Clojure tools | ||
uses: DeLaGuardo/[email protected] | ||
with: | ||
cli: latest | ||
- name: Install dependencies | ||
run: lein deps | ||
- name: Run Clojure Tests | ||
run: lein test | ||
- name: Run Java Tests | ||
run: lein pom && mvn test --batch-mode --fail-at-end | ||
run: make prepare | ||
- name: Run Tests | ||
run: make clj-test java-test | ||
coverage: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install Clojure tools | ||
uses: DeLaGuardo/[email protected] | ||
with: | ||
cli: latest | ||
- name: Coverage | ||
run: lein coverage | ||
run: make coverage | ||
- name: Codecov | ||
uses: codecov/codecov-action@v2 | ||
with: | ||
|
@@ -33,13 +39,20 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install dependencies | ||
run: lein deps | ||
- name: Install Clojure tools | ||
uses: DeLaGuardo/[email protected] | ||
with: | ||
cli: latest | ||
- name: Create jar and pom files | ||
run: | | ||
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 | ||
env: | ||
CLOJARS_USER: ${{ secrets.CLOJARS_USER }} | ||
CLOJARS_PASS: ${{ secrets.CLOJARS_PASS }} | ||
run: lein deploy snapshots || echo skipping | ||
CLOJARS_USERNAME: ${{ secrets.CLOJARS_USER }} | ||
CLOJARS_PASSWORD: ${{ secrets.CLOJARS_PASS }} | ||
run: clojure -X:deploy || echo skipping | ||
docker_push: | ||
needs: clojars_push | ||
runs-on: ubuntu-latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,10 +25,12 @@ jobs: | |
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Compile uberjar | ||
run: lein uberjar | ||
- name: Install Clojure tools | ||
uses: DeLaGuardo/[email protected] | ||
with: | ||
cli: latest | ||
- 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 && make javadoc && cp -R target/javadoc _site | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v3 | ||
- name: Build with Jekyll | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,21 +12,19 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install dependencies | ||
run: lein deps | ||
- name: Compile Java | ||
run: lein javac | ||
- name: Install Clojure tools | ||
uses: DeLaGuardo/[email protected] | ||
with: | ||
cli: latest | ||
- name: Coverage | ||
run: lein coverage | ||
run: make 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 | ||
- name: Run unit tests | ||
run: make clj-test java-test | ||
- name: Test Report | ||
uses: dorny/test-reporter@v1 | ||
if: success() || failure() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,12 +17,12 @@ 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 dependencies | ||
run: lein deps | ||
- name: Compile Java | ||
run: lein javac | ||
- name: Install Clojure tools | ||
uses: DeLaGuardo/[email protected] | ||
with: | ||
cli: latest | ||
- name: Test Clojure | ||
run: lein test stencil.visual-test | ||
run: make visual-test | ||
- name: Archive diff png | ||
uses: actions/upload-artifact@v3 | ||
if: failure() | ||
|
@@ -35,5 +35,5 @@ jobs: | |
if: success() || failure() | ||
with: | ||
name: Visual Tests | ||
path: target/visual-reports/*.xml | ||
path: target/surefire-reports/*.xml | ||
reporter: java-junit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,5 @@ junit.xml | |
.lsp/ | ||
*.jfr | ||
.clj-kondo/ | ||
/_site/ | ||
/_site/ | ||
.cpcache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
.PHONY: clean prepare lint pom jar uberjar javadoc compile clj-test java-test visual-test coverage 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 | ||
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 visual-test | ||
|
||
all: clean compile lint test javadoc uberjar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
(ns build | ||
(: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 (-> basis :aliases :stencil/version (doto assert))) | ||
|
||
(def lib 'io.github.erdos/stencil-core) | ||
|
||
(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) | ||
(b/javac {:src-dirs ["java-src"] | ||
:basis basis | ||
:class-dir jar-content | ||
: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) | ||
opts) | ||
|
||
(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 pom [opts] | ||
(println "Generating pom.xml file") | ||
(b/write-pom | ||
{:class-dir jar-content | ||
:basis basis | ||
:version version | ||
: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 jar-file-name}) | ||
(println "Built JAR file") | ||
opts) | ||
|
||
(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 | ||
:bindings {#'*warn-on-reflection* true}}) | ||
(-> {:basis basis | ||
:main "org.junit.platform.console.ConsoleLauncher" | ||
:main-args ["-p" "io.github.erdos.stencil" | ||
"--fail-if-no-tests" | ||
"--reports-dir=target/surefire-reports"]} | ||
(b/java-command) | ||
(b/process) | ||
(#(when-not (zero? (:exit %)) (throw (ex-info "junit error" %))))) | ||
(println "Done")) | ||
|
||
(defn uber [opts] | ||
(jar opts) | ||
(b/uber {:class-dir jar-content | ||
:uber-file uber-file-name | ||
:basis basis | ||
:main 'io.github.erdos.stencil.Main}) | ||
(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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{: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"] | ||
:aliases | ||
{: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} | ||
|
||
: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"]} | ||
|
||
:coverage | ||
{:extra-deps {cloverage/cloverage {:mvn/version "1.2.4"}} | ||
:extra-paths ["test" "test-resources"] | ||
:main-opts ["-m" "cloverage.coverage" | ||
"--codecov" | ||
"--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 | ||
{: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 ["-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"] | ||
: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 "stencil-core.jar"}}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.