-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbitrise.yml
181 lines (170 loc) · 6.92 KB
/
bitrise.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
---
format_version: '11'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: ios
workflows:
deploy:
description: |
The workflow tests, builds and deploys the app using *Deploy to bitrise.io* step.
For testing the *retry_on_failure* test repetition mode is enabled.
Next steps:
- Set up [Connecting to an Apple service with API key](https://devcenter.bitrise.io/en/accounts/connecting-to-services/connecting-to-an-apple-service-with-api-key.html##).
- Or further customise code signing following our [iOS code signing](https://devcenter.bitrise.io/en/code-signing/ios-code-signing.html) guide.
steps:
- git-clone@6: {}
- cache-pull@2: {}
- xcode-test@4:
inputs:
- project_path: "$BITRISE_PROJECT_PATH"
- scheme: "$BITRISE_SCHEME"
- test_repetition_mode: retry_on_failure
- xcode-archive@4:
inputs:
- project_path: "$BITRISE_PROJECT_PATH"
- scheme: "$BITRISE_SCHEME"
- distribution_method: "$BITRISE_DISTRIBUTION_METHOD"
- automatic_code_signing: api-key
- cache-push@2: {}
- deploy-to-bitrise-io@2: {}
primary:
description: |
The workflow executes the tests. The *retry_on_failure* test repetition mode is enabled.
Next steps:
- Check out [Getting started with iOS apps](https://devcenter.bitrise.io/en/getting-started/getting-started-with-ios-apps.html).
steps:
- git-clone@6: {}
- cache-pull@2: {}
- xcode-test@4:
inputs:
- project_path: "$BITRISE_PROJECT_PATH"
- scheme: "$BITRISE_SCHEME"
- test_repetition_mode: retry_on_failure
- cache-push@2: {}
- deploy-to-bitrise-io@2: {}
screenshots:
description: |
The workflow executes the tests. The *retry_on_failure* test repetition mode is enabled.
Next steps:
- Check out [Getting started with iOS apps](https://devcenter.bitrise.io/en/getting-started/getting-started-with-ios-apps.html).
steps:
- git-clone@6: {}
- cache-pull@2: {}
- script@1:
title: Setup Environment Variables
inputs:
- content: |-
#!/bin/bash
set -ex
# Pull any arguments that may have been set from Slack slash commands and such
if [ ! -z "$API_CHARGEPOINT_LANGUAGE" ] ; then
envman add --key CHARGEPOINT_LANGUAGE --value "$API_CHARGEPOINT_LANGUAGE"
fi
if [ ! -z "$API_CHARGEPOINT_UIINTERFACESTYLE" ] ; then
envman add --key CHARGEPOINT_UIINTERFACESTYLE --value "$API_CHARGEPOINT_UIINTERFACESTYLE"
fi
if [ ! -z "$API_CHARGEPOINT_IOS_DEVICE" ] ; then
envman add --key CHARGEPOINT_IOS_DEVICE --value "$API_CHARGEPOINT_IOS_DEVICE"
fi
if [ ! -z "$API_CHARGEPOINT_IOS_DEVICE_LANGUAGE" ] ; then
envman add --key CHARGEPOINT_IOS_DEVICE_LANGUAGE --value "$API_CHARGEPOINT_IOS_DEVICE_LANGUAGE"
fi
if [ ! -z "$API_CHARGEPOINT_IOS_DEVICE_REGION" ] ; then
envman add --key CHARGEPOINT_IOS_DEVICE_REGION --value "$API_CHARGEPOINT_IOS_DEVICE_REGION"
fi
- script@1:
title: Disable Hardware Keyboard in Simulator
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
defaults write com.apple.iphonesimulator ConnectHardwareKeyboard -bool false
- script@1:
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
# Modify the iOS Simulator language before launch
find ~/Library/Developer/CoreSimulator/Devices/* -type d -maxdepth 0 -exec /usr/libexec/PlistBuddy -c "Delete :AppleLanguages" -c "Add :AppleLanguages array" -c "Add :AppleLanguages:0 string $CHARGEPOINT_IOS_DEVICE_LANGUAGE" -c "Delete :AppleLocale" -c "Add :AppleLocale string $CHARGEPOINT_IOS_DEVICE_REGION" {}/data/Library/Preferences/.GlobalPreferences.plist \;
title: Modify Simulator Language before Launch
- script@1:
title: Set UIUserInterfaceStyle
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
# Works on device & Simulator (affects only app) - Set the app's Info.plist to the style we want
#/usr/libexec/PlistBuddy -c 'Add :UIUserInterfaceStyle string "$CHARGEPOINT_UIINTERFACESTYLE"' bitrise-screenshot-automation/Info.plist
# Works on Simulator (affects whole device) - Modifies a system plist directly to work on Xcode 11.0 to Xcode 11.3
if [ "$CHARGEPOINT_UIINTERFACESTYLE" = "Dark" ]
then
echo "Setting Dark mode"
style=2
elif [ "$CHARGEPOINT_UIINTERFACESTYLE" = "Light" ]
then
echo "Setting Light mode"
style=1
fi
find ~/Library/Developer/CoreSimulator/Devices/* -type d -maxdepth 0 -exec /usr/libexec/PlistBuddy -c "Delete :UserInterfaceStyleMode" -c "Add :UserInterfaceStyleMode integer $style" {}/data/Library/Preferences/com.apple.uikitservices.userInterfaceStyleMode.plist \;
- xcode-test@4:
inputs:
- project_path: "$BITRISE_PROJECT_PATH"
- scheme: "$BITRISE_SCHEME"
- test_plan: Screenshots
- destination: platform=iOS Simulator,name=$CHARGEPOINT_IOS_DEVICE,OS=latest
- xcodebuild_options: "-only-test-configuration $CHARGEPOINT_IOS_DEVICE_LANGUAGE"
- test_repetition_mode: retry_on_failure
- xcparse@0:
is_always_run: true
- script@1:
title: Attached screenshots directly
inputs:
- content: |-
#!/usr/bin/env bash
echo "$XCPARSE_SCREENSHOTS_PATH"
mkdir /tmp/workflow_screenshots
unzip "$XCPARSE_SCREENSHOTS_PATH" -d /tmp/workflow_screenshots
find /tmp/workflow_screenshots -type f \( -iname \*.jpg -o -iname \*.png \) -exec cp {} $BITRISE_DEPLOY_DIR \;
- deploy-to-bitrise-io@2: {}
meta:
bitrise.io:
stack: osx-xcode-14.1.x
app:
envs:
- opts:
is_expand: false
BITRISE_PROJECT_PATH: bitrise-screenshot-automation.xcodeproj
- opts:
is_expand: false
BITRISE_SCHEME: bitrise-screenshot-automation
- opts:
is_expand: false
BITRISE_DISTRIBUTION_METHOD: development
- opts:
is_expand: false
CHARGEPOINT_IOS_DEVICE: iPhone 11 Pro Max
- opts:
is_expand: false
CHARGEPOINT_IOS_DEVICE_LANGUAGE: en
- opts:
is_expand: false
CHARGEPOINT_IOS_DEVICE_REGION: en_US
- opts:
is_expand: false
CHARGEPOINT_UIINTERFACESTYLE: Dark
- opts:
is_expand: false
CHARGEPOINT_LANGUAGE: en
trigger_map:
- push_branch: "*"
workflow: screenshots
- pull_request_source_branch: "*"
workflow: primary