Skip to content

Commit

Permalink
[nop] Update project template
Browse files Browse the repository at this point in the history
  • Loading branch information
ptaoussanis committed Sep 26, 2023
1 parent c99aacd commit 7b1d8c7
Show file tree
Hide file tree
Showing 14 changed files with 207 additions and 84 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/graal-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Graal tests
on: [push, pull_request]

jobs:
test:
strategy:
matrix:
java: ['17']
os: [ubuntu-latest, macOS-latest, windows-latest]

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: graalvm/setup-graalvm@v1
with:
version: 'latest'
java-version: ${{ matrix.java }}
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}

- uses: DeLaGuardo/[email protected]
with:
lein: latest
bb: latest

- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: deps-${{ hashFiles('deps.edn') }}
restore-keys: deps-

- run: bb graal-tests
30 changes: 30 additions & 0 deletions .github/workflows/main-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Main tests
on: [push, pull_request]

jobs:
tests:
strategy:
matrix:
java: ['17', '18', '19']
os: [ubuntu-latest]

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: ${{ matrix.java }}

- uses: DeLaGuardo/[email protected]
with:
lein: latest

- uses: actions/cache@v3
id: cache-deps
with:
path: ~/.m2/repository
key: deps-${{ hashFiles('project.clj') }}
restore-keys: deps-

