diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b3bd0414fdca2c56d844156664cc111e8173994f..61c5e2e3a51b03a05d441ce3147f18a95a14c984 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,6 +8,7 @@ before_script: - export GRADLE_USER_HOME=$(pwd)/.gradle - chmod +x ./gradlew + # Debug build related jobs buildDebug: stage: debug @@ -17,6 +18,19 @@ buildDebug: paths: - app/build/outputs/apk/debug/ +test: + allow_failure: true + stage: debug + script: + - ./gradlew test -PtestAccountName="$testAccountName" -PtestAccountPwd="$testAccountPwd" -PtestServerUrl="$testServerUrl" + artifacts: + when: always + paths: + - app/build/test-results/*/TEST-*.xml + - app/build/reports/tests/* + reports: + junit: app/build/test-results/*/TEST-*.xml + # Default lint configuration for debug builds # Manual as we don't want to run them generally for debug builds .lintDebugDefault: diff --git a/app/build.gradle b/app/build.gradle index 79c8acd73468e89120bf7f4dee165e098903d7db..97ac3b43b7b1507fd09d581f1d61de754af24ca9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -106,6 +106,7 @@ kapt { allOpen { // allows mocking for classes w/o directly opening them for release builds annotation 'foundation.e.apps.OpenClass' + annotation 'foundation.e.apps.OpenForTesting' } dependencies { diff --git a/app/src/debug/java/foundation/e/apps/OpenForTesting.kt b/app/src/debug/java/foundation/e/apps/OpenForTesting.kt index d7facea95e6df64636ff04a462afddc234cb0494..cea56ce8a120899fa22a25f5ceb0773645442728 100644 --- a/app/src/debug/java/foundation/e/apps/OpenForTesting.kt +++ b/app/src/debug/java/foundation/e/apps/OpenForTesting.kt @@ -21,12 +21,12 @@ package foundation.e.apps * This annotation allows us to open some classes for mocking purposes while they are final in * release builds. */ -@Target(AnnotationTarget.ANNOTATION_CLASS) +@Target(allowedTargets = [AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.CLASS]) annotation class OpenClass /** * Annotate a class with [OpenForTesting] if you want it to be extendable in debug builds. */ @OpenClass -@Target(AnnotationTarget.CLASS) +@Target(allowedTargets = [AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.CLASS]) annotation class OpenForTesting diff --git a/app/src/release/java/foundation/e/apps/OpenForTesting.kt b/app/src/release/java/foundation/e/apps/OpenForTesting.kt index 372dc732db5e38129be837e6974ca84cc26f1877..eef9a7fd7d367b8ba9a2cf6e947c7f63949a8761 100644 --- a/app/src/release/java/foundation/e/apps/OpenForTesting.kt +++ b/app/src/release/java/foundation/e/apps/OpenForTesting.kt @@ -17,5 +17,5 @@ package foundation.e.apps -@Target(AnnotationTarget.CLASS) +@Target(allowedTargets = [AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.CLASS]) annotation class OpenForTesting