Last active
May 30, 2021 17:31
-
-
Save behdaad/8a7efc0aad2d913c1539d4c8d3532cb6 to your computer and use it in GitHub Desktop.
GitLab CI/CD for Xcode Projects/Workspaces
This file contains 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
variables: | |
GIT_STRATEGY: fetch | |
DEBUG_SCHEME: Debug | |
PRODUCTION_SCHEME: Production | |
stages: | |
- test | |
- danger | |
- archive | |
test_project: | |
stage: test | |
only: | |
- merge_requests | |
script: | |
- xcodebuild ONLY_ACTIVE_ARCH=YES -workspace Workspace.xcworkspace -scheme $PRODUCTION_SCHEME clean test -destination 'platform=iOS Simulator,name=iPhone 12 Pro,OS=14.5' | xcpretty && exit ${PIPESTATUS[0]} | |
danger_project: | |
stage: danger | |
only: | |
- merge_requests | |
script: | |
- export DANGER_GITLAB_HOST="gitlab.com" | |
- export DANGER_GITLAB_API_BASE_URL="https://gitlab.com/api/v4" | |
- export DANGER_GITLAB_API_TOKEN=$DANGER_GITLAB_API_TOKEN | |
- danger --fail-on-errors=true | |
archive_debug_project: | |
stage: archive | |
script: | |
- xcodebuild archive -workspace Workspace.xcworkspace -scheme $DEBUG_SCHEME -archivePath outputs/Archives/Project_$DEBUG_SCHEME.xcarchive -allowProvisioningUpdates | xcpretty | |
- xcodebuild -exportArchive -archivePath outputs/Archives/Project_$DEBUG_SCHEME.xcarchive -exportPath outputs/IPAs -exportOptionsPlist ~/Developer/Project/ExportOptions.plist -allowProvisioningUpdates | xcpretty | |
only: | |
- merge_requests | |
artifacts: | |
paths: | |
- outputs/IPAs | |
expire_in: never | |
archive_production_project: | |
stage: archive | |
script: | |
- xcodebuild archive -workspace Workspace.xcworkspace -scheme $PRODUCTION_SCHEME -archivePath outputs/Archives/Project_$PRODUCTION_SCHEME.xcarchive -allowProvisioningUpdates | xcpretty | |
- xcodebuild -exportArchive -archivePath outputs/Archives/Project_$PRODUCTION_SCHEME.xcarchive -exportPath outputs/IPAs -exportOptionsPlist ~/Developer/Project/ExportOptions.plist -allowProvisioningUpdates | xcpretty | |
when: manual | |
only: | |
- rc | |
- merge_requests | |
artifacts: | |
paths: | |
- outputs/IPAs | |
expire_in: never |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment