-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
286 lines (281 loc) · 8.11 KB
/
.travis.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
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
##.travis.yml 持续集成
#
## 1. 添加持续集成
#language: dart
##script:
## # 编译命令
## - dart main.dart
## # 自动化测试命令
#
#
## 2. 配置flutter运行环境
## os:
## - osx
## install:
## - git clone https://github.com/flutter/flutter.git
## - export PATH="$PATH:`pwd`/flutter/bin"
## script:
## - flutter doctor && flutter test
#
#
## 3. 使用 matrix 分拆构建任务【iOS 平台构建出 ipa 包、Android 平台构建出 apk 包】
#matrix:
# include:
# #声明Android运行环境
# - os: linux
# language: android
# dist: trusty
# licenses:
# - 'android-sdk-preview-license-.+'
# - 'android-sdk-license-.+'
# - 'google-gdk-license-.+'
# #声明需要安装的Android组件
# android:
# components:
# - tools
# - platform-tools
# - build-tools-28.0.3
# - android-28
# - sys-img-armeabi-v7a-google_apis-28
# - extra-android-m2repository
# - extra-google-m2repository
# - extra-google-android-support
# jdk: oraclejdk8
# sudo: false
# addons:
# apt:
# sources:
# - ubuntu-toolchain-r-test
# packages:
# - libstdc++6
# - fonts-droid
# #确保sdkmanager是最新的
# before_script:
# - yes | sdkmanager --update
# script:
# - yes | flutter doctor --android-licenses
# - flutter doctor && flutter -v build apk
#
# #声明iOS的运行环境
# - os: osx
# language: objective-c
# osx_image: xcode10.2
# script:
# - flutter doctor && flutter -v build ios --no-codesign
#install:
# - git clone https://github.com/flutter/flutter.git
# - export PATH="$PATH:`pwd`/flutter/bin"
#
#
## 4. 不清除产物,并自动发布到github
## 声明构建需要执行的命令
#script:
# - yes | flutter doctor --android-licenses
# - flutter doctor && flutter -v build apk
##声明部署的策略,即上传apk至github release
#deploy:
# provider: releases
# api_key: ${GITHUB_TOKEN}
# file:
# - build/app/outputs/apk/release/app-release.apk
# # skip_cleanup 不要清除编译产物
# skip_cleanup: true
# on:
# tags: true
#
#
## 5. ios的包ipa,需要通过 before_deploy 字段修改构建产物
#...
##对发布前的构建产物进行预处理,打包成ipa
#before_deploy:
# - mkdir app && mkdir app/Payload
# - cp -r build/ios/iphoneos/Runner.app app/Payload
# - pushd app && zip -r -m app.ipa Payload && popd
##将ipa上传至github release
#deploy:
# provider: releases
# api_key: ${GITHUB_TOKEN}
# file:
# - app/app.ipa
# skip_cleanup: true
# on:
# tags: true
#
#
## 6. 组建打包
##...
###对构建产物进行预处理,压缩成zip格式的组件
##before_deploy:
## - mkdir .ios/Outputs && mkdir .ios/Outputs/FlutterEngine
## - cp FlutterEngine.podspec .ios/Outputs/
## - cp -r .ios/Flutter/App.framework/ .ios/Outputs/FlutterEngine/App.framework/
## - cp -r .ios/Flutter/engine/Flutter.framework/ .ios/Outputs/FlutterEngine/Flutter.framework/
## - pushd .ios/Outputs && zip -r FlutterEngine.zip ./ && popd
##deploy:
## provider: releases
## api_key: ${GITHUB_TOKEN}
## file:
## - .ios/Outputs/FlutterEngine.zip
## skip_cleanup: true
## on:
## tags: true
########### sample 1 ################
# .travis.yml 持续集成简单集成
#language: dart
#script:
# - dart bin/test/travis.dart
#after_success:
# - echo "success"
#after_script:
# - echo "after_script"
#after_deploy:
# - echo 'after_deploy'
#deploy:
# provider: script
# script: echo 'deploy'
########### sample 2 ################
# android 与 ios 环境配置与打包 【组建】
#matrix:
# include:
# # 声明android的运行环境
# - os: linux
# language: android
# dist: trusty
# licenses:
# - 'android-sdk-preview-license-.+'
# - 'android-sdk-license-.+'
# - 'google-gdk-license-.+'
# android:
# components:
# - tools
# - platform-tools
# - build-tools-29.0.3
# - android-29
# - sys-img-armeabi-v7a-google_apis-29
# - extra-android-m2repository
# - extra-google-m2repository
# - extra-google-android-support
# jdk: oraclejdk8
# sudo: false
# addons:
# apt:
# # Flutter depends on /usr/lib/x86_64-linux-gnu/libstdc++.so.6 version GLIBCXX_3.4.18
# sources:
# - ubuntu-toolchain-r-test # if we don't specify this, the libstdc++6 we get is the wrong version
# packages:
# - libstdc++6
# - fonts-droid
# before_script:
# - yes | sdkmanager --update
# script:
# - yes | flutter doctor --android-licenses
# - flutter doctor && flutter -v build apk
# # android产物配置,不清除产物
# deploy:
# provider: releases
# api_key: ${GITHUB_TOKEN}
# file:
# - .android/Flutter/build/outputs/aar/flutter-release.aar
# skip_cleanup: true
# on:
# tags: true
# #声明iOS的运行环境
# - os: osx
# language: objective-c
# osx_image: xcode10.2
# before_script:
# - pod repo update
# script:
# - flutter doctor && flutter -v build ios --no-codesign
# # 对构建产物进行预处理,压缩成zip格式的组件,组建打包
# before_deploy:
# - mkdir .ios/Outputs && mkdir .ios/Outputs/FlutterEngine
# - cp FlutterEngine.podspec .ios/Outputs/
# - cp -r .ios/Flutter/App.framework/ .ios/Outputs/FlutterEngine/App.framework/
# - cp -r .ios/Flutter/engine/Flutter.framework/ .ios/Outputs/FlutterEngine/Flutter.framework/
# - pushd .ios/Outputs && zip -r FlutterEngine.zip ./ && popd
# # ios产物配置,不清除产物
# deploy:
# provider: releases
# api_key: ${GITHUB_TOKEN}
# file:
# - .ios/Outputs/FlutterEngine.zip
# skip_cleanup: true
# on:
# tags: true
# # 声明flutter的运行环境
#before_install:
# - git clone -b 'v2.10.2' --depth 1 https://github.com/flutter/flutter.git
# - export PATH="$PATH:`pwd`/flutter/bin"
#cache:
# directories:
# - $HOME/.pub-cache
########### sample 3 ################
# android 与 ios 环境配置与打包
matrix:
include:
- os: linux
language: android
dist: trusty
licenses:
- 'android-sdk-preview-license-.+'
- 'android-sdk-license-.+'
- 'google-gdk-license-.+'
android:
components:
- tools
- platform-tools
- build-tools-29.0.3
- android-29
- sys-img-armeabi-v7a-google_apis-29
- extra-android-m2repository
- extra-google-m2repository
- extra-google-android-support
jdk: oraclejdk8
sudo: false
addons:
apt:
# Flutter depends on /usr/lib/x86_64-linux-gnu/libstdc++.so.6 version GLIBCXX_3.4.18
sources:
- ubuntu-toolchain-r-test # if we don't specify this, the libstdc++6 we get is the wrong version
packages:
- libstdc++6
- fonts-droid
before_script:
- yes | sdkmanager --update
script:
- yes | flutter doctor --android-licenses
- flutter doctor && flutter -v build apk
deploy:
provider: releases
api_key: ${GITHUB_TOKEN}
file:
- build/app/outputs/apk/release/app-release.apk
skip_cleanup: true
on:
tags: true
- os: osx
language: objective-c
osx_image: xcode10.2
before_script:
- pod repo update
script:
- flutter doctor && flutter -v build ios --no-codesign
before_deploy:
- mkdir app && mkdir app/Payload
- cp -r build/ios/iphoneos/Runner.app app/Payload
- pushd app && zip -r -m app.ipa Payload && popd
deploy:
provider: releases
api_key: ${GITHUB_TOKEN}
file:
- app/app.ipa
skip_cleanup: true
on:
tags: true
install:
- git clone -b 'v2.10.2' --depth 1 https://github.com/flutter/flutter.git
- export PATH="$PATH:`pwd`/flutter/bin"
cache:
directories:
- $HOME/.pub-cache