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>
This commit is contained in:
Joe Richey 2022-10-23 21:38:21 -07:00
parent 14b461fa39
commit b1da11b850

View File

@ -34,6 +34,7 @@ jobs:
cargo generate-lockfile -Z minimal-versions cargo generate-lockfile -Z minimal-versions
cargo test --features=custom,std cargo test --features=custom,std
# TODO: add aarch64-based macOS runner when it's supported by Github Actions
main-tests: main-tests:
name: Tier 1 Test name: Tier 1 Test
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@ -81,26 +82,29 @@ jobs:
sudo apt-get install gcc-multilib sudo apt-get install gcc-multilib
- run: cargo test --target=${{ matrix.target }} --features=std - run: cargo test --target=${{ matrix.target }} --features=std
# We can only Build/Link on these targets for now. ios-tests:
# TODO: Run the iOS binaries in the simulator name: iOS Simulator Test
# TODO: build/run aarch64-apple-darwin binaries on a x86_64 Mac
apple-tests:
name: Additional Apple targets
runs-on: macos-latest runs-on: macos-latest
strategy:
matrix:
target: [
aarch64-apple-ios,
x86_64-apple-ios,
]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable - uses: dtolnay/rust-toolchain@stable
with: with:
targets: x86_64-apple-ios targets: x86_64-apple-ios
- uses: Swatinem/rust-cache@v1 - uses: Swatinem/rust-cache@v1
- name: Build Tests - name: Download cargo-dinghy
run: cargo test --no-run --target=${{ matrix.target }} --features=std run: |
VERSION=0.6.2
URL="https://github.com/sonos/dinghy/releases/download/${VERSION}/cargo-dinghy-macos-${VERSION}.tgz"
curl -L $URL | tar -xz --strip-components=1 -C ~/.cargo/bin
cargo dinghy --version
- name: Setup Simulator
run: |
RUNTIME_ID=$(xcrun simctl list runtimes | grep iOS | cut -d ' ' -f 7 | tail -1)
SIM_ID=$(xcrun simctl create My-iphone7 com.apple.CoreSimulator.SimDeviceType.iPhone-7 $RUNTIME_ID)
xcrun simctl boot $SIM_ID
echo "device=$SIM_ID" >> $GITHUB_ENV
- name: Run tests
run: cargo dinghy -d ${{ env.device }} test
windows-tests: windows-tests:
name: Windows Test name: Windows Test
@ -143,6 +147,18 @@ jobs:
- name: Test - name: Test
run: cross test --no-fail-fast --target=${{ matrix.target }} --features=std run: cross test --no-fail-fast --target=${{ matrix.target }} --features=std
macos-link:
name: macOS ARM64 Build/Link
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin, aarch64-apple-ios
- uses: Swatinem/rust-cache@v1
- run: cargo test --no-run --target=aarch64-apple-darwin --features=std
- run: cargo test --no-run --target=aarch64-apple-ios --features=std
cross-link: cross-link:
name: Cross Build/Link name: Cross Build/Link
runs-on: ubuntu-latest runs-on: ubuntu-latest