emit binary size to slack
This commit is contained in:
parent
97144a0851
commit
af8c786c31
2 changed files with 30 additions and 16 deletions
|
|
@ -1,23 +1,35 @@
|
||||||
(require '[clojure.java.shell :refer [sh]]
|
(require '[cheshire.core :refer [generate-string]]
|
||||||
'[clojure.java.io :as io]
|
'[clojure.java.io :as io]
|
||||||
'[cheshire.core :refer [generate-string]]
|
'[clojure.java.shell :refer [sh]]
|
||||||
'[clojure.string :as str])
|
'[clojure.string :as str])
|
||||||
|
|
||||||
(def channel "#babashka_circleci_builds")
|
(def channel "#babashka_circleci_builds")
|
||||||
#_(def channel "#_test")
|
#_(def channel "#_test")
|
||||||
(def babashka-version (str/trim (slurp (io/file "resources" "BABASHKA_VERSION"))))
|
(def babashka-version (str/trim (slurp (io/file "resources" "BABASHKA_VERSION"))))
|
||||||
|
|
||||||
(def text (format "[%s - %s@%s]: https://%s-201467090-gh.circle-artifacts.com/0/release/babashka-%s-%s-amd64.zip"
|
|
||||||
(System/getenv "BABASHKA_PLATFORM")
|
|
||||||
(System/getenv "CIRCLE_BRANCH")
|
|
||||||
(System/getenv "CIRCLE_SHA1")
|
|
||||||
(System/getenv "CIRCLE_BUILD_NUM")
|
|
||||||
babashka-version
|
|
||||||
(System/getenv "BABASHKA_PLATFORM")))
|
|
||||||
|
|
||||||
(def slack-hook-url (System/getenv "SLACK_HOOK_URL"))
|
(def slack-hook-url (System/getenv "SLACK_HOOK_URL"))
|
||||||
(when slack-hook-url
|
|
||||||
(let [json (generate-string {:username "borkdude"
|
(defn slack! [text]
|
||||||
:channel channel
|
(when slack-hook-url
|
||||||
:text text})]
|
(let [json (generate-string {:username "borkdude"
|
||||||
(sh "curl" "-X" "POST" "-H" "Content-Type: application/json" "-d" json slack-hook-url)))
|
:channel channel
|
||||||
|
:text text})]
|
||||||
|
(sh "curl" "-X" "POST" "-H" "Content-Type: application/json" "-d" json slack-hook-url))))
|
||||||
|
|
||||||
|
(def release-text (format "[%s - %s@%s]: https://%s-201467090-gh.circle-artifacts.com/0/release/babashka-%s-%s-amd64.zip"
|
||||||
|
(System/getenv "BABASHKA_PLATFORM")
|
||||||
|
(System/getenv "CIRCLE_BRANCH")
|
||||||
|
(System/getenv "CIRCLE_SHA1")
|
||||||
|
(System/getenv "CIRCLE_BUILD_NUM")
|
||||||
|
babashka-version
|
||||||
|
(System/getenv "BABASHKA_PLATFORM")))
|
||||||
|
|
||||||
|
(slack! release-text)
|
||||||
|
|
||||||
|
(def binary-size-text
|
||||||
|
(format "[%s - %s@%s] binary size: %s"
|
||||||
|
(System/getenv "BABASHKA_PLATFORM")
|
||||||
|
(System/getenv "CIRCLE_BRANCH")
|
||||||
|
(System/getenv "CIRCLE_SHA1")
|
||||||
|
(slurp (io/file "/tmp/bb_size/size"))))
|
||||||
|
|
||||||
|
(slack! binary-size-text)
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ cp bb /tmp/release
|
||||||
VERSION=$(cat resources/BABASHKA_VERSION)
|
VERSION=$(cat resources/BABASHKA_VERSION)
|
||||||
|
|
||||||
cd /tmp/release
|
cd /tmp/release
|
||||||
|
mkdir -p /tmp/bb_size
|
||||||
|
./bb '(spit "/tmp/bb_size/size" (.length (io/file "bb")))'
|
||||||
|
|
||||||
## release binary as zip archive
|
## release binary as zip archive
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue