name: CUA Smoke Test on: workflow_dispatch: push: branches: [main] tags: ["v*"] paths: - "scripts/android-cua-smoke.py" - "src/**" - "app/**" - ".github/workflows/cua-smoke.yml" jobs: cua-test: runs-on: ubuntu-latest timeout-minutes: 45 env: AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }} AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }} AZURE_OPENAI_API_VERSION: "2024-08-01-preview" # Android emulator reaches the runner host loopback via 10.0.2.2. # A real `opencode serve` runs on the host (see steps below), making this a true E2E. OPENCODE_URL: "http://10.0.2.2:4096" ARCHIVEBOX_URL: ${{ secrets.ARCHIVEBOX_URL }} ARCHIVEBOX_API_KEY: ${{ secrets.ARCHIVEBOX_API_KEY }} steps: - uses: actions/checkout@v6 - uses: actions/setup-node@v6 with: node-version: 20 cache: npm - uses: actions/setup-java@v5 with: distribution: temurin java-version: 17 - name: Setup Android SDK uses: android-actions/setup-android@v4 - name: Enable KVM 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: Cache Gradle uses: actions/cache@v5 with: path: | ~/.gradle/caches ~/.gradle/wrapper android/.gradle key: ${{ runner.os }}-gradle-${{ hashFiles('android/**/*.gradle*', 'android/gradle/wrapper/gradle-wrapper.properties') }} restore-keys: | ${{ runner.os }}-gradle- - name: Install dependencies & build APK env: SENTRY_DISABLE_AUTO_UPLOAD: "true" run: | npm install --legacy-peer-deps npx expo prebuild --platform android --no-install keytool -genkey -v -keystore android/app/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=Android Debug,O=Android,C=US" cd android && ./gradlew assembleRelease - name: Install Python deps run: pip install openai - name: Install & start opencode server on runner host run: | npm install -g opencode-ai # Bind all interfaces so the emulator can reach it via 10.0.2.2. nohup opencode serve --hostname 0.0.0.0 --port 4096 > /tmp/opencode-server.log 2>&1 & echo "Waiting for opencode server /global/health ..." for i in $(seq 1 60); do if curl -sf http://127.0.0.1:4096/global/health > /dev/null; then echo "opencode server healthy after ${i}s"; break fi sleep 1 done curl -sf http://127.0.0.1:4096/global/health || { echo "::error::opencode server failed to become healthy"; cat /tmp/opencode-server.log; exit 1; } - name: Run CUA smoke test with emulator uses: reactivecircus/android-emulator-runner@v2 with: api-level: 30 arch: x86_64 target: google_apis emulator-options: -no-window -no-audio -no-boot-anim -gpu swiftshader_indirect -no-snapshot # NOTE: android-emulator-runner runs this script with /usr/bin/sh (dash). # Avoid bash-only constructs like multi-line `|| { ... }` brace groups. script: | # Non-fatal re-check; server health was already gated in the prior step. curl -sf http://127.0.0.1:4096/global/health || echo "WARN: opencode health re-check failed (started in prior step)" adb install android/app/build/outputs/apk/release/app-release.apk adb shell am start -n cc.agentlabs.opencode/.MainActivity sleep 5 # True E2E: app connects to the local opencode server (10.0.2.2:4096) and verifies the session list. python3 scripts/android-cua-smoke.py --model gpt-5.4 --include-xml --only-connect-scenario - name: opencode server log if: always() run: cat /tmp/opencode-server.log || true - name: Upload test artifacts if: always() uses: actions/upload-artifact@v7 with: name: cua-artifacts-${{ github.run_number }} path: | /tmp/cua_*.png /tmp/cua_*.mp4 if-no-files-found: ignore