compile: support -d no_gc_threads
(#331)
#563
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |