diff --git a/.build/bb.edn b/.build/bb.edn index c1e5ff3e..f48f976f 100644 --- a/.build/bb.edn +++ b/.build/bb.edn @@ -2,5 +2,9 @@ :deps {borkdude/gh-release-artifact #_{:local/root "../gh-release-artifact"} {:git/url "https://github.com/borkdude/gh-release-artifact" - :sha "cf082df46a648178d1904e9cbcb787d8136a35c6"}} - :tasks {release-artifact babashka.release-artifact/release}} + :sha "cf082df46a648178d1904e9cbcb787d8136a35c6"} + babashka/.build {:git/url "https://github.com/babashka/.build" + :git/sha "1ce87f4960fea14f4d1248052e585e6027555d33"}} + :tasks {:requires ([scripts.short-ci :as short]) + release-artifact babashka.release-artifact/release + short-ci short/main}} diff --git a/.circleci/config.yml b/.circleci/config.yml index 9aea3e94..6e6c64c8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,10 +15,10 @@ commands: jobs: short-if-irrelevant: docker: - - image: cimg/base:stable + - image: cimg/clojure:1.11.1 steps: - checkout - - run: + - run: name: Bootstrap Babashka command: | curl -sLO https://raw.githubusercontent.com/babashka/babashka/master/install @@ -28,7 +28,7 @@ jobs: command: mv /tmp/bb /tmp/bbb - run: name: Short CI if only irrelevant changes - command: /tmp/bbb .circleci/script/short.clj + command: /tmp/bbb --config .build/bb.edn short-ci "circleci task halt" jvm: docker: - image: circleci/clojure:openjdk-11-lein-2.9.8-bullseye @@ -485,22 +485,22 @@ workflows: ci: jobs: - short-if-irrelevant - - jvm: + - jvm: requires: - short-if-irrelevant - - linux: + - linux: requires: - short-if-irrelevant - - linux-static: + - linux-static: requires: - short-if-irrelevant - - mac: + - mac: requires: - short-if-irrelevant - - linux-aarch64: + - linux-aarch64: requires: - short-if-irrelevant - - linux-aarch64-static: + - linux-aarch64-static: requires: - short-if-irrelevant - deploy: diff --git a/.circleci/script/short.clj b/.circleci/script/short.clj deleted file mode 100644 index 490bdb38..00000000 --- a/.circleci/script/short.clj +++ /dev/null @@ -1,42 +0,0 @@ -(require '[babashka.process :as proc] - '[clojure.string :as str]) - -(def config - {:skip-if-only [#".*.md$"]}) - -(defn exec [cmd] - (-> cmd - (proc/process) - (proc/check))) - -(defn get-changes [] - (-> "git diff --name-only HEAD~1" - (exec) - (:out) - slurp - (str/split-lines))) - -(defn irrelevant-change? [change regexes] - (some? (some #(re-matches % change) regexes))) - -(defn relevant? [change-set regexes] - (some? (some #(not (irrelevant-change? % regexes)) change-set))) - -(defn main [] - (let [{:keys [skip-if-only]} config - changed-files (get-changes)] - (if (relevant? changed-files skip-if-only) - (println "Proceeding with CI run") - (do - (println "Irrelevant changes - skipping CI run") - (exec "circleci task halt"))))) - -(when (= *file* (System/getProperty "babashka.file")) - (main)) - -(comment - (def regexes [#".*.md$" - #".*.clj"]) ;ignore clojure files - (irrelevant-change? "src/file.png" regexes) - (re-matches #".*.clj$" "src/file.clj.dfff") - (relevant? ["src/file.clj"] regexes))