-
Notifications
You must be signed in to change notification settings - Fork 0
256 lines (237 loc) · 8.05 KB
/
ci.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
name: CI
on:
push:
branches:
- main
- release
- feature/*
pull_request:
branches:
- main
- release
- feature/*
jobs:
flutter_test:
name: Run flutter test and analyze
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Install and set Flutter version
uses: subosito/flutter-action@v2
with:
channel: "stable"
architecture: x64
# Make environment variables available to the melos generate script.
#
# The environment variables need to be defined in the repository secrets
- name: Load Environment Variables
uses: oNaiPs/secrets-to-env-action@v1.2
with:
secrets: ${{ toJSON(secrets) }}
- name: Activate Melos
run: dart pub global activate melos ^3.1.0
- name: Bootstrap Melos
run: melos bootstrap
# Comment out this task if you don't want to enforce formatting.
- name: Verify Formatting
run: melos run verify_format
- name: Analyze
run: melos run analyze
# Project needs to have tests in test/ and a dependency on
# package:flutter_test for this step to succeed.
#
# Each package in the packages/ directory should have its own
# test/ directory with tests for that package.
- name: Run Tests
run: melos run test
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3.1.0
with:
files: "**/*/lcov.info"
build_ios:
name: Build Flutter for iOS (Without Signing)
needs: [flutter_test]
runs-on: macos-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Install and set Flutter version
uses: subosito/flutter-action@v2
with:
channel: "stable"
architecture: x64
# Zip into IPA from here:
# https://gist.github.com/devhammed/617d920b7ee886591a46c22633ab0093
- name: Build Flutter IPA
run: |
flutter build ios --release --no-codesign --dart-define FLAVOR=dev
cd build/ios/iphoneos
mkdir Payload
cd Payload
ln -s ../Runner.app
cd ..
zip -r app-release.ipa Payload
- name: Upload IPA
uses: actions/upload-artifact@v3
with:
name: ios_ipa
path: build/ios/iphoneos/app-release.ipa
# build_ios_with_signing:
# name: Build Flutter for iOS (Signed)
# needs: [flutter_test]
# runs-on: macos-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3
# # From github documentation
# - name: Install the Apple certificate, provisioning profile, and Firebase google services
# env:
# BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
# P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
# BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
# KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
# run: |
# # create variables
# CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
# PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
# KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# # import certificate and provisioning profile from secrets
# echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH
# echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode --output $PP_PATH
# # create temporary keychain
# security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
# security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# # import certificate to keychain
# security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
# security list-keychain -d user -s $KEYCHAIN_PATH
# # apply provisioning profile
# mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
# cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
#
# - name: Install and set Flutter version
# uses: subosito/flutter-action@v2
# with:
# channel: 'stable'
# architecture: x64
# - run: flutter pub get
# - run: flutter clean
# # Zip into IPA from here:
# # https://gist.github.com/devhammed/617d920b7ee886591a46c22633ab0093
# - name: Build Flutter IPA
# run: |
# flutter build ios --release --dart-define FLAVOR=dev
# cd build/ios/iphoneos
# mkdir Payload
# cd Payload
# ln -s ../Runner.app
# cd ..
# zip -r app.ipa Payload
# - name: Upload IPA
# uses: actions/upload-artifact@v3
# with:
# name: ios_ipa
# path: build/ios/iphoneos/
build_android:
name: Build Flutter for Android
needs: [flutter_test]
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Install and set Flutter version
uses: subosito/flutter-action@v2
with:
channel: "stable"
architecture: x64
- name: Build Android APK and Appbundle
run: |
flutter pub get
flutter build apk --release --dart-define FLAVOR=dev
flutter build appbundle --release --dart-define FLAVOR=dev
- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: android_apk
path: build/app/outputs/flutter-apk/*.apk
- name: Upload Appbundle
uses: actions/upload-artifact@v3
with:
name: android_appbundle
path: build/app/outputs/bundle/release/*.aab
build_windows:
name: Build Flutter for Windows
needs: [flutter_test]
runs-on: windows-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Install and set Flutter version
uses: subosito/flutter-action@v2
with:
channel: "stable"
architecture: x64
- name: Build Windows
run: |
flutter pub get
flutter build windows --dart-define FLAVOR=dev "&" dart run msix:create --build-windows false
- name: Upload MSIX
uses: actions/upload-artifact@v3
with:
name: windows_release
path: build/windows/runner/Release/*.msix
build_linux:
name: Build Flutter for Linux
needs: [flutter_test]
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Install and set Flutter version
uses: subosito/flutter-action@v2
with:
channel: "stable"
architecture: x64
- run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev
- name: Enable Linux
run: flutter config --enable-linux-desktop
- name: Build Linux
run: |
flutter pub get
flutter build linux --release --dart-define FLAVOR=dev
build_macos:
name: Build Flutter for MacOS
needs: [flutter_test]
runs-on: macos-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Install and set Flutter version
uses: subosito/flutter-action@v2
with:
channel: "stable"
architecture: x64
- name: Enable Linux
run: flutter config --enable-macos-desktop
- name: Build MacOS
run: |
flutter pub get
flutter build macos --release --dart-define FLAVOR=dev
build_web:
name: Build Flutter for Web
needs: [flutter_test]
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Install and set Flutter version
uses: subosito/flutter-action@v2
with:
channel: "stable"
- name: Build Web
run: |
flutter pub get
flutter build web --dart-define FLAVOR=dev