Skip to content

Commit 7414834

Browse files
committed
Use Rosetta, macos-latest
1 parent 693bc49 commit 7414834

2 files changed

Lines changed: 18 additions & 11 deletions

File tree

.github/workflows/ci.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,29 @@ jobs:
1212
build:
1313
strategy:
1414
matrix:
15-
# macos-13 is the last x86_64 runner; ArrayFire only ships an x86_64
16-
# macOS binary, so the flake has no aarch64-darwin (macos-latest) build.
17-
os: [ubuntu-latest, macos-13]
15+
os: [ubuntu-latest, macos-latest]
1816
runs-on: ${{ matrix.os }}
1917
steps:
2018
- uses: actions/checkout@v4
2119

20+
# macos-latest is Apple Silicon, but ArrayFire only ships an x86_64 macOS
21+
# binary, so the flake's darwin output is x86_64-darwin. Build it under
22+
# Rosetta 2: ensure Rosetta is present and let Nix build x86_64-darwin
23+
# derivations via `extra-platforms` below.
24+
- name: Install Rosetta 2
25+
if: runner.os == 'macOS'
26+
run: softwareupdate --install-rosetta --agree-to-license
27+
2228
- uses: cachix/install-nix-action@v31
2329
with:
2430
nix_path: nixpkgs=channel:nixpkgs-unstable
31+
extra_nix_config: |
32+
extra-platforms = x86_64-darwin
2533
26-
- name: Build and run tests
34+
- name: Build and run tests (Linux)
35+
if: runner.os == 'Linux'
2736
run: nix build -L
37+
38+
- name: Build and run tests (macOS, x86_64 via Rosetta)
39+
if: runner.os == 'macOS'
40+
run: nix build -L .#packages.x86_64-darwin.default

test/Main.hs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ module Main where
44

55
import Control.Monad
66

7-
import Data.Maybe (isJust)
87
import Data.Proxy
98
import Spec (spec)
109
import Test.Hspec (hspec)
@@ -14,19 +13,14 @@ import Test.QuickCheck.Classes
1413
import qualified ArrayFire as A
1514
import ArrayFire (Array)
1615

17-
import System.Environment (lookupEnv)
1816
import System.IO.Unsafe
1917

2018
instance (A.AFType a, Arbitrary a) => Arbitrary (Array a) where
2119
arbitrary = pure $ unsafePerformIO (A.randu [2,2])
2220

2321
main :: IO ()
2422
main = do
25-
-- In CI there's often no GPU/OpenCL device available, which makes the
26-
-- default backend throw (e.g. cl::Error: clGetDeviceIDs). Fall back to
27-
-- the CPU backend when running in CI.
28-
-- inCI <- isJust <$> lookupEnv "CI"
29-
-- when (not inCI) (A.setBackend A.Default)
23+
A.setBackend A.CPU
3024
-- checks (Proxy :: Proxy (A.Array (A.Complex Float)))
3125
-- checks (Proxy :: Proxy (A.Array (A.Complex Double)))
3226
-- checks (Proxy :: Proxy (A.Array Double))

0 commit comments

Comments
 (0)