Skip to content

Commit

Permalink
Test on macOS-13 and macOS-14
Browse files Browse the repository at this point in the history
* Use newer iphone simulator for CI
* Add aarch64-apple-ios-sim for testing
  • Loading branch information
simlay authored and kali committed Feb 21, 2024
1 parent 1cd70c0 commit 0ff515e
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 5 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ jobs:
run: ./.travis.sh

macos:
runs-on: macOS-latest
strategy:
matrix:
os: [ macOS-13, macOS-14 ]
runs-on: ${{matrix.os}}

steps:
- uses: actions/checkout@v1
Expand Down
52 changes: 48 additions & 4 deletions .travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,63 @@ tests_sequence() {
)
}

tests_sequence_aarch64_ios_sim() {
title "testing from workspace directory"
( \
cd test-ws \
&& cargo clean \
&& $CARGO_DINGHY -d $1 -p auto-ios-aarch64-sim test pass \
&& ! $CARGO_DINGHY -d $1 -p auto-ios-aarch64-sim test fails \
&& ! $CARGO_DINGHY -d $1 -p auto-ios-aarch64-sim test \
)

title "testing from project directory"
( \
cd test-ws/test-app \
&& cargo clean \
&& $CARGO_DINGHY -d $1 -p auto-ios-aarch64-sim test pass \
&& ! $CARGO_DINGHY -d $1 -p auto-ios-aarch64-sim test fails \
&& ! $CARGO_DINGHY -d $1 -p auto-ios-aarch64-sim test \
)

title "test from workspace directory with project filter"
( \
cd test-ws \
&& cargo clean \
&& $CARGO_DINGHY -d $1 -p auto-ios-aarch64-sim test -p test-app pass \
&& ! $CARGO_DINGHY -d $1 -p auto-ios-aarch64-sim test -p test-app fails \
&& ! $CARGO_DINGHY -d $1 -p auto-ios-aarch64-sim test -p test-app \
)
}


if [ `uname` = Darwin ]
then
title "••••• Darwin: ios simulator tests •••••"
title "boot a simulator"
rustup target add x86_64-apple-ios;
RUNTIME_ID=$(xcrun simctl list runtimes | grep iOS | cut -d ' ' -f 7 | tail -1)
export SIM_ID=$(xcrun simctl create My-iphone7 com.apple.CoreSimulator.SimDeviceType.iPhone-8 $RUNTIME_ID)

# Installed simulators on github runners differ depending on the version
# of macos. When the simulator device type ID needs to be updated, select
# a new one:
# https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md#installed-simulators
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#installed-simulators
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md#installed-simulators
export SIM_ID=$(xcrun simctl create My-iphone-se com.apple.CoreSimulator.SimDeviceType.iPhone-SE-3rd-generation $RUNTIME_ID)
xcrun simctl boot $SIM_ID
tests_sequence $SIM_ID

# The x86_64-apple-ios target seems to not work on an ARM64 host,
# and the aarch64-apple-ios-sim target doesn't work on an x86-64 host.
if [ "$(uname -m)" = "arm64" ]; then
rustup target add aarch64-apple-ios-sim;
tests_sequence_aarch64_ios_sim $SIM_ID
else
rustup target add x86_64-apple-ios;
tests_sequence $SIM_ID
fi

xcrun simctl delete $SIM_ID

if ios-deploy -c -t 1 > /tmp/ios_devices
then
device=$(grep "Found" /tmp/ios_devices | head -1 | cut -d " " -f 3)
Expand Down

0 comments on commit 0ff515e

Please sign in to comment.