Skip to content

Commit

Permalink
Merge pull request #249 from liquidz/dev
Browse files Browse the repository at this point in the history
Next release
  • Loading branch information
liquidz authored Feb 23, 2024
2 parents 116a94c + af616ca commit da56914
Show file tree
Hide file tree
Showing 17 changed files with 238 additions and 98 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
- uses: DeLaGuardo/setup-clojure@master
with:
cli: latest
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.m2
key: coverage-m2-${{ hashFiles('deps.edn') }}-v1
- name: Run cloverage
run: make coverage
- name: Upload reports
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
java -version
clojure --version
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.m2
key: test-m2-${{ hashFiles('deps.edn') }}-v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
cli: latest
lein: latest
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.m2
key: test-m2-${{ hashFiles('deps.edn') }}-v1
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
All notable changes to this project will be documented in this file. This change log follows the conventions of http://keepachangelog.com/[keepachangelog.com].

== Unreleased (dev)
// {{{
=== Fixed
* https://github.com/liquidz/antq/pull/248[#248]: Updated github action thrird party detection to add babashka, clj-kondo, cljfmt, cljstyle, and zprint supports.
* https://github.com/liquidz/antq/pull/248[#248]: Fixed github action upgrader to support bb, clj-kondo, cljfmt, cljstyle, and zprint on setup-clojure action.

=== Changed
* Bumped tools.cli to 1.1.230.
* Bumped data.zip to 1.1.0.
* Bumped data.xml to 0.2.0-alpha9.
* Bumped deep-diff2 to 2.11.216.
* Bumped malli to 0.14.0.
// }}}

== 2.8.1173 (2024-01-10)
// {{{
Expand Down
10 changes: 5 additions & 5 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{:paths ["src"]
:deps
{org.clojure/clojure {:mvn/version "1.11.1"}
org.clojure/data.xml {:mvn/version "0.2.0-alpha8"}
org.clojure/data.zip {:mvn/version "1.0.0"}
org.clojure/tools.cli {:mvn/version "1.0.219"}
org.clojure/data.xml {:mvn/version "0.2.0-alpha9"}
org.clojure/data.zip {:mvn/version "1.1.0"}
org.clojure/tools.cli {:mvn/version "1.1.230"}
org.clojure/core.async {:mvn/version "1.6.681"}
org.clojure/tools.deps {:mvn/version "0.18.1398"}
org.clojure/data.json {:mvn/version "2.5.0"}
Expand All @@ -24,9 +24,9 @@
{:extra-paths ["dev"
"test"
"test/resources"]
:extra-deps {metosin/malli {:mvn/version "0.13.0"}
:extra-deps {metosin/malli {:mvn/version "0.14.0"}
lambdaisland/kaocha {:mvn/version "1.87.1366"}
lambdaisland/deep-diff2 {:mvn/version "2.10.211"}}
lambdaisland/deep-diff2 {:mvn/version "2.11.216"}}
:jvm-opts ["-Dclojure.core.async.go-checking=true"]}

:nop
Expand Down
9 changes: 9 additions & 0 deletions src/antq/constant/github_action.clj
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
(ns antq.constant.github-action)

(def type-key ::type)

(def setup-clojure-name "clojure/brew-install")
(def setup-leiningen-name "technomancy/leiningen")
(def setup-boot-name "boot-clj/boot")
(def setup-babashka-name "babashka/babashka")
(def setup-clj-kondo-name "clj-kondo/clj-kondo")
(def setup-cljfmt-name "weavejester/cljfmt")
(def setup-cljstyle-name "greglook/cljstyle")
(def setup-zprint-name "zprint/zprint")
44 changes: 40 additions & 4 deletions src/antq/dep/github_action/third_party.clj
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,48 @@
(->> (:with form)
(keep (fn [[k v]]
(case k
(:tools-deps :cli) {:name "clojure/brew-install" :version v}
:lein {:name "technomancy/leiningen" :version v}
:boot {:name "boot-clj/boot" :version v}
(:tools-deps :cli)
{:type :github-tag
:name const.gh-action/setup-clojure-name
:version v}

:lein
{:type :github-tag
:name const.gh-action/setup-leiningen-name
:version v}

:boot
{:type :github-tag
:name const.gh-action/setup-boot-name
:version v}

:bb
{:type :java
:name const.gh-action/setup-babashka-name
:version v}

:clj-kondo
{:type :java
:name const.gh-action/setup-clj-kondo-name
:version v}

:cljfmt
{:type :github-tag
:name const.gh-action/setup-cljfmt-name
:version v}

:cljstyle
{:type :github-tag
:name const.gh-action/setup-cljstyle-name
:version v}

:zprint
{:type :java
:name const.gh-action/setup-zprint-name
:version v}

nil)))
(map #(-> %
(assoc :type :github-tag)
(assoc-in [:extra const.gh-action/type-key] "DeLaGuardo/setup-clojure")
(r/map->Dependency)))))

