Skip to content

Commit

Permalink
Merge pull request #45 from hoplon/setup-ci
Browse files Browse the repository at this point in the history
Setup CI
  • Loading branch information
mynomoto authored Oct 30, 2023
2 parents da1049a + bd9056f commit 00f8b95
Show file tree
Hide file tree
Showing 22 changed files with 1,936 additions and 231 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release Version

on:
push:
tags:
- "release-v*"

jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Clojure
uses: DeLaGuardo/setup-clojure@master
with:
cli: '1.11.1.1208'
- name: Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- name: Cache All The Things
uses: actions/cache@v3
with:
path: |
~/.m2/repository
~/.npm
~/.gitlibs
~/.clojure
~/.cpcache
key: cljdeps-${{ hashFiles('deps.edn', 'package.json') }}
- name: Install node dependencies
run: npm install
- name: Install karma cli globally
run: npm install -g karma-cli
- name: Run Tests
run: clojure -T:build ci :snapshot false
- name: Deploy Release
run: clojure -T:build deploy :snapshot false
env:
CLOJARS_PASSWORD: ${{secrets.DEPLOY_TOKEN}}
CLOJARS_USERNAME: ${{secrets.DEPLOY_USERNAME}}
46 changes: 46 additions & 0 deletions .github/workflows/test-and-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Develop & Snapshot

on:
push:
branches:
- "master"

jobs:
build-and-snapshot:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Clojure
uses: DeLaGuardo/setup-clojure@master
with:
cli: '1.11.1.1208'
- name: Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- name: Cache All The Things
uses: actions/cache@v3
with:
path: |
~/.m2/repository
~/.npm
~/.gitlibs
~/.clojure
~/.cpcache
key: cljdeps-${{ hashFiles('deps.edn', 'package.json') }}
- name: Install node dependencies
run: npm install
- name: Install karma cli globally
run: npm install -g karma-cli
- name: Run Tests
run: clojure -T:build ci :snapshot true
- name: Deploy Snapshot
run: clojure -T:build deploy :snapshot true
env:
CLOJARS_PASSWORD: ${{secrets.DEPLOY_TOKEN}}
CLOJARS_USERNAME: ${{secrets.DEPLOY_USERNAME}}
38 changes: 38 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Pull Request

