touchlab / KaMPKit

KaMP Kit by Touchlab. A collection of code & tools designed to get your mobile team started quickly w/Kotlin Multiplatform
https://touchlab.co/
Apache License 2.0
2.2k stars 199 forks source link

Slow build and failed tests #125

Closed AlexTrotsenko closed 4 years ago

AlexTrotsenko commented 4 years ago

I am trying to have 1st build of KaMPKit. I was able to successfully build and run it in Android Studio.

Now I am trying to run 1st optional step of iOS build. I have already downloaded and run XCode 11.5.

For unknown reasons the build takes too long and all tests are failing.

Just in case I am running the build on MacBook Pro 16" (2019), MacOS Catalina 10.15.4.

$ ./gradlew clean build
> Task :shared:testReleaseUnitTest

...

> Task :shared:testReleaseUnitTest

co.touchlab.kampkit.KoinTest > checkAllModules FAILED
    org.apache.tools.ant.BuildException
        Caused by: org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException

co.touchlab.kampkit.ConcurrencyTest > testMain FAILED
    org.apache.tools.ant.BuildException
        Caused by: org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException

co.touchlab.kampkit.BreedModelTest > updateFavoriteTest FAILED
    org.apache.tools.ant.BuildException
        Caused by: org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException

co.touchlab.kampkit.BreedModelTest > notifyErrorOnException FAILED
    org.apache.tools.ant.BuildException
        Caused by: org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException

co.touchlab.kampkit.BreedModelTest > staleDataCheckTest FAILED
    org.apache.tools.ant.BuildException
        Caused by: org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException

co.touchlab.kampkit.SqlDelightTest > Select All Items Success FAILED
    org.apache.tools.ant.BuildException
        Caused by: org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException

co.touchlab.kampkit.SqlDelightTest > Update Favorite Success FAILED
    org.apache.tools.ant.BuildException
        Caused by: org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException

co.touchlab.kampkit.SqlDelightTest > Select Item by Id Success FAILED
    org.apache.tools.ant.BuildException
        Caused by: org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException

co.touchlab.kampkit.SqlDelightTest > Delete All Success FAILED
    org.apache.tools.ant.BuildException
        Caused by: org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException

9 tests completed, 9 failed

> Task :shared:testReleaseUnitTest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':shared:testReleaseUnitTest'.
> There were failing tests. See the report at: file:///Users/otrotsenko/dev/repos/3rd_party/kmp/KaMPKit/shared/build/reports/tests/testReleaseUnitTest/index.html

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 47m 53s

And then in the index.html for each test I see the same:

Unable to resolve artifact: Missing:
----------
1) org.robolectric:android-all:jar:4.1.2_r1-robolectric-r1

  Try downloading the file manually from the project website.

  Then, install it using the command: 
      mvn install:install-file -DgroupId=org.robolectric -DartifactId=android-all -Dversion=4.1.2_r1-robolectric-r1 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there: 
      mvn deploy:deploy-file -DgroupId=org.robolectric -DartifactId=android-all -Dversion=4.1.2_r1-robolectric-r1 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency: 
    1) org.apache.maven:super-pom:pom:2.0
    2) org.robolectric:android-all:jar:4.1.2_r1-robolectric-r1

----------
1 required artifact is missing.

for artifact: 
  org.apache.maven:super-pom:pom:2.0

from the specified remote repositories:
  adeya.central (https://nexus.adeya.ch/content/repositories/adeya.central/)

    at org.apache.maven.artifact.ant.DependenciesTask.doExecuteResolution(DependenciesTask.java:268)
AlexTrotsenko commented 4 years ago

Just in case, when I run the build 2nd time - it completed successfully.
It's a bit weird since I have changed nothing.

$ ./gradlew build

> Configure project :shared
Kotlin Multiplatform Projects are an experimental feature.

> Task :app:lint
Ran lint on variant debug: 0 issues found
Ran lint on variant release: 0 issues found

> Task :shared:iosTest
2020-08-01 16:23:12.972 test.kexe[57333:3251256] Verbose: (KampKit) App Id Test

> Task :shared:lint
Ran lint on variant release: 0 issues found
Ran lint on variant debug: 0 issues found

BUILD SUCCESSFUL in 6s
150 actionable tasks: 8 executed, 142 up-to-date
kpgalligan commented 4 years ago

This is all Android/JVM side stuff. testReleaseUnitTest is an Android thing, as is org.robolectric:android-all:jar:4.1.2_r1-robolectric-r1. I think best move at this point is to see if 1.4 improves the situation.

samhill303 commented 4 years ago

Closing for now, seems to have been an issue with android/kotlin plugins. Let us know if this comes up again or is repeatable.

AlexTrotsenko commented 4 years ago

@kpgalligan , @samhill303 thanks for you reply and support. Looks like it was Indeed just temporary issue (perhaps it was caused by my build environment). I was also able to build successfully the project on my another MacBook.

On the other note: would you mind to restrict execution time of JUnit tests? E.g. by using @Rule Timeout in the actual BaseTest? As you see, it took 47 minutes to finish the build with an error. It might be confusing for other if it happens again.

I am volunteering to submit the MR if you find this restriction reasonable.

samhill303 commented 4 years ago

@AlexTrotsenko That seems reasonable, just wouldn't want to make it too short and get flaky tests