Skip to main content

03 - Testing and CI

1. Why​

Sinew's tests run in commonTest wherever possible, and on each platform where behavior differs: secure storage, crypto, biometrics, the network checker, engine errors. CI has to run all of them, enforce the dependency graph and the ABI, and prove that production builds carry no devtools.

2. Shape​

JobRunnerRuns
jvm-androidubuntu./gradlew check for android (host tests) and jvm: unit tests, checkKotlinAbi, checkSinewGraph, Detekt, Kover (80% floor)
android-deviceubuntu + emulator (android-emulator-runner, API 35 google_apis, KVM)instrumented tests: FieldCipher on the Keystore and a lost master key, SecureStore and Android's SQLite errors, the network checker switching Wi-Fi and data. The biometric tests skip themselves there and run through tool/android-biometric-test.sh
iosmacos./gradlew iosSimulatorArm64Test, plus the Keychain, CryptoKit and biometric tests on a simulator, plus (from S5) an xcodebuild of the iOS sample
webubuntu./gradlew wasmJsBrowserTest in headless Chrome
devtools-gatingubuntu (Android, desktop, web) + macos (iOS)checkDevToolsGating builds the sample's production outputs (the Android production release APK, the desktop uber jar, the wasm production bundle, the iosArm64 release framework) and fails if any holds a com.srctool.sinew.devtools declaration the no-op doesn't declare. The real-devtools outputs (the Android staging release, and the rest with -Psinew.devtools=true) are checked the opposite way. The ABI parity of the no-op is checkDevtoolsNoopAbi, in jvm-android
publishmacos, on tagssee Publishing
RuleWhy
Test first by default. A test written after the code must be seen failing once. Bug fixes are always test-first.The base testing rules
80% line coverage per module, measured by Kover on the JVM runThe floor from the base note
Every job uses the Gradle build cache and the configuration cacheFour targets make the build slow otherwise
The web job is required, unlike Camouflage'sSinew's web code is mostly plain Kotlin/Wasm. The Compose modules (-l10n, -viewmodel, -camouflage, -devtools-ui) are tested on web too, but their web screenshots aren't tested

3. API​

Gradle tasks CI calls: check, checkKotlinAbi, checkSinewGraph, koverVerify, iosSimulatorArm64Test, wasmJsBrowserTest, checkDevtoolsNoopAbi, checkDevToolsGating (wrapping checkDevToolsGatingAndroid, …Desktop, …Web, and on macOS …Ios), publishAndReleaseToMavenCentral.

4. Build steps​

  1. The jvm-android job at S0, with everything that runs on the JVM.
  2. ios and web jobs at S0, on placeholder tests.
  3. android-device at S4, when secure storage and biometrics exist.
  4. devtools-gating at S6.

Done when

  • All jobs are green on main, and the gating job fails on a branch that adds the real devtools to the production variant.

5. Edge cases​

CaseDecided behavior
A flaky emulator biometric testIt's retried once by the job. Twice flaky in a week means it's fixed or quarantined, never ignored.
Coverage drops below 80% on a modulekoverVerify fails the job.
Decided by default (revisit during implementation)
  • The web job is required for Sinew. Unlike Camouflage, Sinew's web code doesn't depend on Compose web's Beta status.