-
Notifications
You must be signed in to change notification settings - Fork 823
235 lines (212 loc) · 8.24 KB
/
build.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
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
name: build
on:
workflow_dispatch: { }
push:
branches:
- main
pull_request:
branches:
- main
types:
- opened
- reopened
- synchronize
- ready_for_review
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
channel: stable
- uses: bluefireteam/melos-action@main
- run: melos run format-check
- run: melos run analyze
- run: melos run test
web:
runs-on: ubuntu-latest
timeout-minutes: 30
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v3
- uses: nanasess/setup-chromedriver@v1
- uses: subosito/flutter-action@v2
with:
channel: stable
- uses: bluefireteam/melos-action@main
- name: Example app - Build Web app
working-directory: ./packages/audioplayers/example
run: |
flutter build web
- name: Run Flutter integration tests
working-directory: ./packages/audioplayers/example
run: |
export DISPLAY=:99
chromedriver --port=4444 &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional
( cd server; dart run bin/server.dart ) &
flutter drive \
--driver=test_driver/integration_test.dart \
--target=integration_test/app_test.dart \
-d web-server \
--web-browser-flag="--autoplay-policy=no-user-gesture-required" \
--web-browser-flag="--disable-web-security" \
--dart-define USE_LOCAL_SERVER=true
android:
runs-on: macOS-latest
timeout-minutes: 60
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- uses: subosito/flutter-action@v2
with:
channel: stable
- uses: bluefireteam/melos-action@main
- name: Example App - Build Android APK
working-directory: ./packages/audioplayers/example
run: |
flutter build apk --release
- name: Run Android unit tests
working-directory: ./packages/audioplayers/example/android
run: |
./gradlew test
- name: Download Android emulator image
run: |
export ANDROID_TOOLS="$ANDROID_HOME/cmdline-tools/latest/bin"
echo "y" | $ANDROID_TOOLS/sdkmanager --install "system-images;android-30;aosp_atd;x86"
echo "no" | $ANDROID_TOOLS/avdmanager create avd --force --name emu --device "Nexus 5X" -k 'system-images;android-30;aosp_atd;x86'
$ANDROID_HOME/emulator/emulator -list-avds
- name: Start Android emulator
timeout-minutes: 10
run: |
export ANDROID_TOOLS="$ANDROID_HOME/cmdline-tools/latest/bin"
echo "Starting emulator"
$ANDROID_TOOLS/sdkmanager "platform-tools" "platforms;android-30"
nohup $ANDROID_HOME/emulator/emulator -avd emu -no-audio -no-snapshot -no-window &
$ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done; input keyevent 82'
$ANDROID_HOME/platform-tools/adb devices
echo "Emulator started"
- name: Run Flutter integration tests
working-directory: ./packages/audioplayers/example
run: |
( cd server; dart run bin/server.dart ) &
flutter test integration_test --dart-define USE_LOCAL_SERVER=true
ios:
runs-on: macOS-latest
timeout-minutes: 60
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
channel: stable
- uses: bluefireteam/melos-action@main
- name: List all simulators
run: "xcrun simctl list devices"
- name: Start simulator
run: |
UDID=$(xcrun simctl list devices | grep "iPhone" | sed -n 1p | awk -F '\\)? \\(' '{ print $2 }')
echo "Using simulator $UDID"
xcrun simctl boot "${UDID:?No Simulator with this name iPhone found}"
- name: Example app - Build iOS
working-directory: ./packages/audioplayers/example
run: |
flutter build ios --release --no-codesign
- name: Run Flutter integration tests
working-directory: ./packages/audioplayers/example
run: |
( cd server; dart run bin/server.dart ) &
flutter test integration_test --dart-define USE_LOCAL_SERVER=true
macos:
runs-on: macOS-latest
timeout-minutes: 30
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
channel: stable
- uses: bluefireteam/melos-action@main
- name: setup-cocoapods
uses: maxim-lobanov/setup-cocoapods@v1
with:
podfile-path: ./packages/audioplayers/example/macos/Podfile.lock
- name: Example app - Build macOS
working-directory: ./packages/audioplayers/example
run: |
flutter config --enable-macos-desktop
flutter build macos --release
- name: Run Flutter integration tests
working-directory: ./packages/audioplayers/example
run: |
( cd server; dart run bin/server.dart ) &
flutter test -d macos integration_test --dart-define USE_LOCAL_SERVER=true
windows:
runs-on: windows-latest
timeout-minutes: 30
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
channel: stable
- uses: bluefireteam/melos-action@main
- name: Example app - Build Windows app
working-directory: ./packages/audioplayers/example
run: |
flutter build windows --release
- name: Start audio server
run: net start audiosrv
- name: Install virtual audio device
shell: powershell
run: |
Invoke-WebRequest https://github.com/duncanthrax/scream/releases/download/3.9/Scream3.9.zip -OutFile Scream3.9.zip
Expand-Archive -Path Scream3.9.zip -DestinationPath Scream
Import-Certificate -FilePath Scream\Install\driver\x64\Scream.cat -CertStoreLocation Cert:\LocalMachine\TrustedPublisher
Scream\Install\helpers\devcon-x64.exe install Scream\Install\driver\x64\Scream.inf *Scream
- name: Run Flutter integration tests
shell: powershell
working-directory: ./packages/audioplayers/example
run: |
Start-Process -NoNewWindow -WorkingDirectory "server" dart -ArgumentList "run", "bin/server.dart"
flutter test -d windows integration_test --dart-define USE_LOCAL_SERVER=true
linux:
runs-on: ubuntu-latest
timeout-minutes: 30
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
channel: stable
- uses: bluefireteam/melos-action@main
- name: Install Flutter requirements for Linux
run: |
sudo apt-get update
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev
- name: Install GStreamer
# Install libunwind-dev, see https://github.com/actions/runner-images/issues/6399#issuecomment-1285011525
run: |
sudo apt install -y libunwind-dev
sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-good gstreamer1.0-plugins-bad
- name: Example app - Build Linux app
working-directory: ./packages/audioplayers/example
run: |
flutter config --enable-linux-desktop
flutter build linux --release
- name: Run Flutter integration tests
working-directory: ./packages/audioplayers/example
run: |
export DISPLAY=:99
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
( cd server; dart run bin/server.dart ) &
flutter test -d linux integration_test --dart-define USE_LOCAL_SERVER=true