-
Notifications
You must be signed in to change notification settings - Fork 0
/
codemagic.yaml
125 lines (119 loc) · 3.95 KB
/
codemagic.yaml
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
workflows:
android-deploy-workflow:
name: Android Deployment Workflow
instance_type: mac_mini_m1
max_build_duration: 30
triggering:
events:
- tag
cancel_previous_builds: true
environment:
groups:
- google_credentials
flutter: stable
xcode: latest
cocoapods: default
scripts:
- name: Setup the keystore
script: |
echo $KEYSTORE_FILE | base64 --decode > /tmp/keystore.jks
cat >> "$CM_BUILD_DIR/android/key.properties" << EOF
storePassword=$KEYSTORE_PASSWORD
keyPassword=$KEYSTORE_KEY_PASSWORD
keyAlias=deployment_tutorial
storeFile=/tmp/keystore.jks
EOF
- name: Build AAB
script: |
cd $CM_BUILD_DIR
flutter packages pub get
flutter build appbundle --build-number=$PROJECT_BUILD_NUMBER
artifacts:
- build/**/outputs/**/*.aab
publishing:
google_play:
credentials: $GOOGLE_PLAY_SERVICE_ACCOUNT
track: internal
submit_as_draft: true
android-workflow:
name: Android Workflow
instance_type: mac_mini_m1
max_build_duration: 30
environment:
groups:
- google_credentials # <-- (Includes GCLOUD_KEY_FILE, GOOGLE_CREDENTIALS)
vars:
FIREBASE_PROJECT: "factory-app-3372e"
flutter: stable
xcode: latest
cocoapods: default
scripts:
- name: Get Flutter packages
script: |
flutter packages pub get
- name: Build APK with Flutter
script: |
flutter build apk --debug
- name: Create debug and test APK
script: |
set -ex
cd android
./gradlew app:assembleAndroidTest
./gradlew app:assembleDebug -Ptarget="$CM_BUILD_DIR/integration_test/app_test.dart"
- name: Run Firebase Test Lab tests
script: |
set -ex
echo $GCLOUD_KEY_FILE | base64 --decode > ./gcloud_key_file.json
gcloud auth activate-service-account --key-file=gcloud_key_file.json
gcloud --quiet config set project $FIREBASE_PROJECT
gcloud firebase test android run \
--type instrumentation \
--app build/app/outputs/apk/debug/app-debug.apk \
--test build/app/outputs/apk/androidTest/debug/app-debug-androidTest.apk \
--timeout 3m
artifacts:
- build/**/outputs/**/*.apk
- build/**/outputs/**/*.aab
- build/**/outputs/**/mapping.txt
- flutter_drive.log
ios-workflow:
name: iOS Workflow
instance_type: mac_mini_m1
environment:
flutter: stable
xcode: latest
cocoapods: default
groups:
- google_credentials
vars:
FIREBASE_PROJECT: "factory-app-3372e"
BUNDLE_ID: "dev.flutterexplained.cicdtutorial"
TEST_BUNDLE_ID: "dev.flutterexplained.cicdtutorial.uitests.xctrunner"
scripts:
- name: Configure Firebase access
script: |
set -e
echo $GCLOUD_KEY_FILE | base64 --decode > ./gcloud_key_file.json
gcloud auth activate-service-account --key-file=gcloud_key_file.json
gcloud --quiet config set project $FIREBASE_PROJECT
- name: Build app for testing
script: |
set -ex
flutter build ios integration_test/app_test.dart --release
cd ios
xcodebuild \
-workspace Runner.xcworkspace \
-scheme Runner \
-config Flutter/Release.xcconfig \
-derivedDataPath "../build/ios_integ" \
-sdk iphoneos \
build-for-testing
- name: Package tests bundle
script: |
set -ex
cd ./build/ios_integ/Build/Products
zip -r "ios_tests.zip" *-iphoneos *.xctestrun
- name: Run tests in Firebase Test Lab
script: gcloud firebase test ios run --test "build/ios_integ/Build/Products/ios_tests.zip"
artifacts:
- "**/ios_tests.zip"