on: [pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Clojure CLI
uses: DeLaGuardo/setup-clojure@master
with:
cli: '1.11.1.1208'
- name: Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- name: Cache All The Things
uses: actions/cache@v3
with:
path: |
~/.m2/repository
~/.npm
~/.gitlibs
~/.clojure
~/.cpcache
key: cljdeps-${{ hashFiles('deps.edn', 'package.json') }}
- name: Install node dependencies
run: npm install
- name: Install karma cli globally
run: npm install -g karma-cli
- name: Run Tests
run: clojure -T:build test
27 changes: 7 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,10 @@
*.class
*.jar
.clj-kondo/**/
.cpcache/
.nrepl-*
/target
/lib
/classes
/checkouts
cljs-test-runner-out/
node_modules/
pom.xml
pom.xml.asc
*.swn
*.swo
*.swp
*.jar
*.class
.lein-deps-sum
.lein-failures
.lein-plugins
.lein-repl-history
.DS_Store
.nrepl-port
/test/test.js
/test/firefox-profile
.nrepl-*
.idea/
*.iml
project.clj
5 changes: 0 additions & 5 deletions .travis.yml

This file was deleted.

6 changes: 0 additions & 6 deletions FAQ.md

This file was deleted.

29 changes: 16 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ alt="tailrecursion/javelin logo" title="tailrecursion/javelin logo"
align="right" width="152"/>

# Javelin
[![clojars][10]][3] [![snapshot status][11]][3]
[![clojars](https://img.shields.io/clojars/v/hoplon/javelin.svg)](https://clojars.org/hoplon/javelin)
[![snapshot status](https://img.shields.io/clojars/vpre/hoplon/javelin.svg)](https://clojars.org/hoplon/javelin)
[![cljdoc badge](https://cljdoc.org/badge/hoplon/javelin)](https://cljdoc.org/d/hoplon/javelin)

Spreadsheet-like dataflow programming in ClojureScript.

Expand Down Expand Up @@ -346,18 +348,25 @@ API functions and macros:
;; the setter-cell.
```

## Building and Running Tests
### Testing

To build Javelin with advanced optimizations and run tests in PhantomJS:
This setup will run tests using clojure, node and chrome-webdriver.

#### Setup
```
boot test-javelin --advanced
npm install
npm install -g karma-cli
```
#### Run
```
clojure -T:build test
```

For development you may want to forgo optimizations and test continuously:

#### You may run only one type of test
```
boot watch speak test-javelin
clojure -T:build node-test
clojure -T:build chrome-test
clojure -T:build clojure-test
```

## License
Expand All @@ -371,15 +380,9 @@ boot watch speak test-javelin
agreeing to be bound by the terms of this license. You must not
remove this notice, or any other, from this software.

[1]: https://travis-ci.org/hoplon/javelin.png?branch=master
[2]: https://travis-ci.org/hoplon/javelin
[3]: http://clojars.org/hoplon/javelin
[4]: https://github.com/tailrecursion/javelin-demos
[5]: https://dl.dropboxusercontent.com/u/12379861/javelin_demos/index.html
[7]: https://github.com/lynaghk/todoFRP/tree/master/todo/javelin
[8]: https://github.com/hoplon/demos/tree/master/todoFRP
[9]: https://github.com/hoplon/javelin#formulas
[12]: https://github.com/hoplon/javelin/blob/master/test/javelin/core_test.cljs
[14]: https://www.thoughtworks.com/talks/journey-through-the-looking-glass-and-what-i-found-there
[10]: https://img.shields.io/clojars/v/hoplon/javelin.svg
[11]: https://img.shields.io/clojars/v/hoplon/javelin.svg?include_prereleases
55 changes: 0 additions & 55 deletions build.boot

This file was deleted.

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

(def lib 'hoplon/javelin)
(def version "3.9.1")
(def snapshot (format "%s-SNAPSHOT" version))
#_ ; alternatively, use MAJOR.MINOR.COMMITS:
(def version (format "1.0.%s" (b/git-count-revs nil)))
(def class-dir "target/classes")

(defn- run-task [aliases]
(println "\nRunning task for" (str/join "," (map name aliases)))
(let [basis (b/create-basis {:aliases aliases})
combined (t/combine-aliases basis aliases)
cmds (b/java-command
{:basis basis
:main 'clojure.main
:main-args (:main-opts combined)})
{:keys [exit]} (b/process cmds)]
(when-not (zero? exit) (throw (ex-info "Task failed" {})))))

(defn node-test
"Run cljs tests using node"
[opts]
(run-task [:cljs-node])
opts)

(defn chrome-test
"Run cljs tests using chrome"
[opts]
(run-task [:cljs-chrome])
opts)

(defn clojure-test
"Run cljs tests using chrome"
[opts]
(run-task [:test :runner])
opts)

(defn test
"Run all the tests."
[opts]
(clojure-test opts)
(node-test opts)
(chrome-test opts)
opts)

(defn- jar-opts [opts]
(let [version (if (:snapshot opts) snapshot version)]
(println "\nVersion:" version)
(assoc opts
:lib lib :version version
:jar-file (format "target/%s-%s.jar" lib version)
:scm {:tag (str "v" version)
:url "git@github.com:hoplon/javelin.git"}
:basis (b/create-basis {})
:class-dir class-dir
:target "target"
:src-dirs ["src" "clj-kondo"])))

(defn ci "Run the CI pipeline of tests (and build the JAR)." [opts]
(test opts)
(b/delete {:path "target"})
(let [opts (jar-opts opts)]
(println "\nWriting pom.xml...")
(b/write-pom opts)
(println "\nCopying source...")
(b/copy-dir {:src-dirs ["src" "clj-kondo"] :target-dir class-dir})
(println "\nBuilding JAR...")
(b/jar opts))
opts)

(defn install "Install the JAR locally." [opts]
(let [opts (jar-opts opts)]
(b/install opts))
opts)

(defn deploy "Deploy the JAR to Clojars." [opts]
(let [{:keys [jar-file] :as opts} (jar-opts opts)]
(dd/deploy {:installer :remote :artifact (b/resolve-path jar-file)
:pom-file (b/pom-path (select-keys opts [:lib :class-dir]))}))
opts)
6 changes: 6 additions & 0 deletions clj-kondo/clj-kondo.exports/hoplon/javelin/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{:lint-as {javelin.core/cell-let clojure.core/let
javelin.core/cell-doseq clojure.core/doseq
javelin.core/defc clojure.core/def
javelin.core/defc= clojure.core/def
javelin.core/formulet clojure.core/let
javelin.core/with-let clojure.core/let}}
Loading

0 comments on commit 00f8b95

Please sign in to comment.