I'm trying to make a simple workflow using github actons, so when I push for example to my master branch, it builds the code in macOS-latest
and test it on OS 12.4, iPhone 11 Pro Max
.
Since it's very new, the tutorials are not complete, can someone lend me hand?
This is what I have for now:
name: StyleOn_Workflow
on: [push]
jobs:
build:
runs-on: macOS-latest
strategy:
matrix:
destination: ['platform=iOS Simulator,OS=12.4,name=iPhone 11 Pro Max']
steps:
- uses: actions/checkout@master
- name: Build
run: swift build -v
test:
name: Test
runs-on: macOS-latest
strategy:
matrix:
destination: ['platform=iOS Simulator,OS=12.4,name=iPhone 11 Pro Max']
steps:
- name: Checkout
uses: actions/checkout@master
- name: Run tests
run: swift test -v
Also since I'm not deploying the app to the app store, how can I do the deployment phase? Maybe merge it to the master branch? I need to have 3 phases, build, test and deploy
This is the error I'm getting:
Based on your question I think you should use xcodebuild
command line tool instead of swift build
and swift test
.
As I see you should use a command like this for build:
set -o pipefail && xcodebuild clean -scheme $SCHEME -destination $DESTINATION -derivedDataPath $DERIVED_DATA_PATH build-for-testing
And use this for testing:
set -o pipefail && xcodebuild test-without-building -xctestrun $(find . -type f -name "*.xctestrun") -destination "platform=iOS Simulator,name=$DEVICE" -derivedDataPath $DERIVED_DATA_PATH -enableCodeCoverage YES
Please note that between jobs you should upload and download the .xctestrun
file.
You can find a detailed example here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With