Skip to content

Commit caefbc5

Browse files
authored
ci: adapt to macos-latest image hardware changes (#266)
macos-latest is now arm-based and does not include jdk8 Closes #265
1 parent 0d4de5b commit caefbc5

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

script/ci_unit_tests.clj

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,24 @@
1919
"ubuntu"))
2020

2121
;; matrix params to be used on ci
22-
(def ^:private all-oses ["ubuntu" "macos" "windows"])
23-
(def ^:private all-jdks ["8" "11" "17" "21"])
22+
(def ^:private os-jdks {"ubuntu" ["8" "11" "17" "21"]
23+
;; macOS on GitHub Actions is now arm-based and does not include jdk8
24+
"macos" ["11" "17" "21"]
25+
"windows" ["8" "11" "17" "21"]})
26+
(def ^:private all-oses (keys os-jdks))
2427

2528
(defn- test-tasks []
2629
(concat [;; run lintish tasks across all oses to verify that they will work for all devs regardless of their os choice
27-
{:desc "import-vars" :cmd "bb apply-import-vars check" :oses all-oses :jdks ["8"]}
28-
{:desc "lint" :cmd "bb lint" :oses all-oses :jdks ["8"]}
30+
{:desc "import-vars" :cmd "bb apply-import-vars check" :oses all-oses :jdks :earliest}
31+
{:desc "lint" :cmd "bb lint" :oses all-oses :jdks :earliest}
2932
;; test-docs on default clojure version across all oses and jdks
30-
{:desc "test-doc" :cmd "bb test-doc" :oses all-oses :jdks all-jdks
31-
:requires ["npm"]}]
33+
{:desc "test-doc" :cmd "bb test-doc" :oses all-oses :jdks :all :requires ["npm"]}]
3234
(for [version ["all"]]
3335
{:desc (str "clj-" version)
3436
:cmd (str "bb test-clj --clojure-version " version)
3537
:oses all-oses
36-
:jdks all-jdks})
37-
;; I'm not sure there's much value testing across jdks for ClojureScript tests, for now we'll stick with jdk 8 only
38+
:jdks :all})
39+
;; I'm not sure there's much value testing across jdks for ClojureScript tests, for now we'll stick with earliest jdk only
3840
(for [env [{:param "node" :desc "node"}
3941
{:param "chrome-headless" :desc "browser"}]
4042
opt [{:param "none"}
@@ -44,7 +46,7 @@
4446
(when (:desc opt) (str "-" (:desc opt))))
4547
:cmd (str "bb test-cljs --env " (:param env) " --optimizations " (:param opt))
4648
:oses all-oses
47-
:jdks ["8"]
49+
:jdks :earliest
4850
:requires ["npm"]})
4951
;; shadow-cljs requires a min of jdk 11 so we'll test on that
5052
[{:desc "shadow-cljs" :cmd "bb test-shadow-cljs" :oses all-oses :jdks ["11"]
@@ -53,12 +55,15 @@
5355
:requires ["npm"]}]
5456
;; planck does not run on windows, and I don't think it needs a jdk
5557
[{:desc "cljs-bootstrap" :cmd "bb test-cljs --env planck --optimizations none"
56-
:oses ["macos" "ubuntu"] :jdks ["8"] :requires ["planck"]}]))
58+
:oses ["macos" "ubuntu"] :jdks :earliest :requires ["planck"]}]))
5759

5860
(defn- ci-test-matrix []
5961
(for [{:keys [desc cmd oses jdks requires]} (test-tasks)
6062
os oses
61-
jdk jdks]
63+
jdk (case jdks
64+
:earliest (take 1 (get os-jdks os))
65+
:all (get os-jdks os)
66+
jdks)]
6267
{:desc (str desc " " os " jdk" jdk)
6368
:cmd cmd
6469
:os os
@@ -105,12 +110,13 @@ By default, will run all tests applicable to your current jdk and os.")
105110
(let [cur-os (matrix-os)
106111
cur-jdk (jdk/version)
107112
cur-major-jdk (str (:major cur-jdk))
113+
ci-jdks (get os-jdks cur-os)
108114
test-list (local-test-list cur-os cur-major-jdk)
109115
tests-skipped (filter :skip-reasons test-list)
110116
tests-to-run (remove :skip-reasons test-list)]
111-
(when (not (some #{cur-major-jdk} all-jdks))
112-
(status/line :warn "CI runs only on jdks %s but you are on jdk %s\nWe'll run tests anyway."
113-
all-jdks (:version cur-jdk)))
117+
(when (not (some #{cur-major-jdk} ci-jdks))
118+
(status/line :warn "CI runs only on jdks %s on %s OS but you are on jdk %s\nWe'll run tests anyway."
119+
ci-jdks cur-os (:version cur-jdk)))
114120

115121
(status/line :head "Test plan")
116122
(status/line :detail "Found %d runnable tests for jdk %s on %s:"

0 commit comments

Comments
 (0)