-
Notifications
You must be signed in to change notification settings - Fork 0
/
codemagic.yaml
104 lines (100 loc) · 2.69 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
definitions:
environment: &environment
flutter: stable
xcode: latest
triggering: &triggering
events:
- pull_request
- push
cancel_previous_builds: true
cache: &cache
cache_paths:
- $HOME/.pub-cache
- $HOME/.gradle/caches
- $HOME/Library/Caches/CocoaPods
scripts:
- &prepare_flutter_script
name: Get Flutter dependencies
script: |
flutter clean
flutter pub get
workflows:
validate:
name: Validate
max_build_duration: 10
instance_type: linux_x2
environment:
<<: *environment
triggering:
<<: *triggering
cache:
<<: *cache
scripts:
- *prepare_flutter_script
- name: Format
script: dart format -o none --set-exit-if-changed lib/ test/
- name: Analyze
script: flutter analyze --fatal-infos --fatal-warnings
build-ios:
name: Build iOS
max_build_duration: 30
instance_type: mac_mini_m2
environment:
<<: *environment
triggering:
<<: *triggering
cache:
<<: *cache
scripts:
- *prepare_flutter_script
- name: Build iOS
script: flutter build ios --release --no-codesign --flavor production -t lib/main_production.dart
build-android:
name: Build Android
max_build_duration: 30
instance_type: linux_x2
environment:
<<: *environment
android_signing:
- codemagic_ci_testapp_android_keystore
triggering:
<<: *triggering
cache:
<<: *cache
scripts:
- *prepare_flutter_script
- name: Set up key.properties
script: |
cat >> "$CM_BUILD_DIR/android/key.properties" <<EOF
storePassword=$CM_KEYSTORE_PASSWORD
keyPassword=$CM_KEY_PASSWORD
keyAlias=$CM_KEY_ALIAS
storeFile=$CM_KEYSTORE_PATH
EOF
- name: Build Android
script: flutter build appbundle --release --flavor production -t lib/main_production.dart
test:
name: Test and generate coverage
max_build_duration: 30
instance_type: linux_x2
environment:
<<: *environment
triggering:
<<: *triggering
cache:
<<: *cache
scripts:
- *prepare_flutter_script
- name: Install lcov
script: |
sudo apt-get update
sudo apt-get -y install lcov
- name: Run tests
script: flutter test --coverage --file-reporter json:test_results.json
- name: Generate coverage report
script: |
lcov --remove coverage/lcov.info '**.g.dart' --remove coverage/lcov.info '**/*.freezed.dart' -o coverage/clean_lcov.info
genhtml coverage/clean_lcov.info -o coverage/html
artifacts:
- test_results.json
- coverage/