-
Notifications
You must be signed in to change notification settings - Fork 19
263 lines (217 loc) · 8.03 KB
/
pr.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
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
name: 'PR build and deploy'
on:
pull_request:
branches-ignore:
- gh-pages
- master
env:
BUILD_NUMBER: ${{ github.run_number }}
GIT_SHA: ${{ github.sha }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_TITLE: ${{ github.event.pull_request.title }}
RELEASE_NOTES: ${{ github.event.pull_request.title }} - ${{ github.sha }}
jobs:
pre-build:
uses: ./.github/workflows/test.yml
integration-tests-android:
runs-on: ubuntu-latest
strategy:
matrix:
api-level: [32]
target: [google_apis]
arch: [x86_64]
steps:
# Checkout
- uses: actions/checkout@v3
with:
persist-credentials: false
# Set Flutter version from fvm
- uses: kuhnroyal/flutter-fvm-config-action@v1
# Install Flutter
- uses: subosito/flutter-action@v2
with:
channel: ${{ env.FLUTTER_CHANNEL }}
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Install script_runner
run: flutter pub global activate script_runner
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Gradle cache
uses: gradle/gradle-build-action@v2
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 32
target: google_apis
arch: x86_64
profile: Nexus 6
# force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: scr test-integration-android
integration-tests:
runs-on: macos-latest
steps:
# Checkout
- uses: actions/checkout@v3
with:
persist-credentials: false
# Set Flutter version from fvm
- uses: kuhnroyal/flutter-fvm-config-action@v1
# Install Flutter
- uses: subosito/flutter-action@v2
with:
channel: ${{ env.FLUTTER_CHANNEL }}
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: 🚀 Start Safari Driver
run: |
sudo safaridriver --enable
safaridriver --port 4444 &
- name: Install script_runner
run: flutter pub global activate script_runner
- name: Build app
run: |
scr setup
flutter config --enable-web
flutter build web --dart-define=environment=development --release --pwa-strategy=none --no-web-resources-cdn --dart2js-optimization=O1
# Run Flutter integration tests
- name: Run Flutter Integration Tests
run: scr test-integration-safari
build-web:
needs: pre-build
runs-on: ubuntu-latest
steps:
# Checkout
- uses: actions/checkout@v3
with:
persist-credentials: false
# Set Flutter version from fvm
- uses: kuhnroyal/flutter-fvm-config-action@v1
# Install Flutter
- uses: subosito/flutter-action@v2
with:
channel: ${{ env.FLUTTER_CHANNEL }}
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Install script_runner
run: flutter pub global activate script_runner
- name: Build app
run: |
scr setup
flutter config --enable-web
flutter build web --dart-define=environment=development --release --pwa-strategy=none --no-web-resources-cdn --dart2js-optimization=O1
# JS files cache invalidation
- name: main.dart.js and service worker cache invalidation
run: |
sed -i 's/main.dart.js/main.dart.js?version='"$GITHUB_SHA"'/' build/web/index.html
sed -i 's/flutter_service_worker.js/flutter_service_worker.js?version='"$GITHUB_SHA"'/' build/web/index.html
# Disribute to Firebase
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_CI_SERVICE_ACCOUNT }}'
expires: 7d
build-ios:
# skipped for now
if: false
needs: pre-build
runs-on: macos-latest
steps:
# Checkout
- uses: actions/checkout@v3
# Install Ruby
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
# Set Flutter version from fvm
- uses: kuhnroyal/flutter-fvm-config-action@v1
# Install Flutter
- uses: subosito/flutter-action@v2
with:
channel: ${{ env.FLUTTER_CHANNEL }}
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Set FIREBASE_JSON env var
run: echo "FIREBASE_JSON=$RUNNER_TEMP/firebase.json" >> $GITHUB_ENV
- name: Save Firebase Service Account json
env:
FIREBASE_SERVICE_ACCOUNT_JSON: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }}
run: echo -n "$FIREBASE_SERVICE_ACCOUNT_JSON" >> $FIREBASE_JSON
- name: Install fastlane and Cocoapods
working-directory: ./ios
run: bundle install
- name: Build iOS with fastlane
env:
MATCH_GIT_PRIVATE_KEY: ${{ secrets.FASTLANE_SSH_KEY }}
MATCH_PASSWORD: ${{ secrets.FASTLANE_MATCH_PASSWORD }}
working-directory: ./ios
run: bundle exec fastlane deploy type:branch
- name: Update PR description and Jira
env:
FL_JIRA_PASSWORD: ${{ secrets.FASTLANE_JIRA_API_KEY }}
FL_JIRA_SITE: ${{ secrets.FASTLANE_JIRA_SITE }}
FL_JIRA_USERNAME: ${{ secrets.FASTLANE_JIRA_USER }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: ./ios
run: bundle exec fastlane update_release_url
build-android:
needs: pre-build
runs-on: ubuntu-latest
steps:
# Checkout
- uses: actions/checkout@v3
# Install Ruby
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
# Install JDK
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
cache: 'gradle'
check-latest: true
# Set Flutter version from fvm
- uses: kuhnroyal/flutter-fvm-config-action@v1
# Install Flutter
- uses: subosito/flutter-action@v2
with:
channel: ${{ env.FLUTTER_CHANNEL }}
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Set FIREBASE_JSON env var
run: echo "FIREBASE_JSON=$RUNNER_TEMP/firebase.json" >> $GITHUB_ENV
- name: Save Firebase Service Account json
env:
FIREBASE_SERVICE_ACCOUNT_JSON: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }}
run: echo -n "$FIREBASE_SERVICE_ACCOUNT_JSON" >> $FIREBASE_JSON
- name: Set ANDROID_SIGNING_STORE_FILE env var
run: echo "ANDROID_SIGNING_STORE_FILE=$RUNNER_TEMP/keystore.jks" >> $GITHUB_ENV
- name: Save Android Keystore file
env:
ANDROID_SIGNING_STORE: ${{ secrets.ANDROID_SIGNING_STORE }}
run: echo -n "$ANDROID_SIGNING_STORE" | base64 --decode >> $ANDROID_SIGNING_STORE_FILE
- name: Install fastlane
working-directory: ./android
run: bundle install
- name: Build Android with fastlane
env:
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
ANDROID_STORE_PASSWORD: ${{ secrets.ANDROID_STORE_PASSWORD }}
working-directory: ./android
run: bundle exec fastlane deploy type:branch
- name: Update PR description and Jira
env:
FL_JIRA_PASSWORD: ${{ secrets.FASTLANE_JIRA_API_KEY }}
FL_JIRA_SITE: ${{ secrets.FASTLANE_JIRA_SITE }}
FL_JIRA_USERNAME: ${{ secrets.FASTLANE_JIRA_USER }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: ./android
run: bundle exec fastlane update_release_url