|
| 1 | +name: Swift |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + pull_request: |
| 7 | + branches: [ main ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build_and_test_spm_mac: |
| 11 | + runs-on: macos-11 |
| 12 | + steps: |
| 13 | + - uses: maxim-lobanov/setup-xcode@v1 |
| 14 | + with: |
| 15 | + xcode-version: '13.0' |
| 16 | + - uses: actions/checkout@v2 |
| 17 | + - uses: webfactory/[email protected] |
| 18 | + with: |
| 19 | + ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }} |
| 20 | + - name: Build |
| 21 | + run: swift build |
| 22 | + - name: Run tests |
| 23 | + run: swift test |
| 24 | + |
| 25 | + build_and_test_spm_linux: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + steps: |
| 28 | + - uses: fwal/setup-swift@v1 |
| 29 | + with: |
| 30 | + swift-version: "5.4" |
| 31 | + - uses: actions/checkout@v2 |
| 32 | + - uses: webfactory/[email protected] |
| 33 | + with: |
| 34 | + ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }} |
| 35 | + - name: Build |
| 36 | + run: swift build |
| 37 | + - name: Run tests |
| 38 | + run: swift test --enable-test-discovery |
| 39 | + |
| 40 | + build_and_test_ios: |
| 41 | + runs-on: macos-11 |
| 42 | + steps: |
| 43 | + - uses: maxim-lobanov/setup-xcode@v1 |
| 44 | + with: |
| 45 | + xcode-version: '13.0' |
| 46 | + - uses: actions/checkout@v2 |
| 47 | + - uses: webfactory/[email protected] |
| 48 | + with: |
| 49 | + ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }} |
| 50 | + # Workarounds for Xcode/SPM failing to get packages |
| 51 | + - run: sudo defaults write com.apple.dt.Xcode IDEPackageSupportUseBuiltinSCM YES |
| 52 | + - run: rm ~/.ssh/id_rsa || true |
| 53 | + - run: for ip in $(dig @8.8.8.8 bitbucket.org +short); do ssh-keyscan bitbucket.org,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts || true |
| 54 | + - run: for ip in $(dig @8.8.8.8 github.com +short); do ssh-keyscan github.com,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts || true |
| 55 | + # Xcodebuild will automatically build so no need to call it out specifically. |
| 56 | + - run: xcodebuild -scheme Segment-Package test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 11' |
| 57 | + |
| 58 | + build_and_test_tvos: |
| 59 | + runs-on: macos-11 |
| 60 | + steps: |
| 61 | + - uses: maxim-lobanov/setup-xcode@v1 |
| 62 | + with: |
| 63 | + xcode-version: '13.0' |
| 64 | + - uses: actions/checkout@v2 |
| 65 | + - uses: webfactory/[email protected] |
| 66 | + with: |
| 67 | + ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }} |
| 68 | + # Workarounds for Xcode/SPM failing to get packages |
| 69 | + - run: sudo defaults write com.apple.dt.Xcode IDEPackageSupportUseBuiltinSCM YES |
| 70 | + - run: rm ~/.ssh/id_rsa || true |
| 71 | + - run: for ip in $(dig @8.8.8.8 bitbucket.org +short); do ssh-keyscan bitbucket.org,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts || true |
| 72 | + - run: for ip in $(dig @8.8.8.8 github.com +short); do ssh-keyscan github.com,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts || true |
| 73 | + # Xcodebuild will automatically build so no need to call it out specifically. |
| 74 | + - run: xcodebuild -scheme Segment-Package test -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV' |
| 75 | + |
| 76 | + build_and_test_watchos: |
| 77 | + runs-on: macos-11 |
| 78 | + steps: |
| 79 | + - uses: maxim-lobanov/setup-xcode@v1 |
| 80 | + with: |
| 81 | + xcode-version: '13.0' |
| 82 | + - uses: actions/checkout@v2 |
| 83 | + - uses: webfactory/[email protected] |
| 84 | + with: |
| 85 | + ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }} |
| 86 | + # Workarounds for Xcode/SPM failing to get packages |
| 87 | + - run: sudo defaults write com.apple.dt.Xcode IDEPackageSupportUseBuiltinSCM YES |
| 88 | + - run: rm ~/.ssh/id_rsa || true |
| 89 | + - run: for ip in $(dig @8.8.8.8 bitbucket.org +short); do ssh-keyscan bitbucket.org,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts || true |
| 90 | + - run: for ip in $(dig @8.8.8.8 github.com +short); do ssh-keyscan github.com,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts || true |
| 91 | + # Xcodebuild will automatically build so no need to call it out specifically. |
| 92 | + - run: xcodebuild -scheme Segment-Package test -sdk watchsimulator -destination 'platform=watchOS Simulator,name=Apple Watch Series 5 - 40mm' |
| 93 | + |
| 94 | + build_examples: |
| 95 | + runs-on: macos-11 |
| 96 | + steps: |
| 97 | + - uses: maxim-lobanov/setup-xcode@v1 |
| 98 | + with: |
| 99 | + xcode-version: '13.0' |
| 100 | + - uses: actions/checkout@v2 |
| 101 | + - uses: webfactory/[email protected] |
| 102 | + with: |
| 103 | + ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }} |
| 104 | + # Workarounds for Xcode/SPM failing to get packages |
| 105 | + - run: sudo defaults write com.apple.dt.Xcode IDEPackageSupportUseBuiltinSCM YES |
| 106 | + - run: rm ~/.ssh/id_rsa || true |
| 107 | + - run: for ip in $(dig @8.8.8.8 bitbucket.org +short); do ssh-keyscan bitbucket.org,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts || true |
| 108 | + - run: for ip in $(dig @8.8.8.8 github.com +short); do ssh-keyscan github.com,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts || true |
| 109 | + - name: build for ios simulator |
| 110 | + run: | |
| 111 | + cd Examples/apps/BasicExample |
| 112 | + xcodebuild -workspace "BasicExample.xcworkspace" -scheme "BasicExample" -sdk iphonesimulator |
| 113 | + - name: build for ios simulator |
| 114 | + run: | |
| 115 | + cd Examples/apps/DestinationsExample |
| 116 | + xcodebuild -workspace "DestinationsExample.xcworkspace" -scheme "DestinationsExample" -sdk iphonesimulator |
| 117 | + - name: build for ios simulator |
| 118 | + run: | |
| 119 | + cd Examples/apps/ObjCExample |
| 120 | + xcodebuild -workspace "ObjCExample.xcworkspace" -scheme "ObjCExample" -sdk iphonesimulator |
| 121 | + - name: build for ios simulator |
| 122 | + run: | |
| 123 | + cd Examples/apps/SegmentUIKitExample |
| 124 | + xcodebuild -workspace "SegmentUIKitExample.xcworkspace" -scheme "SegmentUIKitExample" -sdk iphonesimulator |
| 125 | + - name: build for mac catalyst |
| 126 | + run: | |
| 127 | + cd Examples/apps/SegmentUIKitExample |
| 128 | + xcodebuild -workspace "SegmentUIKitExample.xcworkspace" -scheme "SegmentUIKitExample" -destination 'platform=macOS,variant=Mac Catalyst' |
0 commit comments