-
Notifications
You must be signed in to change notification settings - Fork 1
/
bitrise.yml
202 lines (192 loc) · 7.2 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
---
format_version: '8'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: ios
trigger_map:
- push_branch: "*"
workflow: primary
- pull_request_source_branch: "*"
workflow: primary
workflows:
primary:
steps:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- [email protected]: {}
- [email protected]: {}
- git::https://github.com/DamienBitrise/bitrise-test-plan-sharder.git@master:
title: Bitrise Test Plan Sharder
inputs:
- xcode_project: Notes.xcodeproj
- target: NotesUITests
- shards: '2'
- scheme: Notes
- file_type: ".swift"
inputs:
- content: |
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
ls
echo "START"
cat TestShard_0.xctestplan
cat TestShard_1.xctestplan
echo "DONE"
title: Log Generated Test Plans
title: Build for Testing
inputs:
- content: |
set -euxo pipefail
echo "-- build-for-testing --"
mkdir DerivedData
xcodebuild \
-scheme "Notes" \
-workspace "Notes.xcworkspace" \
-sdk iphonesimulator \
-destination "platform=iOS Simulator,name=iPhone 8,OS=latest" \
-derivedDataPath "${BITRISE_SOURCE_DIR}/DerivedData" \
build-for-testing
title: Compress Derived Data
is_always_run: true
inputs:
- content: "set -euxo pipefail\necho \"-- compress --\"\n\nFILE=${BITRISE_SOURCE_DIR}/DerivedData/info.plist\nif
[ -f \"$FILE\" ]; then\n echo \"$FILE exist\"\n exec zip -qr \\\n
\ \"${BITRISE_SOURCE_DIR}/DerivedData.zip\" \\\n \"${BITRISE_SOURCE_DIR}/DerivedData\"\nelse
\n echo \"$FILE does not exist\"\nfi\n"
inputs:
- cache_paths: |-
$BITRISE_SOURCE_DIR/DerivedData.zip
$BITRISE_SOURCE_DIR/DerivedData/Build/Products/Debug-iphonesimulator/Notes.app
$BITRISE_SOURCE_DIR/DerivedData/Build/Products/Debug-iphonesimulator/NotesUITests-Runner.app
$BITRISE_SOURCE_DIR/Notes.xcworkspace
$BITRISE_SOURCE_DIR/Notes.xcodeproj
$BITRISE_SOURCE_DIR/TestShard_0.xctestplan
$BITRISE_SOURCE_DIR/TestShard_1.xctestplan
- is_debug_mode: 'true'
inputs:
- access_token: "$BITRISE_API_KEY"
- environment_key_list: "$BITRISE_BUILD_SLUG"
- workflows: |-
tests_1
tests_2
title: Install Trainer
inputs:
- content: |-
#!/usr/bin/env bash
set -euxo pipefail
gem install trainer -v "0.9.1" --no-document
inputs:
- access_token: "$BITRISE_API_KEY"
- git::https://github.com/DamienBitrise/bitrise-collect-artifacts.git@master:
title: Bitrise Collect Artifacts
inputs:
- save_path: "/tmp/"
- access_token: "$BITRISE_API_KEY"
title: Deploy Artifacts
inputs:
- content: "#!/usr/bin/env bash\nset -euxo pipefail\n\necho \"==== MOVE FILES
TO DEPLOY DIR ====\"\n\necho $BITRISE_ARTIFACTS_SAVE_PATH\n\ncd $BITRISE_ARTIFACTS_SAVE_PATH\n\nFILES=`pwd`/*\nMYDIR=`pwd`/tmp/Users/vagrant/git/xcodebuild.xcresult\necho
$MYDIR\n\ni=1\n\nfor f in $FILES\ndo\n if [ \"${f: -4}\" = \".zip\" ];
then\n echo \"Processing $f\"\n\n rm -f -r tmp\n mkdir tmp\n
\ unzip \"TestResults${i}.zip\" -d tmp\n\n echo \"--Trainer--\"\n\n
\ mkdir \"${BITRISE_TEST_RESULT_DIR}/test_${i}\"\n\n trainer \\\n
\ --path \"${MYDIR}\" \\\n --output_directory \"${BITRISE_TEST_RESULT_DIR}/test_${i}\"
\\\n || :\n\n export FAILED_REASON=\n echo \\\n \"{ \\\"test-name\\\":
\\\"Tests ${i}\\\" }\" > \\\n \"${BITRISE_TEST_RESULT_DIR}/test_${i}/test-info.json\"\n\n
\ ((i++))\n \n fi\ndone"
- [email protected]: {}
before_run: []
tests_1:
steps:
inputs:
- is_debug_mode: 'true'
title: Unzip Derived Data
inputs:
- content: |-
set -euxo pipefail
echo "-- unzip -- "
exec unzip \
"${BITRISE_SOURCE_DIR}/DerivedData.zip"
title: Test without Building
inputs:
- content: "#!/usr/bin/env bash\n# fail if any commands fails\nset -e\n# debug
log\nset -x\n\n# write your script here\necho \"-- test-without-building
--\"\n\nxcodebuild \\\n-workspace \"Notes.xcworkspace\" \\\n-scheme \"Notes\"
\\\n-sdk iphonesimulator \\\n-destination \"platform=iOS Simulator,name=iPhone
8,OS=latest\" \\\n-resultBundlePath \"xcodebuild.xcresult\" \\\n-derivedDataPath
\"/Users/vagrant/git/DerivedData\" \\\n-testPlan \"TestShard_0\" \\\ntest-without-building
\n"
title: Compress Result Bundle
is_always_run: true
inputs:
- content: |-
set -euxo pipefail
echo "-- compress --"
cd "${BITRISE_DEPLOY_DIR}/"
ls
exec zip -qr \
"${BITRISE_DEPLOY_DIR}/TestResults1.zip" \
"/Users/vagrant/git/xcodebuild.xcresult"
- [email protected]: {}
before_run: []
tests_2:
steps:
- cache-pull:
inputs:
- is_debug_mode: 'true'
title: Unzip Derived Data
inputs:
- content: |-
set -euxo pipefail
echo "-- unzip -- "
exec unzip \
"${BITRISE_SOURCE_DIR}/DerivedData.zip"
title: Test without Building
inputs:
- content: "#!/usr/bin/env bash\n# fail if any commands fails\nset -e\n# debug
log\nset -x \n\n# write your script here\necho \"-- test-without-building
--\"\n\nxcodebuild \\\n-workspace \"Notes.xcworkspace\" \\\n-scheme \"Notes\"
\\\n-sdk iphonesimulator \\\n-destination \"platform=iOS Simulator,name=iPhone
8,OS=latest\" \\\n-resultBundlePath \"xcodebuild.xcresult\" \\\n-derivedDataPath
\"/Users/vagrant/git/DerivedData\" \\\n-testPlan \"TestShard_1\" \\\ntest-without-building
\n"
- script:
title: Compress Result Bundle
is_always_run: true
inputs:
- content: |-
set -euxo pipefail
echo "-- compress --"
cd "${BITRISE_DEPLOY_DIR}/"
ls
exec zip -qr \
"${BITRISE_DEPLOY_DIR}/TestResults2.zip" \
"/Users/vagrant/git/xcodebuild.xcresult"
- deploy-to-bitrise-io: {}
app:
envs:
- opts:
is_expand: false
BITRISE_PROJECT_PATH: Notes.xcworkspace
- opts:
is_expand: false
BITRISE_SCHEME: Notes
- opts:
is_expand: false
BITRISE_EXPORT_METHOD: development