Expand Down
14 changes: 10 additions & 4 deletions src/antq/upgrade/github_action.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(ns antq.upgrade.github-action
(:require
[antq.constant.github-action :as const.gh-action]
[antq.dep.github-action :as dep.gh-action]
[antq.log :as log]
[antq.upgrade :as upgrade]
Expand Down Expand Up @@ -50,10 +51,15 @@

(defmethod upgrade-dep "DeLaGuardo/setup-clojure"
[loc version-checked-dep]
(let [target-re (case (:name version-checked-dep)
"clojure/brew-install" #"cli\s*:"
"technomancy/leiningen" #"lein\s*:"
"boot-clj/boot" #"boot\s*:"
(let [target-re (condp = (:name version-checked-dep)
const.gh-action/setup-clojure-name #"cli\s*:"
const.gh-action/setup-leiningen-name #"lein\s*:"
const.gh-action/setup-boot-name #"boot\s*:"
const.gh-action/setup-babashka-name #"bb\s*:"
const.gh-action/setup-clj-kondo-name #"clj-kondo\s*:"
const.gh-action/setup-cljfmt-name #"cljfmt\s*:"
const.gh-action/setup-cljstyle-name #"cljstyle\s*:"
const.gh-action/setup-zprint-name #"zprint\s*:"
nil)]
(if-not target-re
(log/error (format "%s: Unexpected name for setup-clojure"
Expand Down
47 changes: 41 additions & 6 deletions test/antq/dep/github_action/third_party_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,71 @@

(t/deftest detect-setup-clojure-test
(t/testing "Clojure Tools"
(t/is (= [(git-tag-dependency {:name "clojure/brew-install"
(t/is (= [(git-tag-dependency {:name const.gh-action/setup-clojure-name
:version "1.0.0"
:extra {const.gh-action/type-key "DeLaGuardo/setup-clojure"}})]
(sut/detect {:uses "DeLaGuardo/setup-clojure@main"
:with {:tools-deps "1.0.0"}})))
(t/is (= [(git-tag-dependency {:name "clojure/brew-install"
(t/is (= [(git-tag-dependency {:name const.gh-action/setup-clojure-name
:version "2.0.0"
:extra {const.gh-action/type-key "DeLaGuardo/setup-clojure"}})]
(sut/detect {:uses "DeLaGuardo/setup-clojure@main"
:with {:cli "2.0.0"}}))))

(t/testing "Leiningen"
(t/is (= [(git-tag-dependency {:name "technomancy/leiningen"
(t/is (= [(git-tag-dependency {:name const.gh-action/setup-leiningen-name
:version "3.0.0"
:extra {const.gh-action/type-key "DeLaGuardo/setup-clojure"}})]
(sut/detect {:uses "DeLaGuardo/setup-clojure@main"
:with {:lein "3.0.0"}}))))

(t/testing "Boot"
(t/is (= [(git-tag-dependency {:name "boot-clj/boot"
(t/is (= [(git-tag-dependency {:name const.gh-action/setup-boot-name
:version "4.0.0"
:extra {const.gh-action/type-key "DeLaGuardo/setup-clojure"}})]
(sut/detect {:uses "DeLaGuardo/setup-clojure@main"
:with {:boot "4.0.0"}}))))

(t/testing "Babashka"
(t/is (= [(java-dependency {:name const.gh-action/setup-babashka-name
:version "4.0.0"
:extra {const.gh-action/type-key "DeLaGuardo/setup-clojure"}})]
(sut/detect {:uses "DeLaGuardo/setup-clojure@main"
:with {:bb "4.0.0"}}))))

(t/testing "clj-kondo"
(t/is (= [(java-dependency {:name const.gh-action/setup-clj-kondo-name
:version "4.0.0"
:extra {const.gh-action/type-key "DeLaGuardo/setup-clojure"}})]
(sut/detect {:uses "DeLaGuardo/setup-clojure@main"
:with {:clj-kondo "4.0.0"}}))))

(t/testing "cljfmt"
(t/is (= [(git-tag-dependency {:name const.gh-action/setup-cljfmt-name
:version "4.0.0"
:extra {const.gh-action/type-key "DeLaGuardo/setup-clojure"}})]
(sut/detect {:uses "DeLaGuardo/setup-clojure@main"
:with {:cljfmt "4.0.0"}}))))

(t/testing "cljstyle"
(t/is (= [(git-tag-dependency {:name const.gh-action/setup-cljstyle-name
:version "4.0.0"
:extra {const.gh-action/type-key "DeLaGuardo/setup-clojure"}})]
(sut/detect {:uses "DeLaGuardo/setup-clojure@main"
:with {:cljstyle "4.0.0"}}))))

(t/testing "zprint"
(t/is (= [(java-dependency {:name const.gh-action/setup-zprint-name
:version "4.0.0"
:extra {const.gh-action/type-key "DeLaGuardo/setup-clojure"}})]
(sut/detect {:uses "DeLaGuardo/setup-clojure@main"
:with {:zprint "4.0.0"}}))))

(t/testing "Multiple"
(t/is (= [(git-tag-dependency {:name "clojure/brew-install"
(t/is (= [(git-tag-dependency {:name const.gh-action/setup-clojure-name
:version "5.0.0"
:extra {const.gh-action/type-key "DeLaGuardo/setup-clojure"}})
(git-tag-dependency {:name "technomancy/leiningen"
(git-tag-dependency {:name const.gh-action/setup-leiningen-name
:version "6.0.0"
:extra {const.gh-action/type-key "DeLaGuardo/setup-clojure"}})]
(sut/detect {:uses "DeLaGuardo/setup-clojure@main"
Expand Down
1 change: 0 additions & 1 deletion test/antq/dep/github_action/uses_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,3 @@
:extra {:url "https://github.com/git/sha-short.git"
const.gh-action/type-key "uses"}})]
(sut/detect [:uses "git/sha-short@8be0919"]))))

1 change: 0 additions & 1 deletion test/antq/log_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,3 @@
(sut/warning "WARNING")
(str sw))]
(t/is (= "WARNING\n" warn-str)))))

1 change: 0 additions & 1 deletion test/antq/upgrade/boot_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,3 @@
(slurp))
upgraded (upgrade/upgrader dummy-excluded-dep)]
(t/is (= original upgraded))))

1 change: 0 additions & 1 deletion test/antq/upgrade/clojure/tool_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,3 @@
:sha {:- "bc28de64fb36b395da4267e8d7916d1a9e167bcd"
:+ "9876543"}}}
(h/diff-deps from-deps to-deps))))))

89 changes: 89 additions & 0 deletions test/antq/upgrade/github_action/third_party.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
(ns antq.upgrade.github-action.third-party
(:require
[antq.constant.github-action :as const.gh-action]
[antq.dep.github-action :as dep.gha]
[antq.record :as r]
[antq.test-helper :as h]
[antq.upgrade :as upgrade]
[antq.upgrade.github-action]
[clojure.java.io :as io]
[clojure.test :as t]))

(defn- map->Dependency
[m]
(-> (merge {:project :github-action
:type :github-tag
:latest-version "9.0.0"
:file (io/resource "dep/third-party/setup-clojure.yml")
:extra {const.gh-action/type-key "DeLaGuardo/setup-clojure"}}
m)
(r/map->Dependency)))

(defn upgrading-diff
[dep]
(let [from-deps (->> (:file dep)
(slurp)
(dep.gha/extract-deps ""))
to-deps (->> (upgrade/upgrader dep)
(dep.gha/extract-deps ""))]
(h/diff-deps from-deps to-deps)))

(t/deftest upgrade-setup-clojure-dep-test
(t/testing "Clojure CLI"
(t/is (= #{{:name const.gh-action/setup-clojure-name :version {:- 1 :+ "9.0.0"}}
{:name const.gh-action/setup-clojure-name :version {:- -1 :+ "9.0.0"}}}
(-> {:name const.gh-action/setup-clojure-name}
(map->Dependency)
(upgrading-diff)))))

(t/testing "Leiningen"
(t/is (= #{{:name const.gh-action/setup-leiningen-name :version {:- 2 :+ "9.0.0"}}
{:name const.gh-action/setup-leiningen-name :version {:- -2 :+ "9.0.0"}}}
(-> {:name const.gh-action/setup-leiningen-name}
(map->Dependency)
(upgrading-diff)))))

(t/testing "Boot"
(t/is (= #{{:name const.gh-action/setup-boot-name :version {:- 3 :+ "9.0.0"}}
{:name const.gh-action/setup-boot-name :version {:- -3 :+ "9.0.0"}}}
(-> {:name const.gh-action/setup-boot-name}
(map->Dependency)
(upgrading-diff)))))

(t/testing "Babashka"
(t/is (= #{{:name const.gh-action/setup-babashka-name :version {:- 4 :+ "9.0.0"}}
{:name const.gh-action/setup-babashka-name :version {:- -4 :+ "9.0.0"}}}
(-> {:name const.gh-action/setup-babashka-name
:type :java}
(map->Dependency)
(upgrading-diff)))))

(t/testing "clj-kondo"
(t/is (= #{{:name const.gh-action/setup-clj-kondo-name :version {:- 5 :+ "9.0.0"}}
{:name const.gh-action/setup-clj-kondo-name :version {:- -5 :+ "9.0.0"}}}
(-> {:name const.gh-action/setup-clj-kondo-name
:type :java}
(map->Dependency)
(upgrading-diff)))))

(t/testing "cljfmt"
(t/is (= #{{:name const.gh-action/setup-cljfmt-name :version {:- 6 :+ "9.0.0"}}
{:name const.gh-action/setup-cljfmt-name :version {:- -6 :+ "9.0.0"}}}
(-> {:name const.gh-action/setup-cljfmt-name}
(map->Dependency)
(upgrading-diff)))))

(t/testing "cljstyle"
(t/is (= #{{:name const.gh-action/setup-cljstyle-name :version {:- 7 :+ "9.0.0"}}
{:name const.gh-action/setup-cljstyle-name :version {:- -7 :+ "9.0.0"}}}
(-> {:name const.gh-action/setup-cljstyle-name}
(map->Dependency)
(upgrading-diff)))))

(t/testing "zprint"
(t/is (= #{{:name const.gh-action/setup-zprint-name :version {:- 8 :+ "9.0.0"}}
{:name const.gh-action/setup-zprint-name :version {:- -8 :+ "9.0.0"}}}
(-> {:name const.gh-action/setup-zprint-name
:type :java}
(map->Dependency)
(upgrading-diff))))))
Loading

0 comments on commit da56914

Please sign in to comment.