diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 619448ea..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,148 +0,0 @@ -version: 2.1 -jobs: - build_and_test_spm_mac: - macos: - xcode: "12.5.0" - resource_class: m2.medium - steps: - - checkout - - run: swift build - - run: swift test - # Collect XML test results data to show in the UI, and save the same XML - # files under test-results folder in the Artifacts tab - - store_test_results: - path: test_output - - store_artifacts: - path: test_output - destination: scan-output - build_and_test_spm_linux: - docker: - # See images here: https://hub.docker.com/r/norionomura/swift/ - - image: norionomura/swift:54 - steps: - - checkout - - run: swift build - - run: swift test --enable-test-discovery - # Collect XML test results data to show in the UI, and save the same XML - # files under test-results folder in the Artifacts tab - - store_test_results: - path: test_output - - store_artifacts: - path: test_output - destination: scan-output - build_and_test_ios: - macos: - xcode: "12.5.0" - resource_class: m2.medium - steps: - - checkout - # Workarounds for Xcode/SPM failing to get packages - - run: sudo defaults write com.apple.dt.Xcode IDEPackageSupportUseBuiltinSCM YES - - run: rm ~/.ssh/id_rsa || true - - 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 - - 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 - # Xcodebuild will automatically build so no need to call it out specifically. - - run: xcodebuild -scheme Segment-Package test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 11' - # Collect XML test results data to show in the UI, and save the same XML - # files under test-results folder in the Artifacts tab - - store_test_results: - path: test_output - - store_artifacts: - path: test_output - destination: scan-output - build_and_test_tvos: - macos: - xcode: "12.5.0" - resource_class: m2.medium - steps: - - checkout - # Workarounds for Xcode/SPM failing to get packages - - run: sudo defaults write com.apple.dt.Xcode IDEPackageSupportUseBuiltinSCM YES - - run: rm ~/.ssh/id_rsa || true - - 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 - - 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 - # Xcodebuild will automatically build so no need to call it out specifically. - - run: xcodebuild -scheme Segment-Package test -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV' - # Collect XML test results data to show in the UI, and save the same XML - # files under test-results folder in the Artifacts tab - - store_test_results: - path: test_output - - store_artifacts: - path: test_output - destination: scan-output - build_and_test_watchos: - macos: - xcode: "12.5.0" - resource_class: m2.medium - steps: - - checkout - # Workarounds for Xcode/SPM failing to get packages - - run: sudo defaults write com.apple.dt.Xcode IDEPackageSupportUseBuiltinSCM YES - - run: rm ~/.ssh/id_rsa || true - - 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 - - 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 - # Xcodebuild will automatically build so no need to call it out specifically. - - run: xcodebuild -scheme Segment-Package test -sdk watchsimulator -destination 'platform=watchOS Simulator,name=Apple Watch Series 5 - 40mm' - # Collect XML test results data to show in the UI, and save the same XML - # files under test-results folder in the Artifacts tab - - store_test_results: - path: test_output - - store_artifacts: - path: test_output - destination: scan-output - build_examples: - macos: - xcode: "12.5.0" - resource_class: m2.medium - steps: - - checkout - # Workarounds for Xcode/SPM failing to get packages - - run: sudo defaults write com.apple.dt.Xcode IDEPackageSupportUseBuiltinSCM YES - - run: rm ~/.ssh/id_rsa || true - - 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 - - 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 - - run: - # build for ios simulator - command: | - cd Examples/apps/BasicExample - xcodebuild -workspace "BasicExample.xcworkspace" -scheme "BasicExample" -sdk iphonesimulator - - run: - # build for ios simulator - command: | - cd Examples/apps/DestinationsExample - xcodebuild -workspace "DestinationsExample.xcworkspace" -scheme "DestinationsExample" -sdk iphonesimulator - - run: - # build for ios simulator - command: | - cd Examples/apps/ObjCExample - xcodebuild -workspace "ObjCExample.xcworkspace" -scheme "ObjCExample" -sdk iphonesimulator - - run: - # build for ios simulator - command: | - cd Examples/apps/SegmentUIKitExample - xcodebuild -workspace "SegmentUIKitExample.xcworkspace" -scheme "SegmentUIKitExample" -sdk iphonesimulator - - run: - # build for mac catalyst - command: | - cd Examples/apps/SegmentUIKitExample - xcodebuild -workspace "SegmentUIKitExample.xcworkspace" -scheme "SegmentUIKitExample" -destination 'platform=macOS,variant=Mac Catalyst' - # Collect XML test results data to show in the UI, and save the same XML - # files under test-results folder in the Artifacts tab - - store_test_results: - path: test_output - - store_artifacts: - path: test_output - destination: scan-output -workflows: - version: 2 - build_and_test: - jobs: - - build_and_test_spm_mac - - build_and_test_spm_linux - - build_and_test_ios - - build_and_test_tvos - - build_and_test_watchos - - build_examples - - - diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml new file mode 100644 index 00000000..fa5c4090 --- /dev/null +++ b/.github/workflows/swift.yml @@ -0,0 +1,128 @@ +name: Swift + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build_and_test_spm_mac: + runs-on: macos-11 + steps: + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '13.0' + - uses: actions/checkout@v2 + - uses: webfactory/ssh-agent@v0.5.3 + with: + ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }} + - name: Build + run: swift build + - name: Run tests + run: swift test + + build_and_test_spm_linux: + runs-on: ubuntu-latest + steps: + - uses: fwal/setup-swift@v1 + with: + swift-version: "5.4" + - uses: actions/checkout@v2 + - uses: webfactory/ssh-agent@v0.5.3 + with: + ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }} + - name: Build + run: swift build + - name: Run tests + run: swift test --enable-test-discovery + + build_and_test_ios: + runs-on: macos-11 + steps: + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '13.0' + - uses: actions/checkout@v2 + - uses: webfactory/ssh-agent@v0.5.3 + with: + ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }} + # Workarounds for Xcode/SPM failing to get packages + - run: sudo defaults write com.apple.dt.Xcode IDEPackageSupportUseBuiltinSCM YES + - run: rm ~/.ssh/id_rsa || true + - 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 + - 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 + # Xcodebuild will automatically build so no need to call it out specifically. + - run: xcodebuild -scheme Segment-Package test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 11' + + build_and_test_tvos: + runs-on: macos-11 + steps: + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '13.0' + - uses: actions/checkout@v2 + - uses: webfactory/ssh-agent@v0.5.3 + with: + ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }} + # Workarounds for Xcode/SPM failing to get packages + - run: sudo defaults write com.apple.dt.Xcode IDEPackageSupportUseBuiltinSCM YES + - run: rm ~/.ssh/id_rsa || true + - 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 + - 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 + # Xcodebuild will automatically build so no need to call it out specifically. + - run: xcodebuild -scheme Segment-Package test -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV' + + build_and_test_watchos: + runs-on: macos-11 + steps: + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '13.0' + - uses: actions/checkout@v2 + - uses: webfactory/ssh-agent@v0.5.3 + with: + ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }} + # Workarounds for Xcode/SPM failing to get packages + - run: sudo defaults write com.apple.dt.Xcode IDEPackageSupportUseBuiltinSCM YES + - run: rm ~/.ssh/id_rsa || true + - 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 + - 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 + # Xcodebuild will automatically build so no need to call it out specifically. + - run: xcodebuild -scheme Segment-Package test -sdk watchsimulator -destination 'platform=watchOS Simulator,name=Apple Watch Series 5 - 40mm' + + build_examples: + runs-on: macos-11 + steps: + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '13.0' + - uses: actions/checkout@v2 + - uses: webfactory/ssh-agent@v0.5.3 + with: + ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }} + # Workarounds for Xcode/SPM failing to get packages + - run: sudo defaults write com.apple.dt.Xcode IDEPackageSupportUseBuiltinSCM YES + - run: rm ~/.ssh/id_rsa || true + - 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 + - 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 + - name: build for ios simulator + run: | + cd Examples/apps/BasicExample + xcodebuild -workspace "BasicExample.xcworkspace" -scheme "BasicExample" -sdk iphonesimulator + - name: build for ios simulator + run: | + cd Examples/apps/DestinationsExample + xcodebuild -workspace "DestinationsExample.xcworkspace" -scheme "DestinationsExample" -sdk iphonesimulator + - name: build for ios simulator + run: | + cd Examples/apps/ObjCExample + xcodebuild -workspace "ObjCExample.xcworkspace" -scheme "ObjCExample" -sdk iphonesimulator + - name: build for ios simulator + run: | + cd Examples/apps/SegmentUIKitExample + xcodebuild -workspace "SegmentUIKitExample.xcworkspace" -scheme "SegmentUIKitExample" -sdk iphonesimulator + - name: build for mac catalyst + run: | + cd Examples/apps/SegmentUIKitExample + xcodebuild -workspace "SegmentUIKitExample.xcworkspace" -scheme "SegmentUIKitExample" -destination 'platform=macOS,variant=Mac Catalyst'