-
Notifications
You must be signed in to change notification settings - Fork 7
118 lines (113 loc) · 3.51 KB
/
build-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
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
name: build-test
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
env:
FLUTTER_CHANNEL: stable
CACHE_NUMBER: 0 # increment to truncate cache
IOS_SIMULATOR_DEVICE: iPhone 15 Pro
IOS_SIMULATOR_RUNTIME: iOS-17-5
USER_JAVA_VERSION: 17
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
# setup flutter
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: ${{ env.USER_JAVA_VERSION }}
distribution: "zulu"
- uses: subosito/flutter-action@v2
with:
channel: ${{ env.FLUTTER_CHANNEL }}
# configure cache
- name: Cache Flutter
uses: actions/cache@v4
with:
path: |
/Users/runner/hostedtoolcache/flutter
key: ${{ runner.os }}-pub-${{ env.CACHE_NUMBER }}-${{ hashFiles('**/*/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-${{ env.CACHE_NUMBER }}-
${{ runner.os }}-pub-
# check
- run: make dependencies
- run: make check
build-android:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
# setup flutter
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: ${{ env.USER_JAVA_VERSION }}
distribution: "zulu"
- uses: subosito/flutter-action@v2
with:
channel: ${{ env.FLUTTER_CHANNEL }}
- uses: gradle/actions/setup-gradle@v3
- name: Cache Flutter
uses: actions/cache@v4
with:
path: |
/Users/runner/hostedtoolcache/flutter
key: ${{ runner.os }}-pub-${{ env.CACHE_NUMBER }}-${{ hashFiles('**/*/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-${{ env.CACHE_NUMBER }}-
${{ runner.os }}-pub-
# prepare flutter
- run: make dependencies
# build app
- name: Build android app
run: make build-android-example
- name: Run e2e test on Android Emulator
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 34
arch: x86_64
profile: pixel
script: make driver-test
build-ios:
needs: build
runs-on: macos-latest
timeout-minutes: 30
steps:
# setup flutter
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: ${{ env.USER_JAVA_VERSION }}
distribution: "zulu"
- uses: subosito/flutter-action@v2
with:
channel: ${{ env.FLUTTER_CHANNEL }}
- name: Cache Flutter
uses: actions/cache@v4
with:
path: |
/Users/runner/hostedtoolcache/flutter
key: ${{ runner.os }}-pub-${{ env.CACHE_NUMBER }}-${{ hashFiles('**/*/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-${{ env.CACHE_NUMBER }}-
${{ runner.os }}-pub-
# prepare flutter
- run: make dependencies
# build app
- name: Build ios app
run: make build-ios-example
# connected check
- name: List all iPhone Simulator
run: xcrun simctl list devices available
- name: Start iOS Simulator
run: |
UDID=$(xcrun simctl list devices available --json | jq -r '.devices."com.apple.CoreSimulator.SimRuntime.${{ env.IOS_SIMULATOR_RUNTIME }}"[] | select(.name == "${{ env.IOS_SIMULATOR_DEVICE }}").udid')
xcrun simctl boot "${UDID}"
- name: Run e2e test
run: make driver-test