Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: make unit tests run in parallel #205

Merged
merged 12 commits into from
Aug 17, 2024
104 changes: 75 additions & 29 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,46 +8,92 @@ on:
- 1.1.x

jobs:
test:
runs-on: macos-13
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"
test-destination-os: latest

- runs-on: macos-12
platform: iOS
xcode: 14.1
test-destination-os: 16.1
device: "iPhone 14"

- runs-on: macos-13
platform: macOS
xcode: 15.2
test-destination-os: latest

- runs-on: macos-13
platform: tvOS
xcode: 15.2
test-destination-os: latest
device: "Apple TV"

- runs-on: macos-13
platform: watchOS
xcode: 15.2
test-destination-os: latest
device: "Apple Watch Series 8 (41mm)"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set Xcode 15
uses: actions/checkout@v4
- name: Set Xcode ${{ matrix.xcode }}
run: |
sudo xcode-select -switch /Applications/Xcode_15.2.app
sudo xcode-select -switch /Applications/Xcode_${{ matrix.xcode }}.app
- name: List Simulators
run: |
xcrun simctl list
- name: List Project Configuration
run: |
xcodebuild -list
- name: iOS Tests
run: |
xcodebuild test \
-scheme Amplitude-Swift-Package \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone 15'
- name: macOS Tests
- name: ${{ matrix.platform }} Tests
run: |
xcodebuild test \
-scheme Amplitude-Swift-Package \
-sdk macosx \
-destination 'platform=macosx'
- name: tvOS Tests
run: |
xcodebuild \
-scheme Amplitude-Swift-Package \
-sdk appletvsimulator \
-destination 'platform=tvOS Simulator,name=Apple TV' \
test
- name: watchOS Tests
case "${{ matrix.platform }}" in
iOS)
xcodebuild test \
-scheme Amplitude-Swift-Package \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,OS=${{ matrix.test-destination-os }},name=${{ matrix.device }}'
;;
macOS)
xcodebuild test \
-scheme Amplitude-Swift-Package \
-sdk macosx \
-destination 'platform=macosx,OS=${{ matrix.test-destination-os }}'
;;
tvOS)
xcodebuild \
-scheme Amplitude-Swift-Package \
-sdk appletvsimulator \
-destination 'platform=tvOS Simulator,OS=${{ matrix.test-destination-os }},name=${{ matrix.device }}' \
test
;;
watchOS)
xcodebuild \
-scheme Amplitude-Swift-Package \
-sdk watchsimulator \
-destination 'platform=watchOS Simulator,OS=${{ matrix.test-destination-os }},name=${{ matrix.device }}' \
test
;;
esac
objc-example-test:
runs-on: macos-13
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set Xcode 15
run: |
xcodebuild \
-scheme Amplitude-Swift-Package \
-sdk watchsimulator \
-destination 'platform=watchOS Simulator,name=Apple Watch Series 8 (41mm)' \
test
sudo xcode-select -switch /Applications/Xcode_15.2.app
- name: Objective-C Example Tests (iOS)
working-directory: Examples/AmplitudeObjCExample
run: |
Expand Down
Loading