-
Notifications
You must be signed in to change notification settings - Fork 0
286 lines (248 loc) · 8.1 KB
/
flutter.yml
File metadata and controls
286 lines (248 loc) · 8.1 KB
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
name: Flutter CI
on:
push:
branches:
- "**" # matches every branch
jobs:
backend-unit-test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./backend
steps:
- uses: actions/checkout@v4
- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.10.0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: "npm"
cache-dependency-path: './backend/package-lock.json'
- name: Install
run: npm install
- name: Run Tests
env:
CI: true
MONGO_URL: "mongodb://localhost:27017/myapp"
CREDENTIALS_FOLDER: ${{ github.workspace }}/fake_credentials
run: npx nyc --reporter=lcov npm run test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: backend/coverage/lcov.info
flags: backend
frontend-setup:
runs-on: ubuntu-latest
container:
image: nicolas71640/docked_flutter
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:"
cache-path: $(dirname $PUB_CACHE)
frontend-lint:
needs: frontend-setup
runs-on: ubuntu-latest
container:
image: nicolas71640/docked_flutter
defaults:
run:
working-directory: ./frontend
steps:
# Setup Java environment in order to build the Android app.
- uses: actions/checkout@v4
- uses: actions/setup-java@v1
with:
java-version: "12.x"
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:"
cache-path: $(dirname $PUB_CACHE)
# Check for any formatting issues in the code.
- run: dart format --set-exit-if-changed .
# Statically analyze the Dart code for any errors.
- run: flutter analyze .
frontend-build:
needs: frontend-setup
runs-on: ubuntu-latest
container:
image: nicolas71640/docked_flutter
defaults:
run:
working-directory: ./frontend
steps:
# Setup Java environment in order to build the Android app.
- uses: actions/checkout@v4
- uses: actions/setup-java@v1
with:
java-version: "12.x"
# Cache Flutter Environment
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:"
cache-path: $(dirname $PUB_CACHE)
# Cache gradle
- name: Gradle cache
uses: gradle/gradle-build-action@v2
# Build apk.
- run: flutter build apk
# Upload generated apk to the artifacts.
- uses: actions/upload-artifact@v1
with:
name: release-apk
path: frontend/build/app/outputs/flutter-apk/app-release.apk
frontend-unit-test:
needs: frontend-setup
runs-on: ubuntu-latest
container:
image: nicolas71640/docked_flutter
defaults:
run:
working-directory: ./frontend
steps:
# Setup Java environment in order to build the Android app.
- uses: actions/checkout@v4
- uses: actions/setup-java@v1
with:
java-version: "12.x"
# Cache Flutter Environment
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:"
cache-path: $(dirname $PUB_CACHE)
# Run widget tests for our flutter project.
- run: flutter test --coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./frontend/coverage/lcov.info
flags: frontend
android-integration-tests:
name: Android Integration Tests
runs-on: macos-latest #Need to be macos for hardware acceleration
strategy:
matrix:
device:
- "pixel"
defaults:
run:
working-directory: ./frontend
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v1
with:
java-version: "12.x"
- name: Setup Docker on macOS
uses: ./.github/actions/setup-docker-action
with:
network: true
- name: Install Server
uses: ./.github/actions/install-server-action
- run: colima list
- uses: subosito/flutter-action@v2
with:
channel: "stable"
- run: flutter build apk # Need this to decrease test duration (12 minutes timeout issue)
# Launch Tests and screenshots
- name: run tests
timeout-minutes: 30
uses: Wandalen/wretry.action@master
with:
attempt_limit: 3
action: reactivecircus/android-emulator-runner@v2
with: |
working-directory: ./frontend
api-level: 29
profile: ${{ matrix.device }}
target: google_apis
script: |
flutter test integration_test/tests --verbose --dart-define=BASE_URL=http://10.0.2.2:3000/api --dart-define=FIREBASE_ENABLED=false
- name: Create backend logs
if: always()
run: |
docker logs -t mongo > mongo.log
docker logs -t server > server.log
#Upload Artifacts
- uses: actions/upload-artifact@v1
if: always()
with:
name: mongo_${{ github.job }}.log
path: ./frontend/mongo.log
- uses: actions/upload-artifact@v1
if: always()
with:
name: server_${{ github.job }}.log
path: ./frontend/server.log
# frontend-ios-integration-testt:
# needs: frontend-setup
# #Create a construction matrix
# strategy:
# #Set up different configurations for a set of virtual environments
# matrix:
# device:
# - "iPhone 8 Simulator"
# #When set to true, GitHub cancels all in progress jobs if any of the matrix jobs fail.
# fail-fast: false
# runs-on: macos-latest
# steps:
# - uses: actions/checkout@v4
# # Start Emulator
# - name: "List all simulators"
# run: "xcrun xctrace list devices"
# - name: "Start Simulator"
# run: |
# UDID=$(xcrun xctrace list devices | grep "^${{ matrix.device }}" | awk '{gsub(/[()]/,""); print $NF}')
# echo $UDID
# xcrun simctl boot "${UDID:?No Simulator with this name found}"
# # Cache Flutter Environment
# - name: Cache Flutter
# id: cache-flutter
# uses: actions/cache@v3
# with:
# path: /Users/runner/hostedtoolcache/flutter
# key: ${{ runner.os }}-flutter
# - uses: subosito/flutter-action@v2
# with:
# channel: 'stable'
#
# # Build
# - name: "Build Ipa"
# run: |
# ls
# ls ios/
# flutter build ios --simulator --target=integration_test/tests/credentials_test.dart || true
# ls ios/
# cat ios/Podfile
# working-directory: ./frontend
# # Setup Server
# - name: Install Server
# uses: ./.github/actions/install-server-action
# - name: Start Server
# working-directory: ./backend
# env:
# CREDENTIALS_FOLDER: ${{ github.workspace }}/fake_credentials
# run: |
# mongoimport --jsonArray --db myapp --collection cottages --file ../frontend/assets/cottages.json
# ((DEV=1 node ./app/index.js) &> backend.log) &
# # Launch tests
# - name: "Run Flutter Driver tests"
# run: flutter test integration_test/tests --dart-define=BASE_URL=http://localhost:3000/api --dart-define=FIREBASE_ENABLED=false
# working-directory: ./frontend
# #Upload Artifacts
# - uses: actions/upload-artifact@v1
# if: always()
# with:
# name: backend_${{ github.job }}.log
# path: backend/backend.log