-
Notifications
You must be signed in to change notification settings - Fork 1
82 lines (77 loc) · 2.51 KB
/
test.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
name: Test
on:
push:
branches: [main]
env:
FLUTTER_VERSION: "3.24.x"
JAVA_VERSION: "17"
ANDROID_API_LEVEL: "34"
XCODE_VERSION: "Xcode_16"
IOS_DEVICE: "iPhone 15 Pro"
jobs:
unit:
name: Unit & Widget Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- name: Install dependencies
run: flutter pub get
- name: Test
run: flutter test
integration-android:
if: false
name: Integration Test on Android
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: "adopt"
java-version: ${{ env.JAVA_VERSION }}
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: "stable"
- 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: Test on Android
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.ANDROID_API_LEVEL }}
script: flutter drive -d emulator-5554 --target=test_driver/app.dart
integration-ios:
name: Integration Test on iOS
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Select Xcode version
run: sudo xcode-select -s '/Applications/${{ env.XCODE_VERSION }}.app/Contents/Developer'
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: "stable"
- uses: actions/cache@v4
with:
path: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: List Simulator
run: echo "UDID=$(xcrun xctrace list devices 2>&1 | awk '/${{ env.IOS_DEVICE }}/ {print $NF; exit}' | tr -d '()')" >> $GITHUB_ENV
- name: Start Simulator
run: xcrun simctl boot ${{ env.UDID }}
- name: Test on iOS
run: "flutter drive --target=test_driver/app.dart"
- name: Quit iOS Simulators
run: xcrun simctl shutdown all