diff --git a/.github/workflows/clojure.yml b/.github/workflows/clojure.yml new file mode 100644 index 0000000..acb0c12 --- /dev/null +++ b/.github/workflows/clojure.yml @@ -0,0 +1,61 @@ +--- +name: Run tests + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + build-clj: + strategy: + matrix: + # Supported Java versions: LTS releases and latest + jdk: [8, 11, 17, 21] + clojure: [11] + + name: Clojure ${{ matrix.clojure }} (Java ${{ matrix.jdk }}) + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Setup Java ${{ matrix.jdk }} + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: ${{ matrix.jdk }} + cache: maven + - name: Setup Clojure + uses: DeLaGuardo/setup-clojure@master + with: + cli: latest + - name: Run tests + run: CLOJURE_ALIAS=clojure-${{ matrix.clojure }} bin/run-clojure-tests + + build-cljs: + name: ClojureScript + strategy: + matrix: + mode: [none, advanced, cherry-none, cherry-advanced] + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Java 11 + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 11 + cache: maven + - name: Setup Clojure + uses: DeLaGuardo/setup-clojure@master + with: + cli: latest + - name: Setup Node.js + uses: actions/setup-node@v4.0.1 + with: + node-version: 16 + - name: Run tests on ${{ matrix.mode }} + run: bin/run-cljs-tests ${{ matrix.mode }} diff --git a/bin/run-cljs-tests b/bin/run-cljs-tests new file mode 100755 index 0000000..a050aca --- /dev/null +++ b/bin/run-cljs-tests @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +set -eo pipefail + +none() { + echo 'Running CLJS test in Node with optimizations :none' + TEST_SCI=true clojure -M:test:cljs-test-runner:sci:test-sci -c '{:optimizations :none}' "$@" +} + +advanced() { + echo 'Running CLJS test in Node with optimizations :advanced' + TEST_SCI=true clojure -M:test:cljs-test-runner:sci:test-sci -c '{:optimizations :advanced}' -e :simple "$@" +} + +cherry-none() { + echo 'Running CLJS test in Node with cherry + optimizations :none' + clojure -M:test:cljs-test-runner:cherry:test-cherry -c '{:optimizations :none}' "$@" +} + +cherry-advanced() { + echo 'Running CLJS test in Node with cherry + optimizations :advanced' + # :optimize-constants is set to false until https://clojure.atlassian.net/browse/CLJS-3401 is fixed + clojure -M:test:cljs-test-runner:cherry:test-cherry -c '{:optimizations :advanced :optimize-constants false}' -e :simple "$@" +} + +case $1 in + none) none ;; + advanced) advanced ;; + cherry-none) cherry-none ;; + cherry-advanced) cherry-advanced ;; + *) none; advanced; cherry; cherry-advanced ;; +esac diff --git a/bin/run-clojure-tests b/bin/run-clojure-tests new file mode 100755 index 0000000..9c1c4ce --- /dev/null +++ b/bin/run-clojure-tests @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +# Should work if the env var is empty +clojure -A:$CLOJURE_ALIAS -M:test -m kaocha.runner "$@" diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..7c25562 --- /dev/null +++ b/pom.xml @@ -0,0 +1,57 @@ + + + 4.0.0 + metosin + virhe + 0.1.0-SNAPSHOT + virhe + + + Eclipse Public License 2.0 + https://www.eclipse.org/legal/epl-2.0/ + + + + https://github.com/metosin/virhe + scm:git:git://github.com/metosin/virhe.git + scm:git:ssh://git@github.com/metosin/virhe.git + + + + fipp + fipp + 0.6.26 + + + mvxcvi + arrangement + 2.1.0 + + + org.clojure + test.check + 1.1.1 + + + + src + + + src + + + + + + clojars + https://repo.clojars.org/ + + + + + clojars + Clojars repository + https://clojars.org/repo + + +