Merge pull request #15 from lorenzhk/main #27
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: Build and Test Apple Watch Package | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install Xcode and Simulator | |
uses: muukii/actions-xcode-install-simulator@1.0.0 | |
with: | |
ios_version: 13.7 | |
- name: Get available simulators | |
run: | | |
AVAILABLE_SIMULATORS=($(xcrun simctl list devices | grep "watchOS" | awk '{print $2}')) | |
echo "Available simulators: ${AVAILABLE_SIMULATORS[@]}" | |
- name: Create Simulator | |
run: | | |
if [[ ! -z ${AVAILABLE_SIMULATORS[@]} ]]; then | |
xcrun simctl create "watchOS Simulator" ${AVAILABLE_SIMULATORS[0]} | |
else | |
echo "No watchOS simulators available." | |
- name: Build package for watchOS | |
run: swift build --product WatchShaker --destination=$(xcrun simctl list | grep "watchOS Simulator" | awk '{print $6}') -c release | |
- name: Test package for watchOS | |
run: swift test --product WatchShakerTests --destination=$(xcrun simctl list | grep "watchOS Simulator" | awk '{print $6}') -c release |