Skip to content

Commit

Permalink
Merge pull request #3 from hephaistox/feat/mati/compilation
Browse files Browse the repository at this point in the history
Up to date code
  • Loading branch information
Kaspazza authored Dec 28, 2023
2 parents 9729eb2 + 996d1e8 commit cc32c56
Show file tree
Hide file tree
Showing 155 changed files with 5,668 additions and 2,685 deletions.
2 changes: 0 additions & 2 deletions .clj-kondo/config.edn
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
me.raynes.conch/let-programs clojure.core/let
day8.re-frame.tracing/fn-traced clojure.core/fn
outpace.config/defconfig clojure.core/def
devcards.core/defcard clojure.core/def
devcards.core/defcard-rg clojure.core/def
spade.core/defclass clojure.core/defn
mount.core/defstate clojure.core/def
spade.core/defglobal clojure.core/def}}
15 changes: 15 additions & 0 deletions .github/workflows/commit_validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Commit validation
run-name: ${{ github.event.head_commit.message }} pushed by ${{ github.actor }}, to test and lint - $${{ github.sha }}
on: [push]
jobs:
run-bb:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set ownership
run: |
# this is to fix GIT not liking owner of the checkout dir, See https://github.com/actions/runner/issues/2033
chown -R $(id -u):$(id -g) $PWD
- name: Base image
uses: docker://hephaistox/gha-automaton-core:v0.0.1
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
# Automaton core

Automaton core is the root of all of Hephaistox projects. It is based on no other Hephaistox project.

