|
| 1 | +name: Xcode Project |
| 2 | +on: [push, workflow_dispatch] |
| 3 | + |
| 4 | +jobs: |
| 5 | + ios: |
| 6 | + name: iOS |
| 7 | + runs-on: macOS-latest |
| 8 | + |
| 9 | + steps: |
| 10 | + - name: Checkout Code |
| 11 | + uses: actions/checkout@v2 |
| 12 | + |
| 13 | + - name: Build iOS |
| 14 | + run: | |
| 15 | + xcodebuild -project CBORCoding.xcodeproj -scheme "CBORCoding" -destination "generic/platform=iOS" -configuration Debug |
| 16 | +
|
| 17 | + - name: Build iOS Simulator |
| 18 | + run: | |
| 19 | + xcodebuild -project CBORCoding.xcodeproj -scheme "CBORCoding" -destination "generic/platform=iOS Simulator" -configuration Debug |
| 20 | +
|
| 21 | + - name: Test |
| 22 | + run: | |
| 23 | + IOS_SIM="$(xcrun simctl list devices available | grep "iPhone [0-9]" | sort -rV | head -n 1 | sed -E 's/(.+)[ ]*\([^)]*\)[ ]*\([^)]*\)/\1/' | awk '{$1=$1};1')" |
| 24 | + if [ "${#IOS_SIM}" == "0" ]; then |
| 25 | + IOS_SIM = "iPhone 12 Pro" # Fallback Simulator |
| 26 | + fi |
| 27 | +
|
| 28 | + xcodebuild -project CBORCoding.xcodeproj -scheme "CBORCoding" -testPlan "CBORCodingTests" -destination "platform=iOS Simulator,name=$IOS_SIM" -configuration Debug ONLY_ACTIVE_ARCH=YES test |
| 29 | +
|
| 30 | + maccatalyst: |
| 31 | + name: Mac Catalyst |
| 32 | + runs-on: macOS-latest |
| 33 | + |
| 34 | + steps: |
| 35 | + - name: Checkout Code |
| 36 | + uses: actions/checkout@v2 |
| 37 | + |
| 38 | + - name: Build |
| 39 | + run: | |
| 40 | + xcodebuild -project CBORCoding.xcodeproj -scheme "CBORCoding" -destination "generic/platform=macOS,variant=Mac Catalyst" -configuration Debug |
| 41 | +
|
| 42 | + - name: Test |
| 43 | + run: | |
| 44 | + xcodebuild -project CBORCoding.xcodeproj -scheme "CBORCoding" -testPlan "CBORCodingTests" -destination "platform=macOS,variant=Mac Catalyst" -configuration Debug ONLY_ACTIVE_ARCH=YES test |
| 45 | +
|
| 46 | + macos: |
| 47 | + name: macOS |
| 48 | + runs-on: macOS-latest |
| 49 | + |
| 50 | + steps: |
| 51 | + - name: Checkout Code |
| 52 | + uses: actions/checkout@v2 |
| 53 | + |
| 54 | + - name: Build |
| 55 | + run: | |
| 56 | + xcodebuild -project CBORCoding.xcodeproj -scheme "CBORCoding macOS" -destination "generic/platform=macOS" -configuration Debug |
| 57 | +
|
| 58 | + - name: Test |
| 59 | + run: | |
| 60 | + xcodebuild -project CBORCoding.xcodeproj -scheme "CBORCoding macOS" -testPlan "CBORCoding macOS Tests" -configuration Debug ONLY_ACTIVE_ARCH=YES test |
| 61 | +
|
| 62 | + tvos: |
| 63 | + name: tvOS |
| 64 | + runs-on: macOS-latest |
| 65 | + |
| 66 | + steps: |
| 67 | + - name: Checkout Code |
| 68 | + uses: actions/checkout@v2 |
| 69 | + |
| 70 | + - name: Build tvOS |
| 71 | + run: | |
| 72 | + xcodebuild -project CBORCoding.xcodeproj -scheme "CBORCoding tvOS" -destination "generic/platform=tvOS" -configuration Debug |
| 73 | +
|
| 74 | + - name: Build tvOS Simulator |
| 75 | + run: | |
| 76 | + xcodebuild -project CBORCoding.xcodeproj -scheme "CBORCoding tvOS" -destination "generic/platform=tvOS Simulator" -configuration Debug |
| 77 | +
|
| 78 | + - name: Test |
| 79 | + run: | |
| 80 | + TVOS_SIM="$(xcrun simctl list devices available | grep "Apple TV" | sort -V | head -n 1 | sed -E 's/(.+)[ ]*\([^)]*\)[ ]*\([^)]*\)/\1/' | awk '{$1=$1};1')" |
| 81 | + if [ "${#TVOS_SIM}" == "0" ]; then |
| 82 | + TVOS_SIM = "Apple TV" # Fallback Simulator |
| 83 | + fi |
| 84 | +
|
| 85 | + xcodebuild -project CBORCoding.xcodeproj -scheme "CBORCoding tvOS" -testPlan "CBORCoding tvOS Tests" -destination "platform=tvOS Simulator,name=$TVOS_SIM" -configuration Debug ONLY_ACTIVE_ARCH=YES test |
| 86 | +
|
| 87 | + watchos: |
| 88 | + name: watchOS |
| 89 | + runs-on: macOS-11 |
| 90 | + |
| 91 | + steps: |
| 92 | + - name: Checkout Code |
| 93 | + uses: actions/checkout@v2 |
| 94 | + |
| 95 | + - name: Build watchOS |
| 96 | + run: | |
| 97 | + xcodebuild -project CBORCoding.xcodeproj -scheme "CBORCoding watchOS" -destination "generic/platform=watchOS" -configuration Debug |
| 98 | +
|
| 99 | + - name: Build watchOS Simulator |
| 100 | + run: | |
| 101 | + xcodebuild -project CBORCoding.xcodeproj -scheme "CBORCoding watchOS" -destination "generic/platform=watchOS Simulator" -configuration Debug |
| 102 | +
|
| 103 | + - name: Test |
| 104 | + run: | |
| 105 | + WATCHOS_SIM="$(xcrun simctl list devices available | grep "Apple Watch" | sort -rV | head -n 1 | sed -E 's/(.+)[ ]*\([^)]*\)[ ]*\([^)]*\)/\1/' | awk '{$1=$1};1')" |
| 106 | + if [ "${#WATCHOS_SIM}" == "0" ]; then |
| 107 | + WATCHOS_SIM = "Apple Watch Series 6 - 44mm" # Fallback Simulator |
| 108 | + fi |
| 109 | +
|
| 110 | + xcodebuild -project CBORCoding.xcodeproj -scheme "CBORCoding watchOS" -testPlan "CBORCoding watchOS Tests" -destination "platform=watchOS Simulator,name=$WATCHOS_SIM" -configuration Debug ONLY_ACTIVE_ARCH=YES test |
0 commit comments