- run: lein test-all
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@ pom.xml*
/target/
/checkouts/
/logs/
/docs/
/doc/
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
> This project uses [Break Versioning](https://github.com/ptaoussanis/encore/blob/master/BREAK-VERSIONING.md) as of **Aug 16, 2014**.
This project uses Break Versioning (https://www.taoensso.com/break-versioning)

## v2.0.2 / 2014 Mar 8

Expand Down
2 changes: 2 additions & 0 deletions FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: ptaoussanis
custom: "https://www.taoensso.com/clojure"
56 changes: 24 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,31 @@
<a href="https://www.taoensso.com" title="More stuff by @ptaoussanis at www.taoensso.com">
<img src="https://www.taoensso.com/taoensso-open-source.png" alt="Taoensso open-source" width="400"/></a>
<img src="https://www.taoensso.com/taoensso-open-source.png" alt="Taoensso open-source" width="350"/></a>

**[CHANGELOG]** | [API] | current [Break Version]:
**[CHANGELOG][]** | [API][] | current [Break Version][]:

```clojure
[com.taoensso/touchstone "2.0.2"] ; Stable
[com.taoensso/touchstone "2.0.2"] ; Mature/stable (basically "done")
```

> Please consider helping to [support my continued open-source Clojure/Script work]?
>
> Even small contributions can add up + make a big difference to help sustain my time writing, maintaining, and supporting Touchstone and other Clojure/Script libraries. **Thank you!**
>
> \- Peter Taoussanis
> See [here][backers] if to help support my open-source work, thanks! - [Peter Taoussanis][Taoensso.com]
# Touchstone
# Touchstone: a split testing library for Clojure

## Split testing library for Clojure
[A/B testing][] is great for **conversion optimization**. We should all be doing more of it. But traditional A/B tests can be a nuisance to setup and monitor.

[A/B testing] is great for **conversion optimization**. We should all be doing more of it. But traditional A/B tests can be a nuisance to setup and monitor.

Touchstone is an attempt to bring **dead-simple, high-power split-testing** to any Clojure web application. It uses [multi-armed bandit] techniques to provide **fast, accurate, low-maintenance** conversion optimization. The API is simple and *highly flexible*.
Touchstone is an attempt to bring **dead-simple, high-power split-testing** to any Clojure web application. It uses [multi-armed bandit][] techniques to provide **fast, accurate, low-maintenance** conversion optimization. The API is simple and *highly flexible*.

## Library status

**Last updated**: Jan 2016

Haven't updated the lib in forever, but it's **stable and works well in production**. Do have some new stuff planned for a future update (particularly docs re: use with modern Cljs applications), but no ETA on that yet.

\- [Peter Taoussanis]
\- [Peter Taoussanis][Taoensso.com]

## Features
* Tiny, **simple API**
* **Great performance** backed by Redis+[Carmine]
* **Great performance** backed by Redis and [Carmine][]
* **High flexibility** (variations are *arbitrary Clojure forms*)
* **Low maintenace** (fire-and-forget, automatic-selection algorithm)
* Fire-and-forget **multivariate** testing
Expand All @@ -43,7 +37,8 @@ Haven't updated the lib in forever, but it's **stable and works well in producti
Add the necessary dependency to your project:

```clojure
[com.taoensso/touchstone "2.0.2"]
Leiningen: [com.taoensso/touchstone "2.0.2"] ; or
deps.edn: com.taoensso/touchstone {:mvn/version "2.0.2"}
```

And setup your namespace imports:
Expand Down Expand Up @@ -95,38 +90,35 @@ Touchstone will now **automatically** start using accumulated statistical data t

And you're done! That's literally all there is to it.

See the `mab-select` and `mab-commit!` [API] docs for info on more advanced capabilities like **multivariate testing, test composition (dependent tests), arbitrary scoring, engagement testing**, etc.
See the `mab-select` and `mab-commit!` [API][] docs for info on more advanced capabilities like **multivariate testing, test composition (dependent tests), arbitrary scoring, engagement testing**, etc.

## Contacting me / contributions

Please use the project's [GitHub issues page] for all questions, ideas, etc. **Pull requests welcome**. See the project's [GitHub contributors page] for a list of contributors.
Please use the project's [GitHub issues page][] for all questions, ideas, etc. **Pull requests welcome**. See the project's [GitHub contributors page][] for a list of contributors.

Otherwise, you can reach me at [Taoensso.com]. Happy hacking!
Otherwise, you can reach me at [Taoensso.com][]. Happy hacking!

\- [Peter Taoussanis]
\- [Peter Taoussanis][Taoensso.com]

## License

Distributed under the [EPL v1.0] \(same as Clojure).
Copyright &copy; 2012-2016 [Peter Taoussanis].
Distributed under the [EPL v1.0][] \(same as Clojure).
Copyright &copy; 2012-2022 [Peter Taoussanis][Taoensso.com].

<!--- Standard links -->
[Taoensso.com]: https://www.taoensso.com
[Peter Taoussanis]: https://www.taoensso.com
[@ptaoussanis]: https://www.taoensso.com
[More by @ptaoussanis]: https://www.taoensso.com
[Break Version]: https://github.com/ptaoussanis/encore/blob/master/BREAK-VERSIONING.md
[support my continued open-source Clojure/Script work]: http://taoensso.com/clojure/backers
[Break Version]: https://github.com/taoensso/encore/blob/master/BREAK-VERSIONING.md
[backers]: https://taoensso.com/clojure/backers

<!--- Standard links (repo specific) -->
[CHANGELOG]: https://github.com/ptaoussanis/touchstone/releases
[API]: http://ptaoussanis.github.io/touchstone/
[GitHub issues page]: https://github.com/ptaoussanis/touchstone/issues
[GitHub contributors page]: https://github.com/ptaoussanis/touchstone/graphs/contributors
[CHANGELOG]: https://github.com/taoensso/touchstone/releases
[API]: http://taoensso.github.io/touchstone/
[GitHub issues page]: https://github.com/taoensso/touchstone/issues
[GitHub contributors page]: https://github.com/taoensso/touchstone/graphs/contributors
[EPL v1.0]: https://raw.githubusercontent.com/ptaoussanis/touchstone/master/LICENSE
[Hero]: https://raw.githubusercontent.com/ptaoussanis/touchstone/master/hero.png "Title"

<!--- Unique links -->
[A/B testing]: http://en.wikipedia.org/wiki/A/B_testing
[multi-armed bandit]: http://en.wikipedia.org/wiki/Multi-armed_bandit
[Carmine]: https://github.com/ptaoussanis/carmine
[Carmine]: https://github.com/taoensso/carmine
10 changes: 10 additions & 0 deletions bb.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{:paths ["bb"]
:tasks
{:requires ([graal-tests])
graal-tests
{:doc "Run Graal native-image tests"
:task
(do
(graal-tests/uberjar)
(graal-tests/native-image)
(graal-tests/run-tests))}}}
36 changes: 36 additions & 0 deletions bb/graal_tests.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bb

(ns graal-tests
(:require
[clojure.string :as str]
[babashka.fs :as fs]
[babashka.process :refer [shell]]))

(defn uberjar []
(let [command "lein with-profiles +graal-tests uberjar"
command
(if (fs/windows?)
(if (fs/which "lein")
command
;; Assume PowerShell powershell module
(str "powershell.exe -command " (pr-str command)))
command)]

(shell command)))

(defn executable [dir name]
(-> (fs/glob dir (if (fs/windows?) (str name ".{exe,bat,cmd}") name))
first
fs/canonicalize
str))

(defn native-image []
(let [graalvm-home (System/getenv "GRAALVM_HOME")
bin-dir (str (fs/file graalvm-home "bin"))]
(shell (executable bin-dir "gu") "install" "native-image")
(shell (executable bin-dir "native-image") "-jar" "target/graal-tests.jar" "--no-fallback" "graal_tests")))

(defn run-tests []
(let [{:keys [out]} (shell {:out :string} (executable "." "graal_tests"))]
(assert (str/includes? out "loaded") out)
(println "Native image works!")))
2 changes: 2 additions & 0 deletions doc/cljdoc.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{:cljdoc/docstring-format :plaintext}

87 changes: 51 additions & 36 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,48 +1,63 @@
(defproject com.taoensso/touchstone "2.1.0"
:author "Peter Taoussanis <https://www.taoensso.com>"
:description "Split testing library for Clojure"
:url "https://github.com/ptaoussanis/touchstone"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"
:distribution :repo
:comments "Same as Clojure"}
:min-lein-version "2.3.3"
:global-vars {*warn-on-reflection* true
*assert* true}
:dependencies
[[org.clojure/clojure "1.5.1"]
[com.taoensso/encore "2.68.0"]
[com.taoensso/carmine "2.14.0"]
[org.clojure/math.combinatorics "0.0.7"]]
:description "Simple A/B testing for Clojure applications"
:url "https://github.com/taoensso/touchstone"

:license
{:name "Eclipse Public License - v 1.0"
:url "https://www.eclipse.org/legal/epl-v10.html"}

:plugins
[[lein-pprint "1.1.2"]
[lein-ancient "0.6.10"]
[lein-codox "0.9.5"]]
:dependencies
[[com.taoensso/encore "3.31.0"]
[com.taoensso/carmine "3.1.0"]
[org.clojure/math.combinatorics "0.1.6"]]

:profiles
{;; :default [:base :system :user :provided :dev]
:server-jvm {:jvm-opts ^:replace ["-server"]}
:1.5 {:dependencies [[org.clojure/clojure "1.5.1"]]}
:1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}
:1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]}
:1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}
:1.9 {:dependencies [[org.clojure/clojure "1.9.0-alpha10"]]}
:test {:dependencies [[org.clojure/test.check "0.9.0"]
[ring/ring-core "1.5.0"]]}
:provided {:dependencies [[org.clojure/clojurescript "1.11.60"]
[org.clojure/clojure "1.11.1"]]}
:c1.11 {:dependencies [[org.clojure/clojure "1.11.1"]]}
:c1.10 {:dependencies [[org.clojure/clojure "1.10.3"]]}
:c1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]}

