From 99f5b17e5fd4bf64c75b2dbee83f66be373d62b1 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sun, 5 Apr 2026 18:07:15 -0700 Subject: [PATCH 1/7] ci: add android --- .github/workflows/functional-test.yml | 94 +++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/.github/workflows/functional-test.yml b/.github/workflows/functional-test.yml index 2fbbc528..beae3465 100644 --- a/.github/workflows/functional-test.yml +++ b/.github/workflows/functional-test.yml @@ -77,3 +77,97 @@ jobs: path: | appium.log test/report/ + + android_test: + runs-on: ubuntu-latest + timeout-minutes: 90 + env: + API_LEVEL: 35 + ARCH: x86_64 + + steps: + - uses: actions/checkout@v6 + + - name: Set up Java + uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: '17' + + - name: Install Node.js + uses: actions/setup-node@v6 + with: + node-version: 'lts/*' + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 4.0 + + - name: Install appium + run: | + npm install -g appium + npm install -g mjpeg-consumer + + - name: Start appium + run: | + appium driver install uiautomator2 + appium plugin install images + appium plugin install execute-driver + nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors > appium.log & + + - 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: AVD cache + uses: actions/cache@v4 + id: avd-cache + with: + path: | + ~/.android/avd/* + ~/.android/adb* + key: avd-${{ env.API_LEVEL }} + + - name: Create AVD snapshot for cache + if: steps.avd-cache.outputs.cache-hit != 'true' + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: ${{ env.API_LEVEL }} + arch: ${{ env.ARCH }} + target: google_apis + force-avd-creation: false + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: false + disable-spellchecker: true + script: | + adb devices + cd android_tests + bundle install + rake android + + - name: Run Android tests + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: ${{ env.API_LEVEL }} + arch: ${{ env.ARCH }} + target: google_apis + profile: Nexus 5X + disable-animations: true + disable-spellchecker: true + script: | + adb devices + cd android_tests + bundle install + rake android + + - name: Save server output + if: ${{ always() }} + uses: actions/upload-artifact@master + with: + name: appium-android_test_with_other_deps.log + path: | + appium.log + test/report/ From 86b00cffc081d0396a125bd14887eb72face5aa7 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sun, 5 Apr 2026 18:31:05 -0700 Subject: [PATCH 2/7] use prebuilt one --- .github/workflows/functional-test.yml | 6 ++++++ android_tests/lib/run.rb | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/functional-test.yml b/.github/workflows/functional-test.yml index beae3465..e66581d5 100644 --- a/.github/workflows/functional-test.yml +++ b/.github/workflows/functional-test.yml @@ -58,6 +58,10 @@ jobs: appium plugin install execute-driver nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors > appium.log & + - run: | + npx appium driver run xcuitest download-wda-sim --platform=ios --outdir=${{ github.workspace }}/wda + name: Downloading prebuilt WDA + - name: Set up Ruby uses: ruby/setup-ruby@v1 with: @@ -68,6 +72,8 @@ jobs: name: Run tests timeout-minutes: 60 working-directory: ios_tests + env: + LOCAL_PREBUILT_WDA: ${{ github.workspace }}/wda/WebDriverAgentRunner-Runner.app - name: Save server output if: ${{ always() }} diff --git a/android_tests/lib/run.rb b/android_tests/lib/run.rb index b83fd5f3..b97505f4 100644 --- a/android_tests/lib/run.rb +++ b/android_tests/lib/run.rb @@ -65,7 +65,11 @@ def start_driver(caps) else caps.merge(appium_lib: { debug: true, wait: 1 }) end -caps[:app] = ENV.fetch('SAUCE_PATH', nil) if ENV.fetch('SAUCE_USERNAME', nil) && ENV.fetch('SAUCE_ACCESS_KEY', nil) + +if ENV['LOCAL_PREBUILT_WDA'] + caps[:caps][:usePreinstalledWDA] = true + caps[:caps][:prebuiltWDAPath] = ENV['LOCAL_PREBUILT_WDA'] +end trace_files = [] From baae5f573247aa67fe8693e29c1e199d09de52bc Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sun, 5 Apr 2026 18:35:33 -0700 Subject: [PATCH 3/7] tune task --- .github/workflows/functional-test.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/.github/workflows/functional-test.yml b/.github/workflows/functional-test.yml index e66581d5..6aef6bdc 100644 --- a/.github/workflows/functional-test.yml +++ b/.github/workflows/functional-test.yml @@ -149,22 +149,6 @@ jobs: disable-animations: false disable-spellchecker: true script: | - adb devices - cd android_tests - bundle install - rake android - - - name: Run Android tests - uses: reactivecircus/android-emulator-runner@v2 - with: - api-level: ${{ env.API_LEVEL }} - arch: ${{ env.ARCH }} - target: google_apis - profile: Nexus 5X - disable-animations: true - disable-spellchecker: true - script: | - adb devices cd android_tests bundle install rake android From c4bd3379e401b2cfc04c89b61115bbe2c7b1af73 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sun, 5 Apr 2026 18:42:00 -0700 Subject: [PATCH 4/7] use bundle exec rake --- .github/workflows/functional-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/functional-test.yml b/.github/workflows/functional-test.yml index 6aef6bdc..f67f6658 100644 --- a/.github/workflows/functional-test.yml +++ b/.github/workflows/functional-test.yml @@ -68,7 +68,7 @@ jobs: ruby-version: 4.0 - run: | bundle install - rake ios + bundle exec rake ios name: Run tests timeout-minutes: 60 working-directory: ios_tests @@ -151,7 +151,7 @@ jobs: script: | cd android_tests bundle install - rake android + bundle exec rake android - name: Save server output if: ${{ always() }} From 288a4b044509ad8c5fe79be369ab64db989a8b91 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sun, 5 Apr 2026 18:52:23 -0700 Subject: [PATCH 5/7] use pushd and popd --- .github/workflows/functional-test.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/functional-test.yml b/.github/workflows/functional-test.yml index f67f6658..f86e2ac0 100644 --- a/.github/workflows/functional-test.yml +++ b/.github/workflows/functional-test.yml @@ -149,9 +149,11 @@ jobs: disable-animations: false disable-spellchecker: true script: | - cd android_tests - bundle install - bundle exec rake android + pushd android_tests + bundle install + bundle exec rake --tasks + bundle exec rake android + popd - name: Save server output if: ${{ always() }} From aa019be4c07a7219ab4cba2b64b9dfa711a17543 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sun, 5 Apr 2026 19:20:21 -0700 Subject: [PATCH 6/7] run one script --- .github/workflows/functional-test.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/functional-test.yml b/.github/workflows/functional-test.yml index f86e2ac0..089ceb9b 100644 --- a/.github/workflows/functional-test.yml +++ b/.github/workflows/functional-test.yml @@ -147,13 +147,18 @@ jobs: force-avd-creation: false emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: false + script: echo "Generated AVD snapshot for caching." + + - name: run tests + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: ${{ env.API_LEVEL }} + arch: ${{ env.ARCH }} + script: cd android_tests;bundle install;bundle exec rake --tasks;bundle exec rake android + target: google_apis + profile: Nexus 5X disable-spellchecker: true - script: | - pushd android_tests - bundle install - bundle exec rake --tasks - bundle exec rake android - popd + disable-animations: true - name: Save server output if: ${{ always() }} From a79c83ea5fea20dc7bd65a3824a3464881e9d634 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sun, 5 Apr 2026 22:01:23 -0700 Subject: [PATCH 7/7] modify rake --- android_tests/Rakefile | 6 ++++-- ios_tests/Rakefile | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/android_tests/Rakefile b/android_tests/Rakefile index b9fab19c..89cf6593 100644 --- a/android_tests/Rakefile +++ b/android_tests/Rakefile @@ -29,10 +29,12 @@ end def bash(cmd) sh cmd do |successful, result| # exitstatus 7 means bundle install failed - # exitstatus 1 means the test failed + # non-zero (except 7 retry path) means the test failed if !successful && result.exitstatus == 7 Rake::Task['install'].execute - run_sh cmd + sh cmd + elsif !successful + raise "Command failed with status #{result.exitstatus}: #{cmd}" end end end diff --git a/ios_tests/Rakefile b/ios_tests/Rakefile index 8cde5a3a..ba135d24 100644 --- a/ios_tests/Rakefile +++ b/ios_tests/Rakefile @@ -29,10 +29,12 @@ end def bash(cmd) sh cmd do |successful, result| # exitstatus 7 means bundle install failed - # exitstatus 1 means the test failed + # non-zero (except 7 retry path) means the test failed if !successful && result.exitstatus == 7 Rake::Task['install'].execute - run_sh cmd + sh cmd + elsif !successful + raise "Command failed with status #{result.exitstatus}: #{cmd}" end end end