Skip to content

Commit

Permalink
github ci
Browse files Browse the repository at this point in the history
  • Loading branch information
awb99 committed Jul 15, 2024
1 parent dd206be commit 45dd719
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 3 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Prepare java
uses: actions/setup-java@v2
with:
distribution: 'zulu' # https://github.com/actions/setup-java/blob/main/README.md#Supported-distributions
java-version: '14'
java-package: jdk # optional (jdk or jre) - defaults to jdk
- name: Install clojure tools
uses: DeLaGuardo/[email protected]
with:
cli: 1.10.3.929 # Clojure CLI based on tools.deps
- name: Release
if: success()
# if: github.event_name == 'push'
env:
CLOJARS_USERNAME: ${{ secrets.ReleaseUsername }}
CLOJARS_PASSWORD: ${{ secrets.ReleasePassword }}
CODECOV_TOKEN: ${{ secrets.CodecovToken }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "CI/CD"
clojure -T:build jar
clojure -T:build deploy
58 changes: 57 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,57 @@
# re-flow
# re-flow [![GitHub Actions status |pink-gorilla/clj-service](https://github.com/pink-gorilla/re-flow/workflows/CI/badge.svg)](https://github.com/pink-gorilla/re-flow/actions?workflow=CI)[![Clojars Project](https://img.shields.io/clojars/v/org.pinkgorilla/re-flow.svg)](https://clojars.org/org.pinkgorilla/re-flow)

- re-flow allows to consume missionary flows in clojurescript.
- flows can be consumed:
- either from a sci-clojurescipt code via re-flow.core/re-flow
- or from a reagent/react view via re-flow.core/flow-ui
- the idea is that clj-services are "exposed" for consumption for the
browser via clj-service library. Any clojure function that is exposed
this way (this be permissioned managed via permission library) must
return a flow, and this flow can be consumed.
- the idea is to extend request-reply style communication between clojure
and the browser (clojurescipt) with publish/subscribe model and use
missionarys design to clean up resources when they are no longer needed.
- the benefits to this approach are:
- keep using reagent/react
- all pure render-functions from react/reagent can be used to render
updates that come in via a re(directed)-flow.
- render functions can be defined via interpreted sci-clojurescript
code, and therefore can be extended at runtime by arbitrary code that
should defined the view.

stage: exploratory/experimental

# syntax

```
(require '[re-flow.core :refer [re-flow flow-ui]])
(re-flow 'demo.service/a-seed)
; this returns a missionary flow that has the same data as the
; flow of demo.service/a-seed would produce
[flow-ui {:clj 'demo.service/quotes
:args []
:render 'demo.ui/quotes-ui}]]
; this returns a reagent render function that on each update of the
; flow renders html that is produced by evaluating demo.ui/quotes-ui.
```

# demo

```
cd demo
clj -X:webly:npm-install
clj -X:webly:compile
clj -X:webly:run
```








49 changes: 49 additions & 0 deletions build.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
(ns build
(:require
[clojure.tools.build.api :as b]
[deps-deploy.deps-deploy :as dd]))

(def lib 'org.pinkgorilla/re-flow)
(def version (format "0.1.%s" (b/git-count-revs nil)))
(def class-dir "target/classes")
(def basis (b/create-basis {:project "deps.edn"}))
(def jar-file (format "target/%s-%s.jar" (name lib) version))

(defn clean [_]
(b/delete {:path "target"}))

(def pom-template
[[:licenses
[:license
[:name "Eclipse Public License"]
[:url "https://www.eclipse.org/legal/epl-v10.html"]]]
[:developers
[:developer
[:name "pink-gorilla"]]]
[:scm
[:url "https://github.com/pink-gorilla/re-flow/"]
[:connection "scm:git:git://github.com/pink-gorilla/re-flow.git"]
[:developerConnection "scm:git:ssh://[email protected]/pink-gorilla/re-flowgit"]]])

(def opts {:class-dir class-dir
:lib lib
:version version
:basis basis
:pom-data pom-template
:src-dirs ["src"]})

(defn jar [_]
(b/write-pom opts)
(b/copy-dir {:src-dirs ["src"
"resources"]
:target-dir class-dir})
(b/jar {:class-dir class-dir
:jar-file jar-file}))

(defn deploy "Deploy the JAR to Clojars." [_]
(println "Deploying to Clojars..")
(dd/deploy {:installer :remote
;:sign-releases? true
:pom-file (b/pom-path (select-keys opts [:lib :class-dir]))
;:artifact "target/tech.ml.dataset.jar"
:artifact (b/resolve-path jar-file)}))
10 changes: 8 additions & 2 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@
}

:aliases
{:test {:extra-paths ["test"]
{; github ci
:build {:deps {io.github.clojure/tools.build {:mvn/version "0.9.6"}
slipset/deps-deploy {:mvn/version "0.2.1"}
babashka/fs {:mvn/version "0.0.5"}}
:ns-default build}
:test {:extra-paths ["test"]
:extra-deps {io.github.cognitect-labs/test-runner {:git/url "https://github.com/cognitect-labs/test-runner.git"
:sha "9e35c979860c75555adaff7600070c60004a0f44"}}
:main-opts ["-m" "cognitect.test-runner"]
:exec-fn cognitect.test-runner.api/test}}}
:exec-fn cognitect.test-runner.api/test}
}}

0 comments on commit 45dd719

Please sign in to comment.