-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add kaocha tests runner, run code coverage, bump deps, test mul…
…tiple JDKs (#17) * feat: add kaocha tests runner, run code coverage, bump deps * feat: report code coverage using lcov action * feat: add tests support for multiple JVMs via mise action
- Loading branch information
Showing
8 changed files
with
145 additions
and
48 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 |
---|---|---|
|
@@ -15,19 +15,59 @@ jobs: | |
~/.m2/repository | ||
~/.deps.clj | ||
key: cljdeps-${{ hashFiles('deps.edn') }} | ||
- name: Java setup | ||
uses: actions/setup-java@v3 | ||
- name: Mise-en-place setup | ||
uses: jdx/mise-action@v2 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '8' | ||
install: true | ||
cache: true | ||
- name: Setup Clojure | ||
uses: DeLaGuardo/[email protected] | ||
with: | ||
cli: 1.11.1.1413 | ||
- name: Run clojure linter | ||
run: scripts/lint | ||
- name: Run automated tests | ||
run: scripts/run-tests | ||
run: | | ||
mise use java@corretto-8 | ||
scripts/lint | ||
- name: Run automated tests - Java 8 | ||
run: | | ||
mise use java@corretto-8 | ||
java -version | ||
scripts/run-tests | ||
- name: Run automated tests - Java 11 | ||
run: | | ||
mise use java@corretto-11 | ||
java -version | ||
scripts/run-tests | ||
- name: Run automated tests - Java 17 | ||
run: | | ||
mise use java@corretto-17 | ||
java -version | ||
scripts/run-tests | ||
- name: Run automated tests - Java 19 | ||
run: | | ||
mise use java@corretto-19 | ||
java -version | ||
scripts/run-tests | ||
- name: Run automated tests - Java 21 | ||
run: | | ||
mise use java@corretto-21 | ||
java -version | ||
scripts/run-tests | ||
- name: Run automated tests - Java 22 | ||
run: | | ||
mise use java@corretto-22 | ||
java -version | ||
scripts/run-tests | ||
- name: Setup LCOV | ||
uses: hrishikesh-kadam/setup-lcov@v1 | ||
- name: Report code coverage | ||
uses: zgosalvez/github-actions-report-lcov@v3 | ||
with: | ||
coverage-files: target/coverage/lcov.info | ||
minimum-coverage: 0 | ||
artifact-name: code-coverage-report | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
update-comment: false | ||
- name: Cache dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
|
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,2 @@ | ||
[tools] | ||
java = "corretto-8" |
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
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/bash | ||
|
||
scripts/compile | ||
clojure -A:dev -M:test | ||
clojure -M:dev:test |
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
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,14 @@ | ||
(ns ham-fisted.test-setup | ||
"Things we need to do in order to run tests with a smile" | ||
(:require [kaocha.hierarchy :as hierarchy])) | ||
|
||
(hierarchy/derive! ::ignore :kaocha/known-key) | ||
|
||
(defn defuse-zero-assertions | ||
"Don't fail the test suite if we hide an `is` within a `doseq`. | ||
See also https://cljdoc.org/d/lambdaisland/kaocha/1.80.1274/doc/-clojure-test-assertion-extensions#detecting-missing-assertions" | ||
[event] | ||
(if (= (:type event) :kaocha.type.var/zero-assertions) | ||
(assoc event :type ::ignore) | ||
event)) |
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,44 @@ | ||
#kaocha/v1 {:capture-output? false | ||
:kaocha/fail-fast? false | ||
:plugins [:kaocha.plugin/profiling | ||
:kaocha.plugin/print-invocations | ||
:kaocha.plugin/junit-xml | ||
:kaocha.plugin/cloverage | ||
:kaocha.plugin/hooks | ||
:preloads] | ||
:kaocha.plugin.junit-xml/target-file "target/junit.xml" | ||
:kaocha.plugin.junit-xml/add-location-metadata? true | ||
:cloverage/opts {:ns-exclude-regex [] | ||
:text? true | ||
:lcov? true | ||
:high-watermark 80 | ||
:fail-threshold 0 | ||
:output "target/coverage" | ||
:low-watermark 50 | ||
:summary? true | ||
:coveralls? false | ||
:emma-xml? false | ||
:html? true | ||
:nop? false | ||
:codecov? true} | ||
:kaocha.hooks/pre-report [ham-fisted.test-setup/defuse-zero-assertions] | ||
:kaocha.plugin.preloads/ns-names [ham-fisted.test-setup] | ||
:tests [{:id :unit | ||
:plugins [:kaocha.plugin/profiling | ||
:kaocha.plugin/print-invocations | ||
:kaocha.plugin/junit-xml | ||
:kaocha.plugin/hooks | ||
:preloads] | ||
:kaocha/source-paths ["src"] | ||
:kaocha/test-paths ["test"] | ||
:ns-patterns [".*-test"]} | ||
{:id :coverage | ||
:plugins [:kaocha.plugin/profiling | ||
:kaocha.plugin/print-invocations | ||
:kaocha.plugin/junit-xml | ||
:kaocha.plugin/cloverage | ||
:kaocha.plugin/hooks | ||
:preloads] | ||
:kaocha/source-paths ["src"] | ||
:kaocha/test-paths ["test"] | ||
:ns-patterns [".*-test"]}]} |