Skip to content

Commit df37fbe

Browse files
authored
Merge pull request #13 from lambdaforge/3-adjust-to-datahike
Move to latest datahike and update build tooling
2 parents b4b2b79 + 2ddd9bb commit df37fbe

File tree

10 files changed

+233
-179
lines changed

10 files changed

+233
-179
lines changed

.circleci/config.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
version: 2.1
2+
3+
orbs:
4+
github-cli: circleci/[email protected]
5+
tools: replikativ/clj-tools@0
6+
7+
jobs:
8+
setup:
9+
executor: tools/clojurecli
10+
steps:
11+
- restore_cache:
12+
keys:
13+
- source-{{ .Branch }}-{{ .Revision }}
14+
- source-{{ .Branch }}
15+
- source-
16+
- checkout
17+
- save_cache:
18+
key: source-{{ .Branch }}-{{ .Revision }}
19+
paths:
20+
- .git
21+
- restore_cache:
22+
keys:
23+
- deps-{{ checksum "deps.edn" }}
24+
- deps-
25+
- run:
26+
name: resolve deps
27+
command: clojure -P
28+
- save_cache:
29+
key: deps-{{ checksum "deps.edn" }}
30+
paths:
31+
- /home/circleci/.m2
32+
- persist_to_workspace:
33+
root: /home/circleci/
34+
paths:
35+
- .m2
36+
- lambdaforge
37+
build:
38+
executor: tools/clojurecli
39+
steps:
40+
- attach_workspace:
41+
at: /home/circleci
42+
- run:
43+
name: clean
44+
command: clojure -Sthreads 1 -T:build clean
45+
- run:
46+
name: jar
47+
command: clojure -Sthreads 1 -T:build jar
48+
- persist_to_workspace:
49+
root: /home/circleci/
50+
paths:
51+
- .m2
52+
- lambdaforge
53+
test:
54+
executor: tools/clojurecli
55+
steps:
56+
- attach_workspace:
57+
at: /home/circleci
58+
- run:
59+
name: test
60+
command: clojure -Sthreads 1 -T:build test
61+
no_output_timeout: 5m
62+
deploy:
63+
executor: tools/clojurecli
64+
steps:
65+
- attach_workspace:
66+
at: /home/circleci
67+
- run:
68+
name: deploy
69+
command: clojure -Sthreads 1 -T:build deploy
70+
71+
workflows:
72+
build-test-and-deploy:
73+
jobs:
74+
- setup:
75+
context: clojars-deploy
76+
- build:
77+
context: clojars-deploy
78+
requires:
79+
- setup
80+
- tools/format:
81+
context: clojars-deploy
82+
requires:
83+
- setup
84+
- test:
85+
context: clojars-deploy
86+
requires:
87+
- build
88+
- deploy:
89+
context: clojars-deploy
90+
filters:
91+
branches:
92+
only: main
93+
requires:
94+
- tools/format
95+
- test

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,10 @@ profiles.clj
99
.hgignore
1010
.hg/
1111
.idea
12+
/.clj-kondo
13+
/.lsp
14+
/.classpath
15+
/.project
16+
/.settings
17+
*.iml
18+
/.cpcache

README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ Migration tool for Datahike from and to other databases.
44

55
## Usage
66

