-
Notifications
You must be signed in to change notification settings - Fork 16
134 lines (118 loc) · 4.51 KB
/
pipeline.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
on:
push:
env:
SCRIPT: ./example/integration_test/execute.sh
jobs:
android:
name: Android integration tests
strategy:
fail-fast: false
matrix:
include:
- avd-api-level: 21
avd-target: google_apis
flutter-version: 3.0.0
macos-version: macos-11
- avd-api-level: 34
avd-target: google_apis
flutter-version: any
macos-version: macos-latest
runs-on: ${{ matrix.macos-version }}
steps:
- uses: actions/checkout@v3
- id: flutter-action
uses: subosito/flutter-action@v2
with:
cache: true
flutter-version: ${{ matrix.flutter-version }}
- name: Cache pub get
uses: actions/cache@v3
with:
path: ${{ env.PUB_CACHE }}
key: pub-cache-${{ steps.flutter-action.outputs.VERSION }}-${{ hashFiles('example/pubspec.lock') }}
# pre-build the app to (hopefully) speed up the test execution time,
# avoiding the `Test timed out after 12 minutes.` error.
# Apparently the timeout could not be configured, see https://github.com/flutter/flutter/issues/105913
- name: Run flutter build apk
run: |
set -e
# use pre-installed Java 11
export JAVA_HOME=$JAVA_HOME_11_X64
echo "JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV
flutter build apk --debug --target=integration_test/app_test.dart
working-directory: example
- name: AVD cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.avd-api-level }}-${{ matrix.avd-target }}
- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.avd-api-level }}
arch: x86_64
disk-size: 2G
target: ${{ matrix.avd-target }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- name: RUN ${{ env.SCRIPT }}
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.avd-api-level }}
arch: x86_64
disk-size: 2G
target: ${{ matrix.avd-target }}
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: ${{ env.SCRIPT }}
ios:
name: iOS integration tests
strategy:
fail-fast: false
matrix:
include:
- flutter-version: 3.0.0
macos-version: macos-11
- flutter-version: any
macos-version: macos-latest
runs-on: ${{ matrix.macos-version }}
steps:
- uses: actions/checkout@v3
- id: flutter-action
uses: subosito/flutter-action@v2
with:
cache: true
flutter-version: ${{ matrix.flutter-version }}
- name: Cache pub get
uses: actions/cache@v3
with:
path: ${{ env.PUB_CACHE }}
key: pub-cache-${{ steps.flutter-action.outputs.VERSION }}-${{ hashFiles('example/pubspec.lock') }}
- name: Cache CocoaPods
uses: actions/cache@v3
with:
path: example/ios/Pods
key: example-ios-pods-${{ matrix.macos-version }}-${{ steps.flutter-action.outputs.VERSION }}-${{ hashFiles('example/ios/Podfile.lock') }}
- name: Create iOS simulator
run: |
set -e
_runtime=$(xcrun simctl list runtimes ios -j | jq -r '.runtimes[-1]')
_runtimeId=$(echo $_runtime | jq -r .identifier)
echo "_runtimeId=$_runtimeId"
_deviceType=$(echo $_runtime | jq -r '.supportedDeviceTypes[-1]')
_deviceTypeName=$(echo $_deviceType | jq -r .name)
echo "_deviceTypeName=$_deviceTypeName"
_deviceTypeId=$(echo $_deviceType | jq -r .identifier)
echo "_deviceTypeId=$_deviceTypeId"
xcrun simctl create "$_deviceTypeName" "$_deviceTypeId" "$_runtimeId" | xargs xcrun simctl boot
# https://github.com/flutter/flutter/issues/105913
- run: flutter build ios --simulator --target=integration_test/app_test.dart
working-directory: example
- run: ${{ env.SCRIPT }}