Skip to content

Commit

Permalink
Merge pull request #7 from circleci/circle-config
Browse files Browse the repository at this point in the history
Added CircleCI config
  • Loading branch information
smaant committed Nov 1, 2019
2 parents 1679632 + 66883d1 commit 54329d4
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 7 deletions.
48 changes: 48 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
version: 2.1

workflows:
test-and-deploy:
jobs:
- test:
context: org-global

- deploy:
context: org-global
requires:
- test
filters:
branches:
only:
- master

jobs:
test:
docker:
- image: clojure:lein-2.8.1

steps:
- checkout
- restore_cache:
keys:
- v1-jars-{{ checksum "project.clj" }}
- v1-jars-
- run:
name: Run the tests
command: lein test2junit
- save_cache:
key: v1-jars-{{ checksum "project.clj" }}
paths:
- ~/.m2
- store_test_results:
path: ./test2junit/xml

deploy:
docker:
- image: clojure:lein-2.8.1
steps:
- checkout
- restore_cache:
keys:
- v1-jars-{{ checksum "project.clj" }}
- v1-jars-
- run: lein deploy
20 changes: 18 additions & 2 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
(defproject tentacles "0.4.0"
(def project-version (if-let [build-num (System/getenv "CIRCLE_BUILD_NUM")]
(str "0.2." build-num)
"0.2.0-SNAPSHOT"))

(defproject circleci/tentacles project-version
:description "A library for working with the Github API."
:url "https://github.com/Raynes/tentacles"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}

:dependencies [[org.clojure/clojure "1.5.1"]
[clj-http "1.0.1"]
[cheshire "5.4.0"]
[com.cemerick/url "0.1.1"]
[org.clojure/data.codec "0.1.0"]
[environ "1.0.0"]])
[environ "1.0.0"]]

:profiles {:dev {:plugins [[test2junit "1.4.2"]]}}

:repositories [["releases" {:url "https://clojars.org/repo"
:username :env/clojars_username
:password :env/clojars_password
:sign-releases false}]
["snapshots" {:url "https://clojars.org/repo"
:username :env/clojars_username
:password :env/clojars_password
:sign-releases false}]])
2 changes: 1 addition & 1 deletion src/tentacles/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
(when if-modified-since
{:headers {"if-Modified-Since" if-modified-since}}))
raw-query (:raw query)
proper-query (query-map (dissoc (merge defaults query) :auth :oauth-token :all-pages :accept :user-agent :otp :throw-exceptions))
proper-query (query-map (dissoc (merge defaults query) :auth :oauth-token :all-pages :accept :user-agent :otp :throw-exceptions :follow-redirects))
req (if (#{:post :put :delete} method)
(assoc req :body (json/generate-string (or raw-query proper-query)))
(assoc req :query-params proper-query))]
Expand Down
11 changes: 7 additions & 4 deletions test/tentacles/core_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

(deftest request-contains-user-agent
(let [request (core/make-request :get "test" nil {:user-agent "Mozilla"})]
(do (is (empty? (:query-params request)))
(do (is (empty? (:query-params request)))
(is (contains? (:headers request) "User-Agent"))
(is (= (get (:headers request) "User-Agent") "Mozilla")))))

Expand All @@ -14,11 +14,14 @@

(deftest rate-limit-details-are-propagated
(is (= 60 (:call-limit (core/api-meta
(core/safe-parse {:status 200 :headers {"x-ratelimit-limit" "60"
"content-type" ""}}))))))
(core/safe-parse {:status 200
:headers {"x-ratelimit-limit" "60"
"content-type" ""}
:body "{\"x\":1}"}))))))

(deftest poll-limit-details-are-propagated
(is (= 61 (:poll-interval (core/api-meta
(core/safe-parse {:status 200
:headers {"x-poll-interval" "61"
"content-type" ""}}))))))
"content-type" ""}
:body "{\"x\":1}"}))))))

0 comments on commit 54329d4

Please sign in to comment.