Skip to content

Commit

Permalink
Fix jdk8 compatibility
Browse files Browse the repository at this point in the history
Addendum for #552

Add jdk variants for CI.
Default to jdk 21 but also sanity test on jdks 8, 11 and 17.
  • Loading branch information
lread committed Mar 17, 2024
1 parent 486d80a commit 02982e6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
java-version: ${{ matrix.jdk-version }}

- name: Install Clojure Tools
uses: DeLaGuardo/setup-clojure@12.5
Expand Down
45 changes: 31 additions & 14 deletions script/test_matrix.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,62 @@
[helper.main :as main]
[lread.status-line :as status]))

(defn- test-def [os id platform browser]
(defn- test-def [{:keys [os id platform browser jdk-version]}]
{:os os
:jdk-version jdk-version
:cmd (->> ["bb" (str "test:" platform)
"--suites" id
(when browser (str "--browsers " browser))
(when (= "ubuntu" os) "--launch-virtual-display")]
(remove nil?)
(string/join " "))
:desc (->> [id os browser platform]
:desc (->> [id os browser (if (= "jvm" platform)
(str "jdk" jdk-version)
platform)]
(remove nil?)
(string/join " "))})

(defn- test-doc [{:keys [os jdk-version]}]
{:os os
:jdk-version jdk-version
:cmd (if (= "ubuntu" os)
"bb test-doc --launch-virtual-display"
"bb test-doc")
:desc (str "test-doc " os " jdk" jdk-version)} )

(defn- github-actions-matrix []
(let [oses ["macos" "ubuntu" "windows"]
ide-browsers ["chrome" "firefox"]
api-browsers ["chrome" "firefox" "edge" "safari"]
platforms ["jvm" "bb"]]
platforms ["jvm" "bb"]
jdk-versions ["8" "11" "17" "21"]
default-opts {:jdk-version "21"}]
(->> (concat
(for [os oses
platform platforms]
(test-def os "unit" platform nil))
(test-def (merge default-opts {:os os :id "unit" :platform platform})))
(for [os oses
platform platforms
browser ide-browsers]
(test-def os "ide" platform browser))
(test-def (merge default-opts {:os os :id "ide" :platform platform :browser browser})))
(for [os oses
platform platforms
browser api-browsers
:when (not (or (and (= "ubuntu" os) (some #{browser} ["edge" "safari"]))
(and (= "windows" os) (= "safari" browser))))]
(test-def os "api" platform browser))
(test-def (merge default-opts {:os os :id "api" :platform platform :browser browser})))
;; for jdk coverage we don't need to run across all oses and browsers
(for [id ["unit" "ide" "api"]
jdk-version jdk-versions
:when (not= jdk-version (:jdk-version default-opts))]
(test-def {:jdk-version jdk-version :os "ubuntu" :id id :platform "jvm" :browser "firefox"}))
(for [os oses]
{:os os
:cmd (if (= "ubuntu" os)
"bb test-doc --launch-virtual-display"
"bb test-doc")
:desc (str "test-doc " os)}))
(sort-by :desc)
(into [{:os "ubuntu" :cmd "bb lint" :desc "lint"}]))))
(test-doc (merge default-opts {:os os})))
(for [jdk-version jdk-versions
:when (not= jdk-version (:jdk-version default-opts))]
(test-doc {:jdk-version jdk-version :os "ubuntu"})))
(sort-by (juxt #(parse-long (:jdk-version %)) :desc))
(into [(merge default-opts {:os "ubuntu" :cmd "bb lint" :desc "lint"})]))))

(def valid-formats ["json" "table"])
(def cli-spec {:help {:desc "This usage help"}
Expand Down Expand Up @@ -74,7 +91,7 @@
(status/line :detail
(if (= "json" (:format opts))
(json/generate-string matrix)
(doric/table [:os :cmd :desc] matrix)))))))
(doric/table [:os :jdk-version :cmd :desc] matrix)))))))

(main/when-invoked-as-script
(apply -main *command-line-args*))
2 changes: 1 addition & 1 deletion src/etaoin/api.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2818,7 +2818,7 @@
.codePoints
.iterator
iterator-seq
(map #(Character/toString %))))
(map #(String. (Character/toChars %)))))

(defn- make-input* [text & more]
(codepoints (apply str text more)))
Expand Down

0 comments on commit 02982e6

Please sign in to comment.