Skip to content

Commit c984a34

Browse files
committed
Setting up build
1 parent f285dc5 commit c984a34

File tree

4 files changed

+86
-10
lines changed

4 files changed

+86
-10
lines changed

.circleci/config.yml

+54-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,23 @@
22
#
33
# Check https://circleci.com/docs/2.0/language-clojure/ for more details
44
#
5-
version: 2
5+
version: 2.1
6+
7+
workflows:
8+
build-deploy:
9+
jobs:
10+
- build
11+
12+
- deploy:
13+
requires:
14+
- build
15+
context:
16+
- CLOJARS_DEPLOY
617
jobs:
718
build:
819
docker:
920
# specify the version you desire here
10-
- image: circleci/clojure:lein-2.9.1
21+
- image: circleci/clojure:openjdk-8-lein-2.9.1
1122

1223
# Specify service dependencies here if necessary
1324
# CircleCI maintains a library of pre-built images
@@ -31,12 +42,51 @@ jobs:
3142
# fallback to using the latest cache if no exact match is found
3243
- v1-dependencies-
3344

34-
- run: lein deps
45+
- run: lein with-profile ci deps
3546

3647
- save_cache:
3748
paths:
3849
- ~/.m2
3950
key: v1-dependencies-{{ checksum "project.clj" }}
4051

4152
# run tests!
42-
- run: lein do clean, test
53+
- run: lein with-profile ci do clean, test
54+
55+
deploy:
56+
docker:
57+
# specify the version you desire here
58+
- image: circleci/clojure:openjdk-8-lein-2.9.1
59+
# Specify service dependencies here if necessary
60+
# CircleCI maintains a library of pre-built images
61+
# documented at https://circleci.com/docs/2.0/circleci-images/
62+
# - image: circleci/postgres:9.4
63+
64+
working_directory: ~/repo
65+
66+
environment:
67+
LEIN_ROOT: "true"
68+
# Customize the JVM maximum heap limit
69+
JVM_OPTS: -Xmx3200m
70+
71+
steps:
72+
- checkout
73+
74+
# Download and cache dependencies
75+
- restore_cache:
76+
keys:
77+
- v1-dependencies-{{ checksum "project.clj" }}
78+
# fallback to using the latest cache if no exact match is found
79+
- v1-dependencies-
80+
81+
- run:
82+
name: Install babashka
83+
command: bash <(curl -s https://raw.githubusercontent.com/borkdude/babashka/master/install) --dir . --download-dir .
84+
- run: lein with-profile ci deps
85+
86+
- save_cache:
87+
paths:
88+
- ~/.m2
89+
key: v1-dependencies-{{ checksum "project.clj" }}
90+
- run:
91+
name: Deploy
92+
command: .circleci/maybe-deploy.bb lein with-profile ci deploy clojars

.circleci/maybe-deploy.bb

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env ./bb
2+
3+
(require '[clojure.java.shell :refer [sh]])
4+
(require '[clojure.edn :as edn])
5+
(require '[clojure.string :as str])
6+
7+
(defn make-version! []
8+
(let [v (edn/read-string (slurp "version.edn"))
9+
commit-count (str/trim-newline (:out (sh "git" "rev-list" "--count" "--first-parent" "HEAD")))]
10+
(str v "." commit-count)))
11+
12+
(if (->> (System/getenv "CIRCLE_SHA1")
13+
(sh "git" "show" "-s")
14+
:out
15+
(re-find #"\[ci deploy\]"))
16+
(do
17+
(println "executing " (first *command-line-args*))
18+
(apply sh (into (vec *command-line-args*) [:env (into {"PROJECT_VERSION" (make-version!)}
19+
(System/getenv))])))
20+
(println "skipping" (first *command-line-args*)))

project.clj

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
1-
(defproject byte-streams "0.2.5-alpha2"
1+
(defproject clj-commons/byte-streams (or (System/getenv "version") "0.2.5-alpha")
22
:description "A simple way to handle the menagerie of Java byte represenations."
33
:license {:name "MIT License"
44
:url "http://opensource.org/licenses/MIT"}
5+
6+
:deploy-repositories [["clojars" {:url "https://repo.clojars.org"
7+
:username :env/clojars_username
8+
:password :env/clojars_password
9+
:sign-releases false}]]
510
:dependencies [[primitive-math "0.1.6"]
611
[clj-tuple "0.2.2"]
712
[manifold "0.1.8"]]
8-
:profiles {:dev {:dependencies [[org.clojure/clojure "1.8.0"]
9-
[org.clojure/test.check "0.9.0"]
13+
:profiles {:dev {:dependencies [[org.clojure/clojure "1.10.1"]
14+
[org.clojure/test.check "1.1.0"]
1015
[rhizome "0.2.9"]
11-
[codox-md "0.2.0" :exclusions [org.clojure/clojure]]]}}
16+
[codox-md "0.2.0" :exclusions [org.clojure/clojure]]]}
17+
:ci {:javac-options ["-target" "1.8" "-source" "1.8"]}}
1218
:test-selectors {:stress :stress
1319
:default (complement :stress)}
1420
:plugins [[lein-codox "0.10.3"]
1521
[lein-jammin "0.1.1"]
1622
[ztellman/lein-cljfmt "0.1.10"]]
1723
:cljfmt {:indents {#".*" [[:inner 0]]}}
18-
:codox {:source-uri "https://github.com/ztellman/byte-streams/blob/master/{filepath}#L{line}"
24+
:codox {:source-uri "https://github.com/clj-commons/byte-streams/blob/master/{filepath}#L{line}"
1925
:metadata {:doc/format :markdown}
2026
:namespaces [byte-streams]}
2127
:global-vars {*warn-on-reflection* true}
2228
:java-source-paths ["src"]
23-
:javac-options ["-target" "1.6" "-source" "1.6"]
2429
:jvm-opts ^:replace ["-server" "-Xmx4g"])

version.edn

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"0.2"

0 commit comments

Comments
 (0)