Skip to content

Commit

Permalink
gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
erp12 committed Sep 14, 2021
1 parent 7a374bc commit 67ea247
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 23 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Clojure CI

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '8', '16' ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: ${{ matrix.java }}
cache: 'maven'
- name: Clojure CLI
uses: DeLaGuardo/setup-clojure@master
with:
cli: '1.10.3.967'
- name: Run Tests
run: clojure -T:build ci
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pom.xml.asc
.cpcache/
.lsp/
.eastwood
.clj-kondo/

# IntelliJ IDEA - User-specific stuff
.idea/
Expand Down
38 changes: 15 additions & 23 deletions build.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,34 @@

(def lib 'io.github.erp12/fijit)

(def lib-version (format "0.0.%s" (b/git-count-revs nil)))
(def version (format "1.0.%s" (b/git-count-revs nil)))

(defn tag
[scala-ver]
(format "%s-%s" (name scala-ver) lib-version))

(defn jar-file
[scala-ver]
(format "target/%s_%s.jar" (name lib) (tag scala-ver)))
(def jar-file (format "target/%s-%s.jar" (name lib) version))

(def scala-verions [:2.12 :2.13])

;; Utils ;;;;;;;;;;

(defn for-scala-versions
[opts f]
(doseq [scala-ver (if-let [v (:scala-version opts)]
[v]
scala-verions)]
(f (merge {:aliases [scala-ver]
:lib lib
:version lib-version
:jar-file (jar-file scala-ver)
:tag (tag scala-ver)}
opts))))
(doseq [scala-ver (if-let [v (:scala-version opts)]
[v]
scala-verions)]
(f (merge {:aliases [scala-ver]}
opts))))

;; Entry ;;;;;;;;;;

(defn tests
[opts]
(for-scala-versions opts bb/run-tests))

(defn jars
(defn jar
[opts]
(bb/clean opts)
(for-scala-versions opts bb/jar))
(-> opts
(assoc :lib lib :version version)
(bb/clean)
(bb/jar)))

(defn gen-docs
[_]
Expand All @@ -52,12 +44,12 @@
(System/exit exit))))

(defn ci
"Run the CI pipeline. This runs tests and builds JARs for each Scala version."
"Run the CI pipeline. This runs tests for each Scala version and build the jar."
[opts]
(tests opts)
(jars opts))
(jar opts))

(defn prepare-release
[opts]
(ci opts)
(gen-docs opts))
(gen-docs opts))

0 comments on commit 67ea247

Please sign in to comment.