Created
October 15, 2020 22:26
-
-
Save mattrighetti/5e1477fd6ebdf6a31f4b00ca6ac1b548 to your computer and use it in GitHub Desktop.
A simple GitHub Action workflow that runs tests for the specified application
This file contains hidden or 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: iOS Test Workflow | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| jobs: | |
| build: | |
| name: Build and Test default scheme using iPhone/iPad simulator | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v2 | |
| - name: Force Xcode 11 | |
| run: sudo xcode-select -switch /Applications/Xcode_11.7.app | |
| - name: iOS build setup | |
| run: >- | |
| xcodebuild test -workspace TestApp.xcodeproj/project.xcworkspace | |
| -scheme TestApp -destination 'platform=iOS Simulator,name=iPhone | |
| 11,OS=13.7' | |
| - name: testing ... iPhone 11 | |
| run: >- | |
| xcodebuild test -workspace TestApp.xcodeproj/project.xcworkspace | |
| -scheme TestApp -destination 'platform=iOS Simulator,name=iPhone | |
| 11,OS=13.7' | |
| - name: testing ... iPhone 11 Pro Max | |
| run: >- | |
| xcodebuild test -workspace TestApp.xcodeproj/project.xcworkspace | |
| -scheme TestApp -destination 'platform=iOS Simulator,name=iPhone 11 | |
| Pro Max,OS=13.7' | |
| - name: testing ... iPad Air | |
| run: >- | |
| xcodebuild test -workspace TestApp.xcodeproj/project.xcworkspace | |
| -scheme TestApp -destination 'platform=iOS Simulator,name=iPad Air | |
| (3rd generation),OS=13.7' | |
| - name: testing ... iPad Pro 12.9 | |
| run: >- | |
| xcodebuild test -workspace TestApp.xcodeproj/project.xcworkspace | |
| -scheme TestApp -destination 'platform=iOS Simulator,name=iPad Pro (12.9-inch) (4th generation),OS=13.7' |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
XCTest GitHub Action Workflow
This snippet of code is a simple and easy introduction to CI automation of XCTests on GitHub Actions
Workflow definition
From line 1–8 we’re giving a name to the workflow itself and we’re instructing that it should run every time there is a push to the master branch or a pull-request has been issued on the master branch. You can add more branches or customise when you want it to run, you can checkout all the possible events you have in the GH Actions docs.
Workflow job
From line 9–41 you’re defining what actually is going to be your workflow, in this snippet I’m keeping stuff simple but you can define more jobs to run on the events specified from line 1–5, more on GH Actions docs.
As you can see I’m calling the job “build” and I’m instructing that it should run on a macOS operating system. Immediately after that I’m defining 5 different steps that will test my code on 5 different iOS devices, the core command here is
This command is going to test all my code contained in my test suite on an iPad Air simulator.