-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcodemagic.yaml
131 lines (123 loc) · 5.27 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
126
127
128
129
130
131
workflows:
android-workflow:
name: Android Workflow
instance_type: mac_mini
max_build_duration: 120
environment:
groups:
- google_credentials # <-- (Includes GCLOUD_KEY_FILE, GOOGLE_CREDENTIALS)
# GCLOUD_KEY_FILE <-- Put your Google Cloud Key file here
# GOOGLE_CREDENTIALS <-- Put your google-services.json here if publishing to Google Play
vars:
FIREBASE_PROJECT: "flutter-integration-test-demo"
xcode: latest
cocoapods: default
flutter: stable
scripts:
- name: Set up debug.keystore
script: |
rm -f ~/.android/debug.keystore
keytool -genkeypair -alias androiddebugkey -keypass android -keystore ~/.android/debug.keystore -storepass android -dname 'CN=Android Debug,O=Android,C=US' -keyalg 'RSA' -keysize 2048 -validity 10000
- name: Set up local.properties
script: |
echo "flutter.sdk=$HOME/programs/flutter" > "$FCI_BUILD_DIR/android/local.properties"
- name: Get Flutter packages
script: |
cd . && flutter packages pub get
- name: Build APK with Flutter
script: |
cd . && flutter build apk --debug
- name: Create debug and test APK
script: |
set -ex
cd android
./gradlew app:assembleAndroidTest
./gradlew app:assembleDebug -Ptarget="$FCI_BUILD_DIR/integration_test/app_test.dart"
- name: Run Firebase Test Lab tests for Android
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
publishing:
# See the following link for details about email publishing - https://docs.codemagic.io/publishing-yaml/distribution/#email
email:
recipients:
ios-workflow:
name: iOS Workflow
instance_type: mac_mini
max_build_duration: 120
environment:
groups:
- ios_manual_code_signing
- google_credentials
vars:
FIREBASE_PROJECT: "flutter-integration-test-demo"
xcode: latest
cocoapods: default
flutter: stable
scripts:
- name: Set up keychain to be used for codesigning using Codemagic CLI 'keychain' command
script: |
keychain initialize
- name: Set up Provisioning profiles from environment variables
script: |
PROFILES_HOME="$HOME/Library/MobileDevice/Provisioning Profiles"
mkdir -p "$PROFILES_HOME"
PROFILE_PATH="$(mktemp "$PROFILES_HOME"/$(uuidgen).mobileprovision)"
echo ${PROVISIONING_PROFILE} | base64 --decode > "$PROFILE_PATH"
echo "Saved provisioning profile $PROFILE_PATH"
- name: Set up signing certificate
script: |
echo $CM_CERTIFICATE | base64 --decode > /tmp/certificate.p12
keychain add-certificates --certificate /tmp/certificate.p12 --certificate-password $CM_CERTIFICATE_PASSWORD
- name: Set up code signing settings on Xcode project
script: xcode-project use-profiles
- name: Get Flutter Packages
script: |
flutter packages pub get
- name: Flutter build ipa
script: |
flutter build ipa --release --export-options-plist=/Users/builder/export_options.plist
- name: Prepare iOS tests zip for Firebase Test Lab
script: |
set -ex
flutter build ios --config-only integration_test/app_test.dart
output="../build/ios_integ"
product="build/ios_integ/Build/Products"
dev_target="15.2"
flutter build ios integration_test/app_test.dart --release
pushd ios
xcodebuild -workspace Runner.xcworkspace -scheme Runner -config Flutter/Release.xcconfig -derivedDataPath $output -sdk iphoneos build-for-testing -exportOptionsPlist /Users/builder/export_options.plist
popd
pushd $product
zip -r "ios_tests.zip" "Release-iphoneos" "Runner_iphoneos$dev_target-arm64-armv7.xctestrun"
popd
# - name: Run Firebase Test Lab tests for iOS
# script: |
# 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 ios run --test "build/ios_integ/Build/Products/ios_tests.zip"
artifacts:
- /Users/builder/export_options.plist
- build/ios_integ/Build/Products/ios_tests.zip
- build/ios/ipa/*.ipa
- $HOME/Library/Developer/Xcode/DerivedData/**/Build/**/*.dSYM
- /tmp/xcodebuild_logs/*.log
- flutter_drive.log
publishing:
email:
recipients: