Fix browser.cljs bug
Add automation for testing browser code.
This commit is contained in:
parent
8a97900cda
commit
5ef80e7710
5 changed files with 51 additions and 21 deletions
22
copy-and-build-dda-io.sh
Normal file
22
copy-and-build-dda-io.sh
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# set things
|
||||||
|
set -o nounset
|
||||||
|
set -o xtrace
|
||||||
|
set -o errexit
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
# dirs
|
||||||
|
srcDir="/home/$USER/"
|
||||||
|
srcName="main.js"
|
||||||
|
targetDir="/home/$USER/"
|
||||||
|
targetName="c4k-website.js"
|
||||||
|
|
||||||
|
echo "build"
|
||||||
|
shadow-cljs compile frontend
|
||||||
|
|
||||||
|
echo "move and rename file"
|
||||||
|
cp $srcDir$srcName $targetDir$targetName
|
||||||
|
|
||||||
|
echo "build"
|
||||||
|
(cd $targetDir; lein ring server)
|
|
@ -24,6 +24,19 @@
|
||||||
(def certificate? (s/keys :req-un [::fqdns ::cert-name]
|
(def certificate? (s/keys :req-un [::fqdns ::cert-name]
|
||||||
:opt-un [::issuer]))
|
:opt-un [::issuer]))
|
||||||
|
|
||||||
|
#?(:cljs
|
||||||
|
(defmethod yaml/load-resource :ingress [resource-name]
|
||||||
|
(case resource-name
|
||||||
|
"ingress/host-rule.yaml" (rc/inline "ingress/host-rule.yaml")
|
||||||
|
"ingress/certificate.yaml" (rc/inline "ingress/certificate.yaml")
|
||||||
|
"ingress/http-ingress.yaml" (rc/inline "ingress/http-ingress.yaml")
|
||||||
|
"ingress/https-ingress.yaml" (rc/inline "ingress/https-ingress.yaml")
|
||||||
|
(throw (js/Error. "Undefined Resource!")))))
|
||||||
|
|
||||||
|
#?(:cljs
|
||||||
|
(defmethod yaml/load-as-edn :ingress [resource-name]
|
||||||
|
(yaml/from-string (yaml/load-resource resource-name))))
|
||||||
|
|
||||||
(defn-spec generate-host-rule pred/map-or-seq?
|
(defn-spec generate-host-rule pred/map-or-seq?
|
||||||
[service-name ::service-name
|
[service-name ::service-name
|
||||||
service-port ::service-port
|
service-port ::service-port
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
(s/def ::unique-name string?)
|
(s/def ::unique-name string?)
|
||||||
(s/def ::issuer pred/letsencrypt-issuer?)
|
(s/def ::issuer pred/letsencrypt-issuer?)
|
||||||
(s/def ::authtoken pred/bash-env-string?)
|
(s/def ::authtoken pred/bash-env-string?)
|
||||||
(s/def ::fqdns fqdn-list?)
|
(s/def ::fqdns (s/coll-of pred/fqdn-string?))
|
||||||
(s/def ::gitea-host pred/fqdn-string?)
|
(s/def ::gitea-host pred/fqdn-string?)
|
||||||
(s/def ::gitea-repo string?)
|
(s/def ::gitea-repo string?)
|
||||||
(s/def ::branchname string?)
|
(s/def ::branchname string?)
|
||||||
|
@ -80,9 +80,6 @@
|
||||||
#?(:cljs
|
#?(:cljs
|
||||||
(defmethod yaml/load-resource :website [resource-name]
|
(defmethod yaml/load-resource :website [resource-name]
|
||||||
(case resource-name
|
(case resource-name
|
||||||
"ingress/certificate.yaml" (rc/inline "ingress/certificate.yaml")
|
|
||||||
"ingress/http-ingress.yaml" (rc/inline "ingress/http-ingress.yaml")
|
|
||||||
"ingress/https-ingress.yaml" (rc/inline "ingress/https-ingress.yaml")
|
|
||||||
"website/nginx-configmap.yaml" (rc/inline "website/nginx-configmap.yaml")
|
"website/nginx-configmap.yaml" (rc/inline "website/nginx-configmap.yaml")
|
||||||
"website/nginx-deployment.yaml" (rc/inline "website/nginx-deployment.yaml")
|
"website/nginx-deployment.yaml" (rc/inline "website/nginx-deployment.yaml")
|
||||||
"website/nginx-service.yaml" (rc/inline "website/nginx-service.yaml")
|
"website/nginx-service.yaml" (rc/inline "website/nginx-service.yaml")
|
||||||
|
|
|
@ -31,17 +31,18 @@
|
||||||
(cm/concat-vec
|
(cm/concat-vec
|
||||||
(br/generate-input-field "issuer" "(Optional) Your issuer prod/staging:" "")
|
(br/generate-input-field "issuer" "(Optional) Your issuer prod/staging:" "")
|
||||||
(br/generate-text-area
|
(br/generate-text-area
|
||||||
"websites" "A map containing fqdns and repo infos for each website:"
|
"websites" "A collection containing fqdns and repo infos for each website:"
|
||||||
"[{:unique-name \"test.io \",
|
"{:websites
|
||||||
:fqdns [\"test.de \" \"www.test.de \"],
|
[{:unique-name \"test.io\",
|
||||||
:gitea-host \"githost.de \",
|
:fqdns [\"test.de\" \"www.test.de\"],
|
||||||
:gitea-repo \"repo \",
|
:gitea-host \"githost.de\",
|
||||||
:branchname \"main \"}
|
:gitea-repo \"repo\",
|
||||||
|
:branchname \"main\"}
|
||||||
{:unique-name \"example.io \",
|
{:unique-name \"example.io \",
|
||||||
:fqdns [\"example.org \" \"www.example.org \"],
|
:fqdns [\"example.org\" \"www.example.org\"],
|
||||||
:gitea-host \"githost.org \",
|
:gitea-host \"githost.org\",
|
||||||
:gitea-repo \"repo \",
|
:gitea-repo \"repo\",
|
||||||
:branchname \"main \"}]"
|
:branchname \"main\"}]}"
|
||||||
"10")))
|
"10")))
|
||||||
(generate-group
|
(generate-group
|
||||||
"credentials"
|
"credentials"
|
||||||
|
@ -74,7 +75,7 @@
|
||||||
{:issuer issuer}))))
|
{:issuer issuer}))))
|
||||||
|
|
||||||
(defn validate-all! []
|
(defn validate-all! []
|
||||||
(br/validate! "websites" ::website/websites)
|
(br/validate! "websites" website/config? :deserializer edn/read-string)
|
||||||
(br/validate! "issuer" ::website/issuer :optional true)
|
(br/validate! "issuer" ::website/issuer :optional true)
|
||||||
(br/validate! "auth" website/auth? :deserializer edn/read-string)
|
(br/validate! "auth" website/auth? :deserializer edn/read-string)
|
||||||
(br/set-form-validated!))
|
(br/set-form-validated!))
|
||||||
|
|
|
@ -3,10 +3,7 @@
|
||||||
#?(:clj [clojure.test :refer [deftest is are testing run-tests]]
|
#?(:clj [clojure.test :refer [deftest is are testing run-tests]]
|
||||||
:cljs [cljs.test :refer-macros [deftest is are testing run-tests]])
|
:cljs [cljs.test :refer-macros [deftest is are testing run-tests]])
|
||||||
[clojure.spec.test.alpha :as st]
|
[clojure.spec.test.alpha :as st]
|
||||||
[dda.c4k-common.test-helper :as th]
|
[dda.c4k-website.ingress :as cut]))
|
||||||
[dda.c4k-common.base64 :as b64]
|
|
||||||
[dda.c4k-website.ingress :as cut]
|
|
||||||
[clojure.spec.alpha :as s]))
|
|
||||||
|
|
||||||
(st/instrument `cut/generate-host-rule)
|
(st/instrument `cut/generate-host-rule)
|
||||||
(st/instrument `cut/generate-http-ingress)
|
(st/instrument `cut/generate-http-ingress)
|
||||||
|
|
Loading…
Reference in a new issue