Skip to content

Commit b1da11b

Browse files
committed
Run iOS Simulator Tests
This builds, links, and runs the tests on `x86_64-apple-ios` using [`dinghy`](https://github.com/sonos/dinghy). It moves the targets which only Build/Link to their own job. Signed-off-by: Joe Richey <joerichey@google.com>
1 parent 14b461f commit b1da11b

File tree

1 file changed

+29
-13
lines changed

1 file changed

+29
-13
lines changed

.github/workflows/tests.yml

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
cargo generate-lockfile -Z minimal-versions
3535
cargo test --features=custom,std
3636
37+
# TODO: add aarch64-based macOS runner when it's supported by Github Actions
3738
main-tests:
3839
name: Tier 1 Test
3940
runs-on: ${{ matrix.os }}
@@ -81,26 +82,29 @@ jobs:
8182
sudo apt-get install gcc-multilib
8283
- run: cargo test --target=${{ matrix.target }} --features=std
8384

84-
# We can only Build/Link on these targets for now.
85-
# TODO: Run the iOS binaries in the simulator
86-
# TODO: build/run aarch64-apple-darwin binaries on a x86_64 Mac
87-
apple-tests:
88-
name: Additional Apple targets
85+
ios-tests:
86+
name: iOS Simulator Test
8987
runs-on: macos-latest
90-
strategy:
91-
matrix:
92-
target: [
93-
aarch64-apple-ios,
94-
x86_64-apple-ios,
95-
]
9688
steps:
9789
- uses: actions/checkout@v2
9890
- uses: dtolnay/rust-toolchain@stable
9991
with:
10092
targets: x86_64-apple-ios
10193
- uses: Swatinem/rust-cache@v1
102-
- name: Build Tests
103-
run: cargo test --no-run --target=${{ matrix.target }} --features=std
94+
- name: Download cargo-dinghy
95+
run: |
96+
VERSION=0.6.2
97+
URL="https://github.com/sonos/dinghy/releases/download/${VERSION}/cargo-dinghy-macos-${VERSION}.tgz"
98+
curl -L $URL | tar -xz --strip-components=1 -C ~/.cargo/bin
99+
cargo dinghy --version
100+
- name: Setup Simulator
101+
run: |
102+
RUNTIME_ID=$(xcrun simctl list runtimes | grep iOS | cut -d ' ' -f 7 | tail -1)
103+
SIM_ID=$(xcrun simctl create My-iphone7 com.apple.CoreSimulator.SimDeviceType.iPhone-7 $RUNTIME_ID)
104+
xcrun simctl boot $SIM_ID
105+
echo "device=$SIM_ID" >> $GITHUB_ENV
106+
- name: Run tests
107+
run: cargo dinghy -d ${{ env.device }} test
104108

105109
windows-tests:
106110
name: Windows Test
@@ -143,6 +147,18 @@ jobs:
143147
- name: Test
144148
run: cross test --no-fail-fast --target=${{ matrix.target }} --features=std
145149

150+
macos-link:
151+
name: macOS ARM64 Build/Link
152+
runs-on: macos-latest
153+
steps:
154+
- uses: actions/checkout@v2
155+
- uses: dtolnay/rust-toolchain@stable
156+
with:
157+
targets: aarch64-apple-darwin, aarch64-apple-ios
158+
- uses: Swatinem/rust-cache@v1
159+
- run: cargo test --no-run --target=aarch64-apple-darwin --features=std
160+
- run: cargo test --no-run --target=aarch64-apple-ios --features=std
161+
146162
cross-link:
147163
name: Cross Build/Link
148164
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)