ci: make unit tests run in parallel #625
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Unit Test | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
- 1.1.x | |
jobs: | |
unit-test: | |
name: Unit ${{ matrix.platform }} - Xcode ${{ matrix.xcode }} - OS ${{ matrix.test-destination-os }} | |
runs-on: ${{ matrix.runs-on }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- runs-on: macos-13 | |
platform: iOS | |
xcode: 15.2 | |
device: "iPhone 15" | |
- runs-on: macos-12 | |
platform: iOS | |
xcode: 14.1 | |
device: "iPhone 14" | |
- runs-on: macos-13 | |
platform: macOS | |
xcode: 15.2 | |
- runs-on: macos-13 | |
platform: tvOS | |
xcode: 15.2 | |
device: "Apple TV" | |
- runs-on: macos-13 | |
platform: watchOS | |
xcode: 15.2 | |
device: "Apple Watch Series 8 (41mm)" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set Xcode ${{ matrix.xcode }} | |
run: | | |
sudo xcode-select -switch /Applications/Xcode_${{ matrix.xcode }}.app | |
- name: List Simulators | |
run: | | |
xcrun simctl list | |
- name: List Project Configuration | |
run: | | |
xcodebuild -list | |
- name: ${{ matrix.platform }} Tests | |
run: | | |
case "${{ matrix.platform }}" in | |
iOS) | |
xcodebuild test \ | |
-scheme Amplitude-Swift-Package \ | |
-sdk iphonesimulator \ | |
-destination 'platform=iOS Simulator,name=${{ matrix.device }}' | |
;; | |
macOS) | |
xcodebuild test \ | |
-scheme Amplitude-Swift-Package \ | |
-sdk macosx \ | |
-destination 'platform=macosx' | |
;; | |
tvOS) | |
xcodebuild \ | |
-scheme Amplitude-Swift-Package \ | |
-sdk appletvsimulator \ | |
-destination 'platform=tvOS Simulator,name=${{ matrix.device }}' \ | |
test | |
;; | |
watchOS) | |
xcodebuild \ | |
-scheme Amplitude-Swift-Package \ | |
-sdk watchsimulator \ | |
-destination 'platform=watchOS Simulator,name=${{ matrix.device }}' \ | |
test | |
;; | |
esac | |
objc-example-test: | |
runs-on: macos-13 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set Xcode 15 | |
run: | | |
sudo xcode-select -switch /Applications/Xcode_15.2.app | |
- name: Objective-C Example Tests (iOS) | |
working-directory: Examples/AmplitudeObjCExample | |
run: | | |
xcodebuild test \ | |
-scheme AmplitudeObjCExample \ | |
-sdk iphonesimulator \ | |
-destination 'platform=iOS Simulator,name=iPhone 15' |