Skip to content

Commit

Permalink
ci: adapt to new macos arm-based runners
Browse files Browse the repository at this point in the history
The new macos runner is arm-based and missing some software is missing
that all other runners have:
- ImageMagick
- Edge and msedgedriver
- Firefox and geckodriver
Take a shot at optionally installing the above when we need them.

There is also no JDK8 for arm-based macos.
We weren't testing that particular scenario on the intel-based macos runners
but I updated the code to reflect this fact.
  • Loading branch information
lread committed May 3, 2024
1 parent 2826a19 commit c699552
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 12 deletions.
28 changes: 26 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Test
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master

jobs:
setup:
Expand Down Expand Up @@ -77,6 +77,30 @@ jobs:
if: ${{ matrix.os == 'ubuntu' }}
run: sudo apt-get -y install fluxbox

# No longer pre-installed on macOS github action runners
- name: Install Image Magick on macOS
if: ${{ matrix.os == 'macos' && contains(matrix.needs, 'imagemagick') }}
run: brew install imagemagick

# No longer pre-installed on macOS github action runners
- name: Install Microsoft Edge on macOS
if: ${{ matrix.os == 'macos' && contains(matrix.needs, 'edge') }}
run: |
brew install --cask microsoft-edge
EDGE_VERSION=$(defaults read /Applications/Microsoft\ Edge.app/Contents/Info CFBundleShortVersionString)
DRIVER_URL="https://msedgedriver.azureedge.net/${EDGE_VERSION}/edgedriver_mac64_m1.zip"
curl -o msedgedriver.zip $DRIVER_URL
mkdir $RUNNER_TEMP/edgedriver
unzip msedgedriver.zip -d $RUNNER_TEMP/edgedriver
echo "$RUNNER_TEMP/edgedriver" >> $GITHUB_PATH
# No longer pre-installed on macOS github action runners
- name: Install Firefox on macOS
if: ${{ matrix.os == 'macos' && contains(matrix.needs, 'firefox') }}
run: |
brew install --cask firefox
brew install geckodriver
- uses: actions/checkout@v4

- name: Clojure deps cache
Expand Down
7 changes: 4 additions & 3 deletions doc/01-user-guide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Etaoin's test suite covers the following OSes and browsers for both Clojure and
| -
| -

| macOS
| macOS ^1^
| yes
| yes
| yes
Expand All @@ -68,7 +68,8 @@ Etaoin's test suite covers the following OSes and browsers for both Clojure and

|===

NOTE: We did once test against PhantomJS, but since work has long ago stopped on this project, we have dropped testing
1. Our GitHub Actions macOS tests run on silicon (aka arm64, aarch64 or M*) hardware
2. We did once test against PhantomJS, but since work has long ago stopped on this project, we have dropped testing

== Installation

Expand Down Expand Up @@ -2097,7 +2098,7 @@ a| Random port when lanching local WebDriver process, else varies by vendor:
a| `:webdriver-url` for *WebDriver* process. When:

* omitted, creates a new local WebDriver process (unless `:host` was specified).
* specified, attempts to connect to an existing running WebDriver process.
* specified, attempts to connect to an existing running WebDriver process.

See <<connecting-existing>>.

Expand Down
30 changes: 23 additions & 7 deletions script/test_matrix.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@
(when (= "ubuntu" os) "--launch-virtual-display")]
(remove nil?)
(string/join " "))
:needs (case id
"unit"
["chrome" "firefox"]

"api"
(conj ["imagemagick"] browser)

"ide"
[browser])
:desc (->> [id os browser (if (= "jvm" platform)
(str "jdk" jdk-version)
platform)]
Expand All @@ -27,14 +36,18 @@
:cmd (if (= "ubuntu" os)
"bb test-doc --launch-virtual-display"
"bb test-doc")
:needs ["chrome" "firefox"]
:desc (str "test-doc " os " jdk" jdk-version)} )

(defn- github-actions-matrix []
(let [oses ["macos" "ubuntu" "windows"]
(let [os-jdks {"ubuntu" ["8" "11" "17" "21"]
;; macOS on GitHub Actions is now arm-based and does not include jdk8
"macos" ["11" "17" "21"]
"windows" ["8" "11" "17" "21"]}
oses (keys os-jdks)
ide-browsers ["chrome" "firefox"]
api-browsers ["chrome" "firefox" "edge" "safari"]
platforms ["jvm" "bb"]
jdk-versions ["8" "11" "17" "21"]
default-opts {:jdk-version "21"}]
(->> (concat
(for [os oses
Expand All @@ -43,7 +56,8 @@
(for [os oses
platform platforms
browser ide-browsers]
(test-def (merge default-opts {:os os :id "ide" :platform platform :browser browser})))
(test-def (merge default-opts
{:os os :id "ide" :platform platform :browser browser})))
(for [os oses
platform platforms
browser api-browsers
Expand All @@ -52,12 +66,14 @@
(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
jdk-version (get os-jdks "ubuntu")
:when (not= jdk-version (:jdk-version default-opts))]
(test-def {:jdk-version jdk-version :os "ubuntu" :id id :platform "jvm" :browser "firefox"}))
(test-def {:jdk-version jdk-version :os "ubuntu" :id id
:platform "jvm"
:browser (when (not= "unit" id) "firefox")}))
(for [os oses]
(test-doc (merge default-opts {:os os})))
(for [jdk-version jdk-versions
(for [jdk-version (get os-jdks "ubuntu")
:when (not= jdk-version (:jdk-version default-opts))]
(test-doc {:jdk-version jdk-version :os "ubuntu"})))
(sort-by (juxt #(parse-long (:jdk-version %)) :desc))
Expand Down Expand Up @@ -91,7 +107,7 @@
(status/line :detail
(if (= "json" (:format opts))
(json/generate-string matrix)
(doric/table [:os :jdk-version :cmd :desc] matrix)))))))
(doric/table [:os :jdk-version :cmd :needs :desc] matrix)))))))

(main/when-invoked-as-script
(apply -main *command-line-args*))

0 comments on commit c699552

Please sign in to comment.