Skip to content

Commit

Permalink
testing via github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
henryw374 committed Nov 23, 2023
1 parent f38dbef commit 8ebba4e
Show file tree
Hide file tree
Showing 24 changed files with 251 additions and 1,059 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# https://practical.li/clojure/continuous-integration/github-actions/
name: Tests build
on: [push]
jobs:
clojure:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Prepare java
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17'

- name: Install clojure tools
uses: DeLaGuardo/[email protected]
with:
cli: 1.10.1.693 # Clojure CLI based on tools.deps

#- name: Run Clj Unit tests
# run: make test-clj

- name: Install Chrome
uses: browser-actions/setup-chrome@latest

- name: Generate library code
run: make generate-all

- name: Run cljs tests
run: make test-cljs

- name: Run clj tests
run: make test-clj
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package.json
web-target/public
pom.xml
pom.xml.asc
.cpcache
*.jar
*.class
/lib/
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
generate-all:
clj -Adev -X com.widdindustries.gen.gen.tempo/generate-all
test-cljs:
clojure -Adev -X com.widdindustries.tiado-cljs2/tests-ci-shadow :compile-mode :release
test-clj:
clojure -Adev -X dev/run-clj-tests
.PHONY: list
list:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs
28 changes: 15 additions & 13 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
; this is not the deps for a lib user to depend on. find those under 'gen-out'
{:paths ["dev" "web-target" "gen-out/no-deps/src"]
:deps {;ring/ring-core {:mvn/version "1.8.1"}
backtick/backtick {:mvn/version "0.3.4"}
camel-snake-kebab/camel-snake-kebab {:mvn/version "0.4.2"}
medley/medley {:mvn/version "1.4.0"}
cljc-deps {:local/root "./gen-out/cljc.java-time-dep"}
com.widdindustries/tiado-cljs2 {:git/url "https://github.com/henryw374/tiado-cljs2.git" :git/sha "8aa3042d834d2695ec9d4f9f65532573c849d6bf" }

}
:aliases {:release {:extra-deps {applied-science/deps-library {:mvn/version "RELEASE"}}
:main-opts ["-m" "applied-science.deps-library"]}
:output-no-deps {:extra-paths ["test" "src/temporal"]
:extra-deps {tempo-no-deps {:local/root "gen-out/no-deps"}}}}}
{:paths ["src"]
:aliases {:dev {:extra-paths ["dev" "web-target" "test"]
:extra-deps {;ring/ring-core {:mvn/version "1.8.1"}
backtick/backtick {:mvn/version "0.3.4"}
camel-snake-kebab/camel-snake-kebab {:mvn/version "0.4.2"}
medley/medley {:mvn/version "1.4.0"}
com.widdindustries/tiado-cljs2 {:git/url "https://github.com/henryw374/tiado-cljs2.git" :git/sha "8aa3042d834d2695ec9d4f9f65532573c849d6bf"}
com.widdindustries/cljc.java-time {:mvn/version "0.1.21"}
;com.widdindustries/time-literals {:mvn/version "0.1.10" :exclusions [com.widdindustries/cljs.java-time]}
org.clojure/tools.namespace {:mvn/version "1.4.4"}
}
}}
:release {:extra-deps {applied-science/deps-library {:mvn/version "RELEASE"}}
:main-opts ["-m" "applied-science.deps-library"]}
}
18 changes: 7 additions & 11 deletions dev/com/widdindustries/gen/cljs_protocols.clj
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,15 @@
entities))
))

