Skip to content

CI Integration

SensorChaos is designed to run in CI. The CLI exits with code 1 when assertions fail, reports are machine-readable JSON, and the agent works inside emulators and simulators on standard hosted runners.

Ready-made templates live in the repository under examples/:

examples/
github-actions/
sensorchaos-android.yml # Android emulator on ubuntu-latest
sensorchaos-ios.yml # iOS simulator on macos-latest
gitlab-ci/
sensorchaos.gitlab-ci.yml # Android + iOS jobs

Go to Settings → Secrets and variables → Actions → New repository secret:

NameValue
SENSORCHAOS_KEYYour sc_live_... or sc_trial_... key

Copy examples/github-actions/sensorchaos-android.yml to .github/workflows/ in your app repository. Then update the two placeholders marked with comments:

# Replace with your APK build command
- name: Build debug APK
run: ./gradlew assembleDebug --no-daemon
# Replace with your APK path and app package name
- adb install -r app/build/outputs/apk/debug/app-debug.apk
- adb shell am start -n com.example.yourapp/.MainActivity

Edit the sensorchaos suite call to match your test requirements:

Terminal window
sensorchaos suite \
--scenarios gnss/gulf-spoofing-2026,gnss/urban-canyon \
--agent \
--assert-max-position-error-km 5 \
--assert-no-crash \
--report sensorchaos-report.json \
--exit-code-on-fail \
--no-progress
FlagWhat it checks
--assert-max-position-error-km <km>Fails if the app reports a position more than <km> from the baseline. Useful for detecting spoofing acceptance.
--assert-no-crashFails if any critical findings are recorded (app crash or unhandled signal loss).
--exit-code-on-failRequired to actually fail the CI job on assertion violations.
--no-progressSuppresses the interactive progress bar — always use this in CI.

Run a single scenario instead of a suite with sensorchaos run:

Terminal window
sensorchaos run gnss/gulf-spoofing-2026 \
--agent \
--assert-max-position-error-km 5 \
--report report.json \
--exit-code-on-fail \
--no-progress

Both templates upload sensorchaos-report.json as a CI artifact on every run (including failures). The JSON report contains the full event timeline, resilience score, and per-assertion breakdown — useful for tracking score trends across releases.

PlatformRunnerNotes
Android emulatorubuntu-latest (GitHub) / self-hosted Linux + KVM (GitLab)KVM must be available for hardware acceleration. GitHub-hosted runners include KVM support.
iOS simulatormacos-latest (GitHub) / saas-macos-medium-m1 (GitLab)Xcode must be installed.