-
Notifications
You must be signed in to change notification settings - Fork 29
243 lines (194 loc) · 8.1 KB
/
ci_emulator_run.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
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
236
237
238
239
240
241
242
243
name: Emulator Run CI
on:
push:
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
concurrency:
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }}
cancel-in-progress: true
jobs:
ubuntu-latest-test-all:
runs-on: ubuntu-latest
timeout-minutes: 35
env:
VAB_FLAGS: -cg -f '-d no_load_styles' -v 3 --api 30 --build-tools 33.0.2
VFLAGS: -no-parallel
steps:
- uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17
- name: Checkout V
uses: actions/checkout@v4
with:
repository: vlang/v
path: v
- name: Build and install v
run: cd ./v && make -j4 && sudo ./v symlink
- name: Checkout vab
uses: actions/checkout@v4
with:
path: vab
- name: Simulate "v install vab"
run: mv vab ~/.vmodules
- name: Build vab
run: v -g ~/.vmodules/vab
- name: Symlink vab
run: sudo ln -s ~/.vmodules/vab/vab /usr/local/bin/vab
- name: Run vab --help
run: vab --help
- name: Run vab doctor *before*
run: vab doctor
- name: Install dependencies
run: |
v retry -- sudo apt update
v retry -- sudo apt install --quiet -y qemu-kvm
sudo chown $USER /dev/kvm
- name: Install SDK dependencies
run: |
vab install "platform-tools"
vab install "build-tools;33.0.2"
vab install "platforms;android-30"
vab install emulator
vab install bundletool
vab install aapt2
- name: Run vab doctor *after*
run: vab doctor
- name: Cache emulator
id: cache-emulator
uses: actions/cache@v4
with:
path: |
/usr/local/lib/android/sdk/system-images/android-30
key: ${{ runner.os }}-android-emulator-${{ hashFiles('/usr/local/lib/android/sdk/system-images') }}
- name: Prepare emulator
if: steps.cache-emulator.outputs.cache-hit != 'true'
run: |
vab install 'system-images;android-30;aosp_atd;x86_64'
- name: Run `vab test-all`
run: |
vab test-all
macos-legacy-run-v-examples:
runs-on: macos-12
timeout-minutes: 45
env:
VAB_FLAGS: -cg -f '-d no_load_styles' -v 3 --api 30 --build-tools 33.0.2 --device auto --log-clear --archs x86_64
VFLAGS: -no-parallel
steps:
- uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 8
- name: Checkout V
uses: actions/checkout@v4
with:
repository: vlang/v
path: v
- name: Build and install v
run: cd ./v && make -j4 && sudo ./v symlink
- name: Checkout vab
uses: actions/checkout@v4
with:
path: vab
- name: Simulate "v install vab"
run: mv vab ~/.vmodules
- name: Build vab with -prod
run: v -prod ~/.vmodules/vab
- name: Build vab
run: v -g ~/.vmodules/vab
- name: Symlink vab
run: sudo ln -s ~/.vmodules/vab/vab /usr/local/bin/vab
- name: Run vab --help
run: vab --help
- name: Install SDK dependencies
run: |
vab install "build-tools;33.0.2"
vab install "platforms;android-30"
vab install bundletool
vab install aapt2
- name: Run vab doctor
run: vab doctor
- name: Cache emulator
id: cache-emulator
uses: actions/cache@v4
with:
path: |
/Users/runner/Library/Android/sdk/system-images/android-30
key: ${{ runner.os }}-android-emulator-${{ hashFiles('/Users/runner/Library/Android/sdk/system-images/android-30') }}
- name: Prepare emulator
if: steps.cache-emulator.outputs.cache-hit != 'true'
run: |
vab install 'system-images;android-30;aosp_atd;x86_64'
- name: Create test AVD
run: |
export ANDROID_SDK_ROOT="$HOME/Library/Android/sdk"
echo no | $ANDROID_SDK_ROOT/tools/bin/avdmanager create avd --force --name test --abi aosp_atd/x86_64 --package 'system-images;android-30;aosp_atd;x86_64'
- name: Install and run V + V UI examples as APK and AAB
run: |
export ANDROID_SDK_ROOT="$HOME/Library/Android/sdk"
export ANDROID_NDK_ROOT="$ANDROID_SDK_ROOT/ndk-bundle"
# Don't set Java > 8 here (emulator can't be started otherwise, lol) #export JAVA_HOME=$JAVA_HOME_11_X64
#pgrep emulator >/dev/null 2>&1 ||
$ANDROID_SDK_ROOT/emulator/emulator -avd test -wipe-data -no-metrics -no-snapshot -no-window -no-boot-anim -camera-back emulated -camera-front emulated -gpu swiftshader_indirect &
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done;'
# Debugging
#export ADB_TAGS="SOKOL_APP:D"
#export ADB_TAGS="$ADB_TAGS V_ANDROID:D v_test_app:D"
# Test deployment of single file *after* build
echo "Testing vab deployment *after* build"
vab --package-id "io.v.ci.vab.apk.deploytest" --name "V DEPLOY TEST APK" v/examples/gg/bezier.v
vab v_deploy_test_apk.apk
sleep 1 # Experience tells us that the emulator likes to catch it's breath...
vab --package-id "io.v.ci.vab.aab.deploytest" --name "V DEPLOY TEST AAB" --package aab v/examples/gg/bezier.v
v retry -r 2 -- vab v_deploy_test_aab.aab
# Skip fireworks for now
declare -a v_examples=('2048' 'flappylearning' 'tetris' 'sokol/particles' 'sokol/drawing.v' 'sokol/freetype_raven.v' 'gg/bezier.v' 'gg/bezier_anim.v' 'gg/polygons.v' 'gg/raven_text_rendering.v' 'gg/rectangles.v' 'gg/stars.v' 'gg/worker_thread.v')
echo "Compiling V examples ${v_examples[@]}"
for example in "${v_examples[@]}"; do
#path_safe_name=$( echo "$example" | sed 's%/%-%' | sed 's%\.%-%' )
package_id=$( echo "$example" | sed 's%/%%' | sed 's%\.%%' )
package_id=$( echo "v$package_id" )
# APK
echo "Compiling apk from examples/$example ($package_id)"
vab --package-id "io.v.apk.$package_id" run v/examples/$example
sleep 1 # Experience tells us that the emulator likes to catch it's breath...
# AAB
echo "Compiling aab from examples/$example ($package_id)"
v retry -r 2 -- vab --package aab --package-id "io.v.aab.$package_id" run v/examples/$example
done
# Output test
echo "Testing if v/examples/tetris can run..."
vab -g --package-id "io.v.ci.vab.apk.examples.tetris" run v/examples/tetris
sleep 5 # give the emulator a little time to start the application...
adb -e logcat -d > /tmp/logcat.dump.txt
echo "Looking for traces of BDWGC"
cat /tmp/logcat.dump.txt | grep -q 'BDWGC : Grow'; if [ ! $? -eq 0 ]; then cat /tmp/logcat.dump.txt; fi
# V UI
echo "Installing V UI"
git clone --depth 1 https://github.com/vlang/ui
cd ui ; mkdir -p ~/.vmodules ; ln -s $(pwd) ~/.vmodules/ui ; cd ..
declare -a v_ui_examples=('rectangles.v')
echo "Compiling examples ${v_ui_examples[@]}"
for example in "${v_ui_examples[@]}"; do
package_id=$( echo "$example" | sed 's%/%%' | sed 's%\.%%' )
package_id=$( echo "v$package_id" )
# APK
echo "Compiling apk from ui/examples/$example ($package_id)"
vab --package-id "io.v.apk.ui.$package_id" run ui/examples/$example
sleep 1 # Experience tells us that the emulator likes to catch it's breath...
# AAB
echo "Compiling aab from ui/examples/$example ($package_id)"
v retry -r 2 -- vab --package aab --package-id "io.v.aab.ui.$package_id" run ui/examples/$example
done
# Output test
echo "Testing if ui/examples/calculator can run..."
vab -g --package-id "io.v.ui.ci.examples.calculator" run ui/examples/calculator.v
sleep 5 # give the emulator a little time to start the application...
adb -e logcat -d > /tmp/logcat.dump.txt
echo "Looking for traces of BDWGC"
cat /tmp/logcat.dump.txt | grep -q 'BDWGC : Grow'; if [ ! $? -eq 0 ]; then cat /tmp/logcat.dump.txt; fi
echo "Killing emulator"
adb -s emulator-5554 emu kill