-
Notifications
You must be signed in to change notification settings - Fork 13
147 lines (141 loc) · 5.35 KB
/
integration_tests.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
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Run integration tests
on:
pull_request:
push:
branches:
- main
jobs:
android:
if: contains(github.base_ref, 'main')
timeout-minutes: 45
strategy:
matrix:
patrol_cli_version: [2.5.0]
working_directory:
['example']
runs-on:
labels: ubuntu-latest-8core
env:
MAPS_API_KEY: ${{ secrets.ACTIONS_API_KEY }}
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- name: Enable KVM group perms
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: Setup Android SDK
uses: android-actions/setup-android@v3
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
name: AVD Cache
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
flutter-version: '3.16.x'
channel: 'stable'
cache: true
- name: Install patrol_cli
run: flutter pub global activate patrol_cli ${{ matrix.patrol_cli_version }}
- name: Run flutter pub get
run: flutter pub get
- name: Create and start emulator
run: |
echo "List installed packages"
$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --list_installed
echo "Installing system image"
echo "y" | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager "system-images;android-33;google_apis;x86_64"
echo "Creating AVD"
echo "no" | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/avdmanager create avd -n test_emulator -k "system-images;android-33;google_apis;x86_64" --force
echo "Starting emulator"
$ANDROID_SDK_ROOT/emulator/emulator -avd test_emulator -no-audio -no-boot-anim -no-window &
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done; input keyevent 82'
- name: Generate gradlew file with flutter build
working-directory: ${{ matrix.working_directory }}
run: flutter build apk --config-only
- name: Run integration tests
working-directory: ${{ matrix.working_directory }}
run: patrol test --verbose
- name: Upload test report
uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: android_integration_test_report
path: example/build/app/reports/androidTests/connected/
retention-days: 5
ios:
if: contains(github.base_ref, 'main')
timeout-minutes: 90
strategy:
matrix:
patrol_cli_version: [2.5.0]
working_directory:
['example']
runs-on:
labels: macos-13-large
env:
MAPS_API_KEY: ${{ secrets.ACTIONS_API_KEY }}
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
flutter-version: '3.16.x'
channel: 'stable'
cache: true
- uses: actions/cache@v3
with:
path: '**/Pods'
key: ${{ runner.os }}-pods-${{ hashFiles('**/*.podspec') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Select XCode 15.1
run: sudo xcode-select -s '/Applications/Xcode_15.1.app/Contents/Developer'
- name: Start iOS simulator
run: |
RESULT=0
while [[ $RESULT == 0 ]]; do
xcrun simctl delete "Flutter-iPhone" || RESULT=1
if [ $RESULT == 0 ]; then
echo -e "Deleted Flutter-iPhone"
fi
done
xcrun simctl create "Flutter-iPhone" "com.apple.CoreSimulator.SimDeviceType.iPhone-14-Pro" "com.apple.CoreSimulator.SimRuntime.iOS-17-2" | xargs xcrun simctl boot
xcrun simctl list
- name: Install patrol_cli
run: flutter pub global activate patrol_cli ${{ matrix.patrol_cli_version }}
- name: Run flutter pub get
run: flutter pub get
- name: Run Integration tests
id: tests_step
working-directory: ${{ matrix.working_directory }}
run: |
patrol test --dart-define=MAPS_API_KEY="$MAPS_API_KEY" --verbose -d 'Flutter-iPhone'
- name: Upload test report
uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: ios_integration_test_report
path: example/build/ios_results_*.xcresult
retention-days: 5