This one should be agnostic of any environment, so it should run on the following examples of technology:
* CLI
* backend of web app,
* frontend of web app,
* Android frontend,
* Android backend, ...
75 changes: 9 additions & 66 deletions bb.edn
Original file line number Diff line number Diff line change
@@ -1,66 +1,9 @@
{:paths []
:deps {}
:tasks {:init (do
(defn to-log
"Generate map for process to write in logs."
[msg log-filename]
(fs/create-dirs "logs")
(println msg ", see " log-filename " for details")
{:out :write
:err :write
:err-file log-filename
:out-file log-filename
:shutdown p/destroy-tree})
(defn to-out
"Generate map for process to write in std"
[]
{:out :inherit
:in :inherit
:err :inherit
:shutdown p/destroy-tree})
(defn run-process
"Run a process with logs features"
[process]
(try
(p/check (process))
(catch Exception e
(println (str "Error during execution of `" (:name (current-task)) "`"))
(let [file (fs/create-temp-file)]
(println "See details in `" (.toString (.toAbsolutePath file)) "`")
(spit (fs/file file) (prn-str e))
"")
(System/exit 1)))))
:requires [[babashka.process :as p]
[babashka.fs :as fs]]
test {:doc "Test"
:task (run-process (fn []
(p/process ["clj" "-M:runner"]
(to-out))))}
lint {:doc "Lint"
:task (run-process (fn []
(p/process ["clj-kondo"
"--lint"
"src/clj" "src/cljc"
;"resources"
"env/dev/src/clj"
"env/dev/resources"
"env/test/resources"
;"env/test/src/clj"
;"env/test/src/cljc"
;"env/dev/src/cljc"
"test/clj" "test/cljc"
"test/resources"]
(to-out))))}
repl {:doc "Repl"
:task (run-process (fn []
(p/process ["clj" "-M:repl"]
(to-out))))}
;; (test-frontend {:doc "Test frontend"
;; :task (run-process (fn []
;; (-> (p/process ["npm" "install"]
;; (to-out)))
;; (-> (p/process ["npx" "shadow-cljs" "compile" "karma-test"]
;; (to-out)))
;; (-> (p/process ["npx" "karma" "start" "--single-run"]
;; (to-out)))))})
}}
{:deps {org.clojars.hephaistox/automaton-build-app {:mvn/version "0.0.9"}}
:paths []
:tasks {:requires [[automaton-build-app.tasks.launcher.bb-entrypoint :as build-task-bb-entrypoint] [babashka.process :as babahska-process]]
heph-task {:doc "Launch an Hephaistox task"
:task (System/exit (build-task-bb-entrypoint/-main *command-line-args*))}
lconnect {:doc "Repl in case automaton-core is failing. Using -f or --force cli arguments to force start if some part are failing"
:task (try (-> (babahska-process/shell "clojure" "-M:common-test:env-development-repl:build" *command-line-args*)
System/exit)
(catch Exception e (println "Repl failed also - error during repl startup" (ex-message e))))}}}
18 changes: 13 additions & 5 deletions build_config.edn
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
{:publication {:as-lib hephaistox/automaton-core
:repo-address "[email protected]:hephaistox/automaton-core.git"
:branch "main"}
:app-name "automaton-core"
:monorepo {:app-dir "automaton/automaton-core"}}
{:app-name "automaton-core"
:task-shared {:gha {}
:mermaid-dir "docs/code/"
:publication {:as-lib org.clojars.hephaistox/automaton-core
:branch "main"
:jar-path "target/prod/automaton-core.jar"
:major-version "0.0.%d"
:pom-path "target/prod/class/META-INF/maven/org.clojars.hephaistox/automaton-core/pom.xml"
:repo "[email protected]:hephaistox/automaton-core.git"}
:repl-aliases [:common-test :env-development-repl :build]
:storage-datomic {:datomic-ver "1.0.7021"}}
:tasks {:clean {:dirs [".cpcache/" ".clj-kondo/.cache/" "tmp/" "target/" "node_modules/" ".shadow-cljs/builds/"]}
:reports {:forbiddenwords-words #{"automaton-web" "landing" "tap>"}}}}
88 changes: 48 additions & 40 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -1,40 +1,48 @@
{:paths ["src/clj" "src/cljc" "resources"]
:deps {babashka/fs #:mvn{:version "0.4.19"},
babashka/process #:mvn{:version "0.5.21"},
danlentz/clj-uuid #:mvn{:version "0.1.9"},
metosin/malli #:mvn{:version "0.11.0"},
mount/mount #:mvn{:version "0.1.17"},
com.clojure-goes-fast/clj-memory-meter #:mvn{:version "0.3.0"},
org.apache.logging.log4j/log4j-api #:mvn{:version "2.20.0"},
org.apache.logging.log4j/log4j-core #:mvn{:version "2.20.0"},
com.taoensso/tempura #:mvn{:version "1.5.3"},
nrepl/nrepl #:mvn{:version "1.0.0"},
cider/cider-nrepl #:mvn{:version "0.30.0"}
refactor-nrepl/refactor-nrepl #:mvn{:version "3.6.0"},
org.clojure/clojure #:mvn{:version "1.11.1"},
org.clojure/tools.logging #:mvn{:version "1.2.4"}
zprint/zprint {:mvn/version "1.2.7"}
org.clojure/tools.cli #:mvn{:version "1.0.219"}}

:aliases {:cljs-paths {:extra-paths []}
:repl {:extra-paths ["env/dev/src/clj" "env/dev/src/cljc" "env/dev/resources"
"test/clj" "test/cljc" "test/resources"]
:main-opts ["-m" "automaton-core.repl-core"],
:jvm-opts ["-Dlog4j2.configurationFile=log4j2.xml"
"-Dclojure.tools.logging.factory=clojure.tools.logging.impl/log4j2-factory"
"-Dclojure.spec.compile-asserts=true"],
:extra-deps {refactor-nrepl/refactor-nrepl #:mvn{:version "3.6.0"},
org.clojure/core.async {:mvn/version "1.6.681"}
djblue/portal {:mvn/version "0.46.0"}}}
:runner {:exec-fn cognitect.test-runner.api/test,
:extra-deps {org.clojure/tools.namespace #:mvn {:version "1.4.4"}
com.cognitect/test-runner {:git/url "https://github.com/cognitect-labs/test-runner",
:sha "7284cda41fb9edc0f3bc6b6185cfb7138fc8a023"},
org.clojure/tools.reader #:mvn{:version "1.3.6"}},
:extra-paths ["env/dev/src/clj" "env/dev/src/cljc" "env/dev/resources"
"env/test/resources"
"test/clj" "test/cljc" "test/resources"]
:jvm-opts ["-Dclojure.tools.logging.factory=clojure.tools.logging.impl/log4j2-factory"
"-Dlog4j.configurationFile=log4j2-silent.xml"],
:main-opts ["-m" "cognitect.test-runner" "-r"
".*[-\\.](expectations|test)(\\..*)?$"]}}}
{:aliases {:bb-deps {:extra-deps {org.clojars.hephaistox/automaton-build-app {:mvn/version "0.0.9"}}}
:build {:extra-deps {org.clojars.hephaistox/automaton-build-app {:mvn/version "0.0.9"}}}
:cljs-deps {:extra-deps {binaryage/devtools {:mvn/version "1.0.7"}
cider/cider-nrepl {:mvn/version "0.30.0"}
thheller/shadow-cljs {:mvn/version "2.26.2"}}
:extra-paths ["src/cljs/" "src/cljc/" "resources/" "test/cljs/" "test/cljc/"]}
:common-test {:exec-fn cognitect.test-runner.api/test
:extra-deps {com.cognitect/test-runner {:git/url "https://github.com/cognitect-labs/test-runner"
:sha "7284cda41fb9edc0f3bc6b6185cfb7138fc8a023"}
org.clojure/tools.namespace {:mvn/version "1.4.4"}
org.clojure/tools.reader {:mvn/version "1.3.7"}}
:extra-paths ["test/clj/" "test/cljc/" "test/resources/"]
:jvm-opts ["-Dheph-conf=env/test/config.edn,env/common_config.edn"]}
:env-development-repl {:extra-deps {cider/cider-nrepl {:mvn/version "0.30.0"}
org.clojure/core.async {:mvn/version "1.6.681"}}
:extra-paths ["env/development/resources/" "env/development/src/clj/" "env/development/src/cljc/"]
:jvm-opts ["-Dheph-conf=env/development/config.edn,env/common_config.edn"]
:main-opts ["-m" "automaton-core.repl.entry-point"]}
:env-development-test
{:jvm-opts ["-Dclojure.tools.logging.factory=clojure.tools.logging.impl/log4j2-factory" "-Dhephaistox-in-test=true"
"-Dlog4j.configurationFile=resources/log_config/appenders.properties,resources/log_config/logging-tests.properties"]
:main-opts ["-m" "cognitect.test-runner" "-r" ".*-test.*" "-d" "test/clj" "-d" "test/cljc"]}}
:deps {babashka/fs {:mvn/version "0.5.20"}
babashka/process {:mvn/version "0.5.21"}
com.clojure-goes-fast/clj-memory-meter {:mvn/version "0.3.0"}
com.datomic/peer {:mvn/version "1.0.7075"}
com.taoensso/encore {:mvn/version "3.62.1"}
org.clojure/data.json {:mvn/version "2.5.0"}
com.taoensso/tempura {:mvn/version "1.5.3"}
danlentz/clj-uuid {:mvn/version "0.1.9"}
djblue/portal {:mvn/version "0.51.0"} ;; developer tooling
http-kit/http-kit {:mvn/version "2.7.0"}
io.sentry/sentry {:mvn/version "7.1.0"}
io.sentry/sentry-clj {:mvn/version "6.33.209"}
lambdaisland/uri {:mvn/version "1.16.134"}
metosin/malli {:mvn/version "0.13.0"}
mount/mount {:mvn/version "0.1.17"}
nrepl/nrepl {:mvn/version "1.1.0"}
org.apache.logging.log4j/log4j-api {:mvn/version "2.22.1"}
org.apache.logging.log4j/log4j-core {:mvn/version "2.22.1"}
org.apache.logging.log4j/log4j-slf4j2-impl {:mvn/version "2.22.1"}
org.clojure/clojure {:mvn/version "1.11.1"}
org.clojure/tools.cli {:mvn/version "1.0.219"}
org.clojure/tools.logging {:mvn/version "1.2.4"}
org.postgresql/postgresql {:mvn/version "42.7.1"}
refactor-nrepl/refactor-nrepl {:mvn/version "3.6.0"}
zprint/zprint {:mvn/version "1.2.8"}}
:paths ["src/clj/" "src/cljc/" "resources/"]}
3 changes: 3 additions & 0 deletions docs/code/deps-ns.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/code/deps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions docs/code/stats.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# That statistics counts number of line of code
* clj-test-nb-lines - 992
* clj-total-nb-lines - 3406
* ratio-in-pct - 41.09
4 changes: 4 additions & 0 deletions env/common_config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
;; This configuration file contains all configuration common to all environments.
{:app-name "automaton-core"
:log {:spitted-edns "tmp/logs/spitted"}
:tests {:tmp-dirs "tmp/tests"}}
14 changes: 0 additions & 14 deletions env/dev/resources/config.edn

This file was deleted.

24 changes: 0 additions & 24 deletions env/dev/src/clj/automaton_core/core.clj

This file was deleted.

42 changes: 0 additions & 42 deletions env/dev/src/clj/automaton_core/endpoint/web/dev_handlers.clj

This file was deleted.

23 changes: 0 additions & 23 deletions env/dev/src/clj/automaton_core/env_setup.clj

This file was deleted.

24 changes: 0 additions & 24 deletions env/dev/src/clj/automaton_core/repl_core.clj

This file was deleted.

3 changes: 3 additions & 0 deletions env/development/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{:dev {:clj-nrepl-port 8012
:portal-port 8351}
:env :development}
5 changes: 5 additions & 0 deletions env/development/development_environment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Description
This environment is everything specific for the local development. It contains:
* All unit tests for instance,
* The repl for `automaton-core`
* The name for that environment is `development` or `:development`
Empty file added env/development/resources/.keep
Empty file.
5 changes: 5 additions & 0 deletions env/development/resources/version.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
;; Last generated version, note a failed push consume a number Sat Oct 28
;; 18:55:52 CEST 2023
{:major-version "0.0.-1"
:minor-version 6
:version "0.0.6"}
Empty file.
Empty file.
1 change: 1 addition & 0 deletions env/test/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{:env :test}
Loading

0 comments on commit cc32c56

Please sign in to comment.