iOS 建置與部署流水線
Mobile7 個節點 · 7 條連接mobile
視覺化
ex-ios-build-deploy.osop.yaml
# iOS Build & Deploy Pipeline
# Automates checkout through TestFlight distribution
osop_version: "2.0"
id: ios-build-deploy
name: "iOS 建置與部署流水線"
nodes:
- id: checkout
type: git
purpose: Clone repository and checkout target branch
runtime:
action: checkout
repo: git@github.com:org/ios-app.git
branch: "${BRANCH:-main}"
outputs: [source_dir]
- id: pod_install
type: cli
purpose: Install CocoaPods dependencies
runtime:
os: macos
command: cd ${source_dir} && pod install --repo-update
timeout_sec: 300
explain:
what: Resolves and installs all pod dependencies
why: Ensures reproducible builds with locked dependency versions
- id: build
type: cli
purpose: Build the iOS app archive using xcodebuild
runtime:
os: macos
command: >
xcodebuild -workspace App.xcworkspace
-scheme App -configuration Release
-archivePath build/App.xcarchive archive
timeout_sec: 900
retry_policy:
max_retries: 1
backoff_sec: 30
- id: run_tests
type: cicd
purpose: Execute unit and UI test suites
runtime:
platform: xcode
command: >
xcodebuild test -workspace App.xcworkspace
-scheme AppTests -destination 'platform=iOS Simulator,name=iPhone 15'
timeout_sec: 600
explain:
what: Runs XCTest unit and UI tests on simulator
why: Gate deployment on passing test suite
- id: sign_archive
type: cli
purpose: Sign the archive with distribution certificate
runtime:
os: macos
command: >
xcodebuild -exportArchive
-archivePath build/App.xcarchive
-exportPath build/export
-exportOptionsPlist ExportOptions.plist
security:
credentials: [APPLE_CERT, PROVISIONING_PROFILE]
- id: upload_testflight
type: api
purpose: Upload signed IPA to TestFlight via App Store Connect API
runtime:
endpoint: appstoreconnect
method: POST
url: https://appstoreconnect.apple.com/api/v1/builds
inputs: [signed_ipa_path]
outputs: [build_id]
timeout_sec: 600
- id: notify_team
type: api
purpose: Send Slack notification with build status and TestFlight link
runtime:
endpoint: slack
method: POST
url: https://slack.com/api/chat.postMessage
inputs: [build_id, build_status]
edges:
- from: checkout
to: pod_install
mode: sequential
- from: pod_install
to: build
mode: sequential
- from: build
to: run_tests
mode: sequential
- from: run_tests
to: sign_archive
mode: sequential
- from: sign_archive
to: upload_testflight
mode: sequential
- from: upload_testflight
to: notify_team
mode: sequential
- from: run_tests
to: notify_team
mode: error
condition: tests_failed