(comment

(gen/gen (str "./gen-out/no-deps/src/" (->
(name 'com.widdindustries.tempo.cljs-protocols)
(string/replace "." "/")
(string/replace "-" "_")
)
(defn gen-protocols []
(gen/gen (str "src/" (->
(name 'com.widdindustries.tempo.cljs-protocols)
(string/replace "." "/")
(string/replace "-" "_")
)
".cljs")
(concat [(ns-decl)]
(non-temporals)
(for [tt graph/temporal-types]
(temporal-fn-gen (str tt)))
[(extend-all (concat graph/temporal-types ['timezone 'duration]))]))


)
[(extend-all (concat graph/temporal-types ['timezone 'duration]))])))
2 changes: 1 addition & 1 deletion dev/com/widdindustries/gen/gen/constructors.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
(:require [com.widdindustries.gen.gen :as gen]))

(defn constructor-fns [feature]
(rest (gen/read-cond-forms "dev/com/widdindustries/gen/gen_in/constructors.cljc"
(rest (gen/read-cond-forms "gen_in/constructors.cljc"
feature)))

(comment
Expand Down
26 changes: 11 additions & 15 deletions dev/com/widdindustries/gen/gen/tempo.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
(:require [com.widdindustries.gen.gen.accessors :as accessors]
[com.widdindustries.gen.gen.constructors :as constructors]
[com.widdindustries.gen.gen :as gen]
[com.widdindustries.gen.cljs-protocols :as cljs-protocols]
[clojure.string :as string]
[clojure.java.io :as io]
[clojure.set :as set]))

(defn ns-decl [features]
(rest (gen/read-cond-forms "dev/com/widdindustries/gen/gen_in/tempo.cljc"
(rest (gen/read-cond-forms "gen_in/tempo.cljc"
features)))

(defn feature->ext [features]
Expand All @@ -21,19 +22,10 @@
;(feature->ext #{:cljcs :cljc})

(defn gen-tempo [target features main-feature]
(let [deps (str "./gen-out/" target "/deps.edn")]
(io/make-parents deps)
(spit deps
(merge
(when (contains? features :cljc)
{:deps {'com.widdindustries/cljc.java-time {:mvn/version "0.1.18"}}})
{:paths ["src"]})))
(gen/gen (str "./gen-out/" target "/src/"
(->
(name 'com.widdindustries.tempo)
(string/replace "." "/")
(string/replace "-" "_")
)

(gen/gen (str "src/com/widdindustries/tempo" (when (= "cljc.java-time-dep" target)
"/cljc-java-time-dep")

(feature->ext features))
(concat (ns-decl features)
['(comment "accessors")]
Expand All @@ -46,9 +38,13 @@
(constructors/constructor-fns features)
)))

(defn generate-all [_]
(gen-tempo "no-deps" #{:cljay} :cljay)
(gen-tempo "no-deps" #{:cljs} :cljs)
(cljs-protocols/gen-protocols))

(comment

(generate-all nil)
(accessors/accessor-forms :cljs)
(gen-tempo "no-deps" #{:cljay} :cljay)
(gen-tempo "no-deps" #{:cljs} :cljs)
Expand Down
22 changes: 20 additions & 2 deletions dev/cljs.clj → dev/dev.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
(ns cljs
(ns dev
(:require [clojure.java.io :as io]
[com.widdindustries.tiado-cljs2 :as util]))
[com.widdindustries.tiado-cljs2 :as util]
[kaocha.repl :as kaocha]
[clojure.tools.namespace.repl :as refresh]
[com.widdindustries.gen.gen.tempo :as gen]))

(defn refresh []
(refresh/refresh-all))

(defn x []
(kaocha/run 'com.widdindustries.tempo-test))

(defn run-clj-tests [_]
(refresh/refresh-all :after 'dev/x))

(comment
(refresh/clear)
(gen/generate-all nil)
(run-clj-tests nil)
)

(defn browser-test-build [compile-mode opts]
(.mkdirs (io/file "web-target" "public" "browser-test"))
Expand Down
16 changes: 8 additions & 8 deletions dev/noodle/doodle.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
(:require [com.widdindustries.tempo :as t]))

(def a-date (t/date-now))

;; move date forward 3 days
(def later (t/>> a-date (t/period-parse "P3D")))

(compare a-date a-date)
(compare a-date later)
(compare later a-date)
(.-compare (t/instant-parse "2021-04-06T14:56:39.023310Z"))
(comment
;; move date forward 3 days
;(def later (t/>> a-date (t/period-parse "P3D")))

(compare a-date a-date)
(compare a-date later)
(compare later a-date)
(.-compare (t/instant-parse "2021-04-06T14:56:39.023310Z")))

11 changes: 9 additions & 2 deletions dev/user.clj
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
(ns user
(:require [cljs]))
(ns user)

(defn dev []
(require 'dev)
(in-ns 'dev))

(comment
(dev)
)
1 change: 0 additions & 1 deletion gen-out/cljc.java-time-dep/deps.edn

This file was deleted.

Loading

0 comments on commit 8ebba4e

Please sign in to comment.