-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcodemagic.yaml
More file actions
246 lines (246 loc) · 7.82 KB
/
codemagic.yaml
File metadata and controls
246 lines (246 loc) · 7.82 KB
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
workflows:
publish-ios-qa:
name: Publish iOS QA
max_build_duration: 60
environment:
groups:
- app_store
- app_store_credentials
- match
flutter: 3.13.0
xcode: 14.3
cocoapods: default
cache:
cache_paths:
- $FLUTTER_ROOT/.pub-cache # Dart cache
- $HOME/Library/Caches/CocoaPods # CocoaPods cache
triggering:
events:
# publish only tagged commits to main:
- tag
branch_patterns:
- pattern: main
include: true
source: false
scripts:
- &increment_testflight_build_number
name: Get the latest build number
script: |
VERSION_NUMBER=$(grep -o 'version: [0-9]\+\.[0-9]\+\.[0-9]\+' pubspec.yaml | awk '{print $2}')
echo "Version number from pubspec.yaml: $VERSION_NUMBER"
LATEST_BUILD_NUMBER=$(
app-store-connect get-latest-testflight-build-number $APP_APPLE_ID \
--pre-release-version $VERSION_NUMBER
);
cd ./ios;
agvtool new-version -all $(($LATEST_BUILD_NUMBER + 1));
BUILD_NUMBER=$(
app-store-connect get-latest-testflight-build-number $APP_APPLE_ID \
--pre-release-version $VERSION_NUMBER
);
#!/bin/sh;
set -ex;
printenv
ignore_failure: false
- &build_ios_app
name: Build iOS app
script: |
bundle install
bundle exec fastlane setup_keychain
find . -name "Podfile" -execdir pod install \;
sh ci/build_ios_qa.sh
artifacts:
- build/ios/ipa/*.ipa
- ./*.ipa
- /tmp/xcodebuild_logs/*.log
- flutter_drive.log
publishing:
email:
recipients:
- ripplearc@gmail.com
publish-qa-android:
name: Publish Android QA
max_build_duration: 60
environment:
groups:
- google_play
- keystore_credentials
flutter: 3.13.0
cache:
cache_paths: [ ]
triggering:
events:
# publish only tagged commits to main:
- tag
branch_patterns:
- pattern: main
include: true
source: false
scripts:
- &set_up_key_store_and_properties
name: Set up release keystore, key.properties, local.properties
script: |
echo $GOOGLE_PLAY_JSON | base64 --decode > google_play.json
echo $ANDROID_KEYSTORE | base64 --decode > "$FCI_BUILD_DIR/android/app/randomword-release.keystore"
echo $ANDROID_KEY_PROPERTIES | base64 --decode > "$FCI_BUILD_DIR/android/key.properties"
echo "flutter.sdk=$HOME/programs/flutter" > "$FCI_BUILD_DIR/android/local.properties"
- &increment_google_play_build_number_and_build_android_app
name: Build the release app with the latest build number from Google Play
script: |
LATEST_GOOGLE_PLAY_BUILD_NUMBER=$(google-play get-latest-build-number --package-name 'com.ripplearc.composerandomwords' --verbose)
echo INCREMENT_GOOGLE_PLAY_BUILD_NUMBER: $INCREMENT_GOOGLE_PLAY_BUILD_NUMBER
bundle install
bundle exec fastlane android deploy build_number:$((LATEST_GOOGLE_PLAY_BUILD_NUMBER+1))
artifacts:
- build/**/outputs/**/*.apk
- build/**/outputs/**/*.aab
- build/**/outputs/**/mapping.txt
- /tmp/xcodebuild_logs/*.log
- flutter_drive.log
publishing:
email:
recipients:
- ripplearc@gmail.com
publish-qa:
name: Publish QA
max_build_duration: 60
environment:
groups:
- match
- app_store
- app_store_credentials
- google_play
- keystore_credentials
flutter: 3.13.0
xcode: 14.3
cocoapods: default
cache:
cache_paths: [ ]
triggering:
events:
# publish only tagged commits to main:
- tag
branch_patterns:
- pattern: main
include: true
source: false
scripts:
- *set_up_key_store_and_properties
- *increment_google_play_build_number_and_build_android_app
- *increment_testflight_build_number
- *build_ios_app
artifacts:
- build/**/outputs/**/*.apk
- build/**/outputs/**/*.aab
- build/**/outputs/**/mapping.txt
- build/ios/ipa/*.ipa
- ./*.ipa
- /tmp/xcodebuild_logs/*.log
- flutter_drive.log
publishing:
email:
recipients:
- ripplearc@gmail.com
unit-widget-golden-tests:
name: Unit, Widget & Golden Tests
max_build_duration: 60
environment:
groups:
- codecov
- codecov_credentials
flutter: 3.13.0
xcode: 14.3
cocoapods: default
cache:
cache_paths: [ ]
triggering:
events:
# test each PR to main:
- pull_request
branch_patterns:
- pattern: main
include: true
source: false
scripts:
- |
# set up local properties
echo "flutter.sdk=$HOME/programs/flutter" > "$FCI_BUILD_DIR/android/local.properties"
- &run_unit_tests
name: Run unit, widget, and golden tests
script: |
mkdir -p test-results
bundle install
bundle exec fastlane run_unit_widget_golden_tests \
test_report_path:test-results/unit_tests.json \
code_coverage_target:$CODE_COVERAGE_TARGET \
codecov_token:$CODECOV_TOKEN \
incremental_code_coverage_target:$INCREMENTAL_CODE_COVERAGE_TARGET \
lcov_info_path:coverage/lcov.info
test_report: test-results/unit_tests.json
publishing:
email:
recipients:
- ripplearc@gmail.com
artifacts:
- test/golden/**/failures/*.png
integration-tests:
### How to run code coverage?
### Combine iOS and Web tests into one workflow because the Preparing build machine
### takes close to 1 minute while the test execution takes 2 minutes or less.artifacts:
### When the tests execution outweighs the build preparation time, it makes sense to split them.
### By splitting them, we can rerun them individually in the case of flaky tests.
name: iOS and Web Integration/UI Tests
max_build_duration: 60
environment:
flutter: 3.13.0
xcode: 14.3
cocoapods: default
cache:
cache_paths: [ ]
triggering:
events:
# test each PR to main (target):
- pull_request
branch_patterns:
- pattern: main
include: true
source: false
when:
condition: not event.pull_request.draft
scripts:
- &do_not_run_ui_tests_if_not_ready
name: Exit build if not ready for integration tests
script: |
set -e
set -x
export COMMIT_MSG=$(git log -1 --pretty=%B)
echo COMMIT_MSG
TAG="[ready-for-ui-tests]"
if [[ $COMMIT_MSG != *"$TAG"* ]]
then
echo "Commit needs to include '$TAG' in it's message."
exit 1
else
echo "Commit message includes '$TAG', moving forward..."
fi
- &run_ios_integration_tests
name: Flutter integration tests (iOS)
script: |
mkdir -p test-results
bundle install
bundle exec fastlane run_ios_integration_tests test_report_path:test-results/integration_tests.json
test_report: test-results/integration_tests.json
- &run_web_chrome_integration_tests
name: Flutter integration tests (Chrome)
script: |
bundle install
bundle exec fastlane run_web_chrome_integration_tests port:4444
- &run_web_safari_integration_tests
name: Flutter integration tests (Safari)
script: |
bundle install
bundle exec fastlane run_web_safari_integration_tests port:5555
publishing:
email:
recipients:
- ripplearc@gmail.com