Skip to content

T1 workflow: keep the device log of the experiments run. #3

T1 workflow: keep the device log of the experiments run.

T1 workflow: keep the device log of the experiments run. #3

Workflow file for this run

# T1 of the phyphox test strategy: the suites that need a running app. They drive an emulator
# from the host over adb and the remote API, so every job below is one command a developer can
# run locally against an emulator or a device first - the workflow only arranges the emulator,
# the sibling phyphox-docs checkout and the app install around it.
#
# Not on every push and never on a schedule: an emulator run costs minutes of CI time, and a
# nightly cron would report failures nobody asked for. Development and release branches, plus
# manual dispatch, are enough - T0 (test.yml) covers every push.
#
# The app serves the remote API for these runs through the shell-only debug.phyphox.* properties
# (see DebugSwitches in the app sources); the drivers set and clear them themselves.
#
# API 36, one below the app's targetSdk 37: there are no emulator images for 37 yet. When they
# arrive, the remote server also needs ACCESS_LOCAL_NETWORK, which an unattended run has to grant
# with "adb shell pm grant" - the interactive request in the menu path cannot answer itself.
name: t1
on:
push:
branches: [development, 'release/**']
workflow_dispatch:
env:
API_LEVEL: 36
EMULATOR_ARCH: x86_64
EMULATOR_TARGET: google_apis
jobs:
remote-contract:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v5
with:
path: phyphox-android
submodules: recursive
- uses: actions/checkout@v5
with:
repository: phyphox/phyphox-docs
path: phyphox-docs
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 21
cache: gradle
- 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: Install the contract test's dependencies
run: pip install pyyaml 'jsonschema>=4.18'
# phyphox-test: remote-contract-t1
- name: Remote interface contract test
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.API_LEVEL }}
arch: ${{ env.EMULATOR_ARCH }}
target: ${{ env.EMULATOR_TARGET }}
script: |
cd phyphox-android && ./gradlew installRegularDebug && cd ..
adb shell setprop debug.phyphox.remote 1
adb shell setprop debug.phyphox.remotePort 8080
adb shell am start -a android.intent.action.VIEW -d "phyphox://asset=accelerometer.phyphox"
adb forward tcp:8080 tcp:8080
# Wait for the experiment to be up and serving before probing it.
for i in $(seq 1 30); do curl -sf http://127.0.0.1:8080/config > /dev/null && break; sleep 1; done
python3 phyphox-docs/tools/contract_test.py --android http://127.0.0.1:8080 --allow-control
adb shell setprop debug.phyphox.remote '""'
experiments-e2e:
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- uses: actions/checkout@v5
with:
path: phyphox-android
submodules: recursive
- uses: actions/checkout@v5
with:
repository: phyphox/phyphox-docs
path: phyphox-docs
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 21
cache: gradle
- 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
# phyphox-test: experiments-e2e-t1
- name: Shipped experiments end to end
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.API_LEVEL }}
arch: ${{ env.EMULATOR_ARCH }}
target: ${{ env.EMULATOR_TARGET }}
script: |
cd phyphox-android && ./gradlew installRegularDebug && cd ..
# An unattended run cannot answer a runtime permission dialog, and an experiment
# that asks for one never finishes loading - the audio, GPS and depth experiments
# would all report "remote API not reachable" instead of being tested.
for p in RECORD_AUDIO ACCESS_FINE_LOCATION ACCESS_COARSE_LOCATION CAMERA; do
adb shell pm grant de.rwth_aachen.phyphox android.permission.$p || true
done
# Keep the device log whatever the driver says: the failures that only show up
# here - an experiment whose remote API never comes up, an app that stops
# answering mid-run - cannot be told apart from a slow emulator without it.
set +e
python3 phyphox-docs/tools/t1_experiments.py --platform android --emulator --require-rows
rc=$?
adb logcat -d > logcat-experiments.txt
adb logcat -d -b crash > logcat-experiments-crash.txt
exit $rc
- name: Keep the per-experiment results
if: always()
uses: actions/upload-artifact@v4
with:
name: t1-experiments-results
path: |
t1-results.json
logcat-experiments.txt
logcat-experiments-crash.txt
if-no-files-found: ignore
network-fixtures:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v5
with:
path: phyphox-android
submodules: recursive
- uses: actions/checkout@v5
with:
repository: phyphox/phyphox-docs
path: phyphox-docs
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 21
cache: gradle
- 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: Install mosquitto
# The driver starts its own broker with the fixture's configuration, so the packaged
# service must not sit on port 1883.
run: |
sudo apt-get update
sudo apt-get install -y mosquitto
sudo systemctl disable --now mosquitto || true
# phyphox-test: network-http
# phyphox-test: network-mqtt
- name: Network fixtures
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.API_LEVEL }}
arch: ${{ env.EMULATOR_ARCH }}
target: ${{ env.EMULATOR_TARGET }}
script: |
cd phyphox-android && ./gradlew installRegularDebug && cd ..
python3 phyphox-android/tools/t1_network_fixtures.py --docs phyphox-docs --out network-fixtures.json
- name: Keep the per-fixture results
if: always()
uses: actions/upload-artifact@v4
with:
name: t1-network-fixture-results
path: network-fixtures.json
if-no-files-found: ignore