Reduce more code redundancies #50
This file contains hidden or 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
| # T1 of the phyphox test strategy: the suites that need a running app, driven over adb and the | |
| # remote API (enabled via the shell-only debug.phyphox.* properties, see DebugSwitches). API 36 | |
| # until emulator images for targetSdk 37 exist; those will also need ACCESS_LOCAL_NETWORK granted. | |
| name: t1 | |
| on: | |
| push: | |
| branches: [development, 'release/**'] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} | |
| 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 }} | |
| ram-size: 4096M | |
| 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 | |
| for i in $(seq 1 30); do curl -sf http://127.0.0.1:8080/config > /dev/null && break; sleep 1; done | |
| sh phyphox-android/tools/t1_ci_run.sh remote-contract python3 phyphox-docs/tools/contract_test.py --android http://127.0.0.1:8080 --allow-control | |
| adb shell setprop debug.phyphox.remote '""' || true | |
| - name: Keep the device log | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: t1-remote-contract-logs | |
| path: logcat-remote-contract*.txt | |
| if-no-files-found: ignore | |
| experiments-e2e: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 90 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shard: ["1/2", "2/2"] | |
| name: experiments-e2e (${{ matrix.shard }}) | |
| 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 }} | |
| ram-size: 4096M | |
| # Each script line runs in its own shell, hence the wrapper script for log and exit code. | |
| script: | | |
| cd phyphox-android && ./gradlew installRegularDebug && cd .. | |
| sh phyphox-android/tools/t1_ci_run.sh experiments python3 phyphox-docs/tools/t1_experiments.py --platform android --emulator --require-rows --shard ${{ matrix.shard }} | |
| - name: Keep the per-experiment results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: t1-experiments-results-${{ strategy.job-index }} | |
| path: | | |
| t1-results.json | |
| logcat-experiments*.txt | |
| if-no-files-found: ignore | |
| view-and-chrome-suites: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 90 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - suite: chrome | |
| profile: pixel_6 | |
| device: phone | |
| - suite: chrome | |
| profile: 10.1in WXGA (Tablet) | |
| device: tablet | |
| - suite: translations | |
| profile: pixel_6 | |
| device: phone | |
| - suite: translations | |
| profile: 10.1in WXGA (Tablet) | |
| device: tablet | |
| name: view-and-chrome-suites (${{ matrix.suite }}, ${{ matrix.device }}) | |
| 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 | |
| # The chrome selection: | |
| # phyphox-test: graph-snapshots | |
| # phyphox-test: view-behavior | |
| # phyphox-test: app-chrome | |
| # phyphox-test: lifecycle | |
| # phyphox-test: accessibility-smoke | |
| # phyphox-test: switch-bypassed-ui | |
| # phyphox-test: save-to-collection | |
| # and the translations selection: | |
| # phyphox-test: translations-ui | |
| - name: ${{ matrix.suite }} suites | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: ${{ env.API_LEVEL }} | |
| arch: ${{ env.EMULATOR_ARCH }} | |
| target: ${{ env.EMULATOR_TARGET }} | |
| profile: ${{ matrix.profile }} | |
| ram-size: 4096M | |
| script: | | |
| sh phyphox-android/tools/t1_instrumented.sh phyphox-android ${{ matrix.suite }} | |
| - name: Keep the device log and the captured screens | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: t1-instrumented-logs-${{ matrix.suite }}-${{ matrix.device }} | |
| path: | | |
| logcat-instrumented*.txt | |
| instrumented-*.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; the packaged service must not hold 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 }} | |
| ram-size: 4096M | |
| script: | | |
| cd phyphox-android && ./gradlew installRegularDebug && cd .. | |
| sh phyphox-android/tools/t1_ci_run.sh network-fixtures 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 | |
| logcat-network-fixtures*.txt | |
| if-no-files-found: ignore |