#!/usr/bin/env bash # The app's CI job (#19), in OxygenFlow's Android image with no network: # unit tests with coverage and a debug build. Not the screenshot tests: # their references change with the clock, so are not kept, and CI would # have nothing to compare a screen with. Gradle runs every task even when # one fails (--continue), so the reports are written either way: # junit.xml every unit test class's JUnit XML in one # coverage.xml JaCoCo XML of the unit tests, for the Coverage tab set -u cd "$(dirname "$0")/.." status=0 gradle --offline --no-daemon --continue \ :app:createDebugUnitTestCoverageReport \ :app:assembleDebug || status=$? { echo '' echo '' for f in app/build/test-results/testDebugUnitTest/TEST-*.xml; do [ -f "$f" ] && sed '/^' } > junit.xml report=app/build/reports/coverage/test/debug/report.xml if [ -f "$report" ]; then cp "$report" coverage.xml else echo "ci: no coverage report at $report" >&2 [ "$status" -ne 0 ] || status=1 fi exit "$status"