:test
{:jvm-opts [#_"-Dtaoensso.elide-deprecated=true"]
:global-vars
{*warn-on-reflection* true
*assert* true
*unchecked-math* false #_:warn-on-boxed}

:dependencies
[[org.clojure/test.check "1.1.1"]
[ring/ring-core "1.9.6"]]}

:graal-tests
{:dependencies [[org.clojure/clojure "1.11.1"]
[com.github.clj-easy/graal-build-time "0.1.4"]]
:main taoensso.graal-tests
:aot [taoensso.graal-tests]
:uberjar-name "graal-tests.jar"}

:dev
[:1.9 :test :server-jvm]}
[:c1.11 :test
{:jvm-opts ["-server"]
:plugins
[[lein-pprint "1.3.2"]
[lein-ancient "0.7.0"]
[lein-cljsbuild "1.1.8"]
[com.taoensso.forks/lein-codox "0.10.10"]]

:test-paths ["test" "src"]
:codox
{:language #{:clojure :clojurescript}
:base-language :clojure}}]}

:codox
{:language :clojure
:source-uri "https://github.com/ptaoussanis/carmine/blob/master/{filepath}#L{line}"}
:test-paths ["test" #_"src"]

:aliases
{"test-all" ["with-profile" "+1.9:+1.8:+1.7:+1.6:+1.5" "test"]
"deploy-lib" ["do" "deploy" "clojars," "install"]
"start-dev" ["with-profile" "+dev" "repl" ":headless"]}
{"start-dev" ["with-profile" "+dev" "repl" ":headless"]
"build-once" ["do" ["clean"] ["cljsbuild" "once"]]
"deploy-lib" ["do" ["build-once"] ["deploy" "clojars"] ["install"]]

:repositories {"sonatype-oss-public"
"https://oss.sonatype.org/content/groups/public/"})
"test-clj" ["with-profile" "+c1.11:+c1.10:+c1.9" "test"]
"test-cljs" ["with-profile" "+test" "cljsbuild" "test"]
"test-all" ["do" ["clean"] ["test-clj"] ["test-cljs"]]})
4 changes: 1 addition & 3 deletions src/taoensso/touchstone.clj
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
[taoensso.carmine :as car :refer (wcar)]
[taoensso.touchstone.utils :as utils]))

(if (vector? enc/encore-version)
(enc/assert-min-encore-version [2 67 2])
(enc/assert-min-encore-version 2.67))
(enc/assert-min-encore-version [3 31 0])

;; TODO `conn`->`conn-opts` for consistency with Carmine v3

Expand Down
5 changes: 5 additions & 0 deletions test/taoensso/graal_tests.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(ns taoensso.graal-tests
(:require [taoensso.touchstone :as touchstone])
(:gen-class))

(defn -main [& args] (println "Namespace loaded successfully"))
10 changes: 0 additions & 10 deletions test/taoensso/touchstone/tests/main.clj

This file was deleted.

13 changes: 13 additions & 0 deletions test/taoensso/touchstone_tests.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
(ns taoensso.touchstone-tests
(:require
[clojure.test :as test :refer [deftest testing is]]
[taoensso.encore :as enc]))

(comment
(remove-ns 'taoensso.touchstone-tests)
(test/run-tests 'taoensso.touchstone-tests))

;;;;

;; (deftest pass (is (= 1 1)))
;; (deftest fail (is (= 1 0)))

0 comments on commit 7b1d8c7

Please sign in to comment.