-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from hoplon/setup-ci
Setup CI
- Loading branch information
Showing
22 changed files
with
1,936 additions
and
231 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}} |
Oops, something went wrong.