7-
Make sure your source and target databases exist. You can run the migration on the commandline:
7+
Make sure your source and target databases exist. You can run the migration on the commandline using [clojure CLI](https://clojure.org/reference/deps_and_cli):
88

99
```bash
10-
lein run -s datomic-cloud.edn -t datahike-pg.edn
10+
clj -M:run-m -s datomic-cloud.edn -t datahike-file.edn
1111
```
1212

13-
Use `lein run -- -h` for further instructions. See the `*-example.edn` files for `dataomic-cloud` and `datahike-pg` example configurations.
13+
Use `clj -M:run-m -h` for further instructions. See the `*-example.edn` files for `dataomic-cloud`, `datahike-file` or `nippy` example configurations.
1414

1515
Alternatively open your Clojure project, add `io.lambdaforge/wanderung` to your dependencies, and start a REPL:
1616

@@ -35,17 +35,28 @@ Alternatively open your Clojure project, add `io.lambdaforge/wanderung` to your
3535

3636
(w/migrate datomic-cfg datahike-cfg)
3737
```
38+
You can use `clj -T:build jar` to create a jar file and `clj -T:build install` to install the library in your local maven repository.
39+
Take a look at `build.clj` for further commands.
3840

3941
## Tests
4042

4143
Before using Wanderung for performing a migration, you may wish to run tests that to check that Wanderung works correctly. In order to do so, you need to perform the following steps:
4244

4345
1. Install [Datomic dev-local](https://docs.datomic.com/cloud/dev-local.html).
44-
2. Run the tests by calling `lein test`. In case they fail or in case there are errors, do `lein clean` and attempt to run the tests again.
46+
2. Run the tests by calling `clj -T:build test`. With `clj -T:build clean` you can clean up your local build files.
47+
48+
## Contributors
49+
- @perweij
50+
- @vlaaad
51+
- @jonasseglare
52+
53+
## Deprecation notice
54+
55+
Starting from version `0.2.0` wanderung does not support leiningen as build tool anymore. Please adjust accordingly in your project when using wanderung from the commandline.
4556

4657
## License
4758

48-
Copyright © 2020 lambdaforge UG (haftungsbeschränkt)
59+
Copyright © 2020-2022 lambdaforge UG (haftungsbeschränkt) & Contributors
4960

5061
This program and the accompanying materials are made available under the
5162
terms of the Eclipse Public License 2.0 which is available at

build.clj

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
(ns build
2+
(:refer-clojure :exclude [test compile])
3+
(:require [clojure.tools.build.api :as b]
4+
[borkdude.gh-release-artifact :as gh]
5+
[org.corfield.build :as bb]))
6+
7+
(def lib 'io.lambdaforge/wanderung)
8+
(def version (format "0.2.%s" (b/git-count-revs nil)))
9+
(def class-dir "target/classes")
10+
(def basis (b/create-basis {:project "deps.edn"}))
11+
(def jar-file (format "target/%s-%s.jar" (name lib) version))
12+
13+
(defn clean
14+
[_]
15+
(b/delete {:path "target"}))
16+
17+
18+
(defn jar
19+
[opts]
20+
(-> opts
21+
(assoc :class-dir class-dir
22+
:src-pom "./template/pom.xml"
23+
:lib lib
24+
:version version
25+
:basis basis
26+
:jar-file jar-file
27+
:src-dirs ["src"])
28+
bb/jar))
29+
30+
31+
(defn test "Run the tests." [opts]
32+
(bb/run-tests opts))
33+
34+
(defn ci "Run the CI pipeline of tests (and build the JAR)." [opts]
35+
(-> opts
36+
(assoc :lib lib :version version)
37+
(bb/run-tests)
38+
bb/clean
39+
bb/jar))
40+
41+
(defn install "Install the JAR locally." [opts]
42+
(-> opts
43+
jar
44+
(bb/install)))
45+
46+
(defn deploy "Deploy the JAR to Clojars." [opts]
47+
(-> opts
48+
(assoc :installer :remote
49+
:artifact jar-file
50+
:pom-file (b/pom-path {:lib lib :class-dir class-dir}))
51+
(bb/deploy)))
52+
53+
(defn release
54+
[_]
55+
(-> (gh/overwrite-asset {:org "lambdaforge"
56+
:repo (name lib)
57+
:tag version
58+
:commit (gh/current-commit)
59+
:file jar-file
60+
:content-type "application/java-archive"})
61+
:url
62+
println))
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{:wanderung/type :datahike
2-
:store {:backend :jdbc
3-
:dbtype "postgresql"
4-
:user "datahike"
5-
:password "is-awesome"
6-
:dbname "migration"}
2+
:store {:backend :file
3+
:path "/tmp/dh"}
74
;; uncomment and adjust the following if the database does not exist
85
;; :schema-flexibility :write
96
;; :keep-history :true

deps.edn

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{:paths ["src" "resources"]
2+
:deps {org.clojure/clojure {:mvn/version "1.10.3"}
3+
io.replikativ/konserve {:mvn/version "0.6.0-alpha3"}
4+
io.replikativ/datahike {:mvn/version "0.4.1481" :exclusions [io.replikativ/konserve]}
5+
com.datomic/client-cloud {:mvn/version "0.8.105"}
6+
com.cognitect/transit-clj {:mvn/version "0.8.313"}
7+
com.taoensso/nippy {:mvn/version "3.1.1"}
8+
org.clojure/tools.cli {:mvn/version "1.0.206"}}
9+
:aliases
10+
{:run-m {:main-opts ["-m" "wanderung.core"]}
11+
:dev {:extra-deps {org.clojure/test.check {:mvn/version "0.9.0"}}}
12+
:test {:extra-paths ["test"]
13+
:extra-deps {com.datomic/dev-local {:mvn/version "1.0.242"}
14+
io.github.cognitect-labs/test-runner {:git/tag "v0.5.0"
15+
:git/sha "48c3c67"}}}
16+
:format {:extra-deps {cljfmt/cljfmt {:mvn/version "0.8.0"}}
17+
:main-opts ["-m" "cljfmt.main" "check"]}
18+
19+
:ffix {:extra-deps {cljfmt/cljfmt {:mvn/version "0.8.0"}}
20+
:main-opts ["-m" "cljfmt.main" "fix"]}
21+
:build {:deps {io.github.seancorfield/build-clj {:git/tag "v0.6.6"
22+
:git/sha "171d5f1"}
23+
borkdude/gh-release-artifact {:git/url "https://github.com/borkdude/gh-release-artifact"
24+
:sha "a83ee8da47d56a80b6380cbb6b4b9274048067bd"}
25+
babashka/babashka.curl {:mvn/version "0.1.1"}
26+
babashka/fs {:mvn/version "0.1.2"}
27+
cheshire/cheshire {:mvn/version "5.10.1"}}
28+
:ns-default build}}
29+
:mvn/repos {"s3mvn" {:url "s3://lambdaforge-blobs/maven/releases"}}}

pom.xml

Lines changed: 0 additions & 137 deletions
This file was deleted.

0 commit comments

Comments
 (0)