GitHub Actions run Espresso tests - continuous-integration

I am currently trying to get my Instrumentation tests to run using GitHub Actions. I have the unit tests running fine but I cannot seem to get the Espresso tests to run. I am currently trying:
- name: Run Instrumentation Tests (reactivecircus)
uses: reactivecircus/android-emulator-runner#v2.6.1
with:
api-level: 23
target: default
arch: x86
profile: Nexus 6
script: ./gradlew connectedCheck --stacktrace
And I get the result:
com.balsdon.ratesapp.behaviour.RateListActivityEntryBehaviourInstrumentedTest > recyclerViewClickOnItemChangesMain[test(AVD) - 6.0] FAILED
android.content.res.Resources$NotFoundException: Resource ID #0x7f0700d3
at android.content.res.Resources.getValue(Resources.java:1351)
Tests on test(AVD) - 6.0 failed: Instrumentation run failed due to 'android.content.res.Resources$NotFoundException'
> Task :app:connectedOfflinemockDebugAndroidTest FAILED
> Task :app:processOnlineecbDebugAndroidTestResources
> Task :app:processProductionDebugAndroidTestResources
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:connectedOfflinemockDebugAndroidTest'.
> There were failing tests. See the report at: file:///Users/runner/runners/2.165.2/work/currency_list_app/currency_list_app/app/build/reports/androidTests/connected/flavors/OFFLINEMOCK/index.html
and when I use:
- uses: malinskiy/action-android/emulator-run-cmd#release/0.0.5
with:
cmd: ./gradlew integrationTest
api: 23
tag: default
abi: x86
I get
/Users/runner/android-sdk/platform-tools/adb -s emulator-5554 shell getprop sys.boot_completed
error: device 'emulator-5554' not found
The process '/Users/runner/android-sdk/platform-tools/adb' failed with exit code 1
If you want to see all my attempts, you can see all the commits on my pull request

Your emulator version that you run locally, it's most likely newer than API 23 android version. On github actions script you're running the emulator using API 23:
uses: reactivecircus/android-emulator-runner#v2
with:
api-level: 23
target: default
arch: x86
profile: Nexus 6
script: ./gradlew connectedCheck --stacktrace
and inside your project there is a app/src/main/res/drawable-v24 inside resources, thus it wont be available for emulators with < 24 API version. You either have to change that directory to be drawable-v23 or you move the resources to an other drawable that older versions can access.
Even if you change the drawable directory to drawable-v23, Espresso may have issues. You'll either have to resolve for that version or you'll have to use a newer API version for your GitHub action emulator, maybe the same as you have on your development environment.

Related

Storing Artifacts From a Failed Build

I am running some screen diffing tests in one of my Cloud Build steps. The tests produce png files that I would like to view after the build, but it appears to upload artifacts on successful builds.
If my test fail, the process exits with a non-zero code, which results in this error:
ERROR: build step 0 "gcr.io/k8s-skaffold/skaffold" failed: step exited with non-zero status: 1
Which further results in another error
ERROR: (gcloud.builds.submit) build a22d1ab5-c996-49fe-a782-a74481ad5c2a completed with status "FAILURE"
And no artifacts get uploaded.
I added || true after my tests, so it exits successfully, and the artifacts get uploaded.
I want to:
A) Confirm that this behavior is expected
B) Know if there is a way to upload artifacts even if a step fails
Edit:
Here is my cloudbuild.yaml
options:
machineType: 'N1_HIGHCPU_32'
timeout: 3000s
steps:
- name: 'gcr.io/k8s-skaffold/skaffold'
env:
- 'CLOUD_BUILD=1'
entrypoint: bash
args:
- -x # print commands as they are being executed
- -c # run the following command...
- build/test/smoke/smoke-test.sh
artifacts:
objects:
location: 'gs://cloudbuild-artifacts/$BUILD_ID'
paths: [
'/workspace/build/test/cypress/screenshots/*.png'
]
Google Cloud Build doesn't allow us to upload artifacts (or run some steps ) if a build step fails. This is the expected behavior.
There is an already feature request created in Public Issue Tracker to allow us to run some steps even though the build has finished or failed. Please feel free to star it to get all the related updates on this issue.
A workaround per now is as you mentioned using || true after the tests or use || exit 0 as mentioned in this Github issue.

Getting started on Corda on Windows

I am trying to get started on Corda on Windows and I am following the started guides using the following docs:
https://docs.corda.net/quickstart-index.html#setting-up-a-development-environment
https://vimeo.com/217462250
https://docs.corda.net/getting-set-up.html
I have downloaded all the latest version (as of 22.09.19) of Git (2.23.0, 64-bit version) / Java JDK (jdk-8u221-windows-x64.exe) / and the latest IntelliJ.
However I am facing the following issues:
When I open the 'Event Log' I don't see any messages event gradle message
Also when I try and run the Nodes from Intellj > Run CordaApps Kotlin I get the following error message:
When I try and run the nodes from the Git bash terminal
Jatin#LAPTOP-16QRBJDJ MINGW64 ~/cordapp-tutorial (release-V3)
$ ./gradlew.bat deployNodes
Starting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for details
:java-source:compileJava UP-TO-DATE
:java-source:processResources UP-TO-DATE
:java-source:classes UP-TO-DATE
:java-source:configureCordappFatJar
:java-source:jar UP-TO-DATE
:java-source:deployNodes
Bootstrapping local network in C:\Users\Jatin\cordapp-tutorial\java-source\build\nodes
Node config files found in the root directory - generating node directories
Generating directory for Notary
Generating directory for PartyA
Generating directory for PartyB
Generating directory for PartyC
Nodes found in the following sub-directories: [Notary, PartyA, PartyB, PartyC]
Waiting for all nodes to generate their node-info files...
:java-source:deployNodes FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':java-source:deployNodes'.
> Node in Notary exited with 1 when generating its node-info - see logs in C:\Users\Jatin\cordapp-tutorial\java-source\build\nodes\Notary\logs
* 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 23s
5 actionable tasks: 2 executed, 3 up-to-date
The log:
CAPSULE EXCEPTION: Illegal char <"> at index 34: C:\Program Files\Java\jdk1.7.0\bin" (for stack trace, run with -Dcapsule.log=verbose)
USAGE: <options> corda.jar
Actions:
capsule.version - Prints the capsule and application versions.
capsule.modes - Prints all available capsule modes.
capsule.jvms - Prints a list of all JVM installations found.
capsule.help - Prints this help message.
Options:
capsule.mode=<value> - Picks the capsule mode to run.
capsule.reset - Resets the capsule cache before launching. The capsule to be re-extracted (if applicable), and other possibly cached files will `enter code here`be recreated.
capsule.log=<value> (default: quiet) - Picks a log level. Must be one of none, quiet, verbose, or debug.
capsule.java.home=<value> - Sets the location of the Java home (JVM installation directory) to use; If 'current' forces the use of the JVM that launched the capsule.
capsule.java.cmd=<value> - Sets the path to the Java executable to use.
capsule.jvm.args=<value> - Sets additional JVM arguments to use when running the application."
Have you set Java classpath to point to jdk1.8.0_221?
From the log record it seems that the jdk is 1.7. Corda require at least version 8u171. Please check the classpath and installed java version.
You should add Java to the PATH environment variable by following the instructions in the Oracle documentation - "https://docs.oracle.com/javase/7/docs/webnotes/install/windows/jdk-installation-windows.html#path"
Which java variant you are using?
If it is Adopt OpenJDK 8, use HotSpot JVM not the OpenJ9 Version.
Here is the link for windows x64 AdoptOpenJDK 8

NativeScript UI Autocomplete don't compiled

In my nativescript app, I have a problem about using nativescript ui autocomplete. I compile my mobile application to android apps. It has an error as below
<======-------> 50% CONFIGURING [3s]
<====---------> 35% EXECUTING [13s]
<======-------> 51% EXECUTING [20s]
Exception in thread "main" java.lang.ClassNotFoundException: Class: com.telerik.widget.autocomplete.ShowSuggestionListListener
at org.nativescript.staticbindinggenerator.Generator.getClass(Generator.java:776)
at org.nativescript.staticbindinggenerator.Generator.collectInterfaceMethods(Generator.java:703)
at org.nativescript.staticbindinggenerator.Generator.getPublicApi(Generator.java:227)und 0 errors. Watching for file changes.
at org.nativescript.staticbindinggenerator.Generator.writeBinding(Generator.java:342)
at org.nativescript.staticbindinggenerator.Generator.generateBinding(Generator.java:133)
at org.nativescript.staticbindinggenerator.Generator.processRows(Generator.java:172)
at org.nativescript.staticbindinggenerator.Generator.generateBindings(Generator.java:90)
at org.nativescript.staticbindinggenerator.Generator.writeBindings(Generator.java:66)
at org.nativescript.staticbindinggenerator.Main.main(Main.java:47)
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:runSbg'.
Process 'command '/usr/lib/jvm/java-8-openjdk-amd64/bin/java'' finished with non-zero exit value 1
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 25s
10:34:24 - Found 0 errors. Watching for file changes.
Unable to apply changes on device: 192.168.80.101:5555. Error is: Command ./gradlew failed with exit code 1.
Executing after-watch hook from /home/andre/nativescript/TigaRoda/hooks/after-watch/nativescript-dev-typescript.js
Stopping tsc watch
Executing after-watch hook from /home/andre/nativescript/TigaRoda/hooks/after-watch/nativescript-dev-webpack.js
Stopping webpack watch
delete node_modules, platforms, hooks folders and package-lock.json file
run
npm i
rebuild the project ->
tns run android
or
tns build android

How to run the Kotlin/Native win32 sample

I'm trying to run Kotlin/Native v0.3 win32 sample by following the blog at https://blog.jetbrains.com/kotlin/2017/06/kotlinnative-v0-3-is-out/
I downloaded the x86-64 Windows zip file as instructed at the end of the blog.
I run kotlin-native-windows-0.3\samples>gradlew.bat and it
downloaded something and said 'BUILD SUCCESSFUL'. (I'm not sure if
this step is necessary)
2.1 But If I run kotlin-native-windows-0.3\samples>gradlew build
in this folder, I got some failures:
C:\Users\OO\Documents\kotlin-native-windows-0.3\samples>gradlew build
:concurrent:assemble UP-TO-DATE
:concurrent:check UP-TO-DATE
:concurrent:downloadKonanCompiler
:concurrent:genMessageChannelInteropStubs UP-TO-DATE
:concurrent:compileCpp FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':concurrent:compileCpp'.
A problem occurred starting process 'command './buildCpp.sh''
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Then I run kotlin-native-windows-0.3\samples\win32>build.bat and I
got another error.
C:\Users\OO\Documents\kotlin-native-windows-0.3\samples\win32>build.bat
exception: java.lang.IllegalStateException: Could not find "win32" in [C:\Users\OO\Documents\kotlin-native-windows-0.3\samples\win32, C:\Users\OO\.konan\klib, C:\Users\OO\DOCUME~1\KOTLIN~1.3\bin\..\klib].
at org.jetbrains.kotlin.backend.konan.library.KonanLibrarySearchPathResolver.resolve(SearchPathResolver.kt:71)
at org.jetbrains.kotlin.backend.konan.KonanConfig$librariesFound$2.invoke(KonanConfig.kt:70)
at org.jetbrains.kotlin.backend.konan.KonanConfig$librariesFound$2.invoke(KonanConfig.kt:34)
at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:130)
at org.jetbrains.kotlin.backend.konan.KonanConfig.getLibrariesFound(KonanConfig.kt)
at org.jetbrains.kotlin.backend.konan.KonanConfig.access$getLibrariesFound$p(KonanConfig.kt:34)
at org.jetbrains.kotlin.backend.konan.KonanConfig$libraries$2.invoke(KonanConfig.kt:77)
at org.jetbrains.kotlin.backend.konan.KonanConfig$libraries$2.invoke(KonanConfig.kt:34)
at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:130)
at org.jetbrains.kotlin.backend.konan.KonanConfig.getLibraries$backend_native_compiler(KonanConfig.kt)
at org.jetbrains.kotlin.backend.konan.KonanConfig.loadLibMetadata(KonanConfig.kt:90)
at org.jetbrains.kotlin.backend.konan.KonanConfig.<init>(KonanConfig.kt:80)
at org.jetbrains.kotlin.cli.bc.K2Native.doExecute(K2Native.kt:66)
at org.jetbrains.kotlin.cli.bc.K2Native.doExecute(K2Native.kt:56)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:93)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:46)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:90)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:68)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:34)
at org.jetbrains.kotlin.cli.common.CLITool$Companion.doMainNoExit(CLITool.kt:160)
at org.jetbrains.kotlin.cli.common.CLITool$Companion.doMain(CLITool.kt:151)
at org.jetbrains.kotlin.cli.bc.K2Native$Companion$main$1.invoke(K2Native.kt:169)
at org.jetbrains.kotlin.cli.bc.K2Native$Companion$main$1.invoke(K2Native.kt:166)
at org.jetbrains.kotlin.backend.konan.util.UtilKt.profileIf(util.kt:33)
at org.jetbrains.kotlin.backend.konan.util.UtilKt.profile(util.kt:28)
at org.jetbrains.kotlin.cli.bc.K2Native$Companion.main(K2Native.kt:168)
at org.jetbrains.kotlin.cli.bc.K2NativeKt.main(K2Native.kt:174)
at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:46)
I'm very new to Kotlin or Gradle world, I don't know if this is the way to compile the samples.
What additional packages should I install?
It can be easily solved by canceled the comments "rem call ..." in "build.bat"

How I should configure Gradle Android Library for Travis CI

I'm developing an android library.
My project is using Gradle and don't have any application modules. Just library.
I've connected this one to the Travis CI but every my push console was showing that my building process has been failing.
This is my travis.yml
language: android
android:
components:
- build-tools-22.0.1
- android-22
- extra-android-m2repository
licenses:
- android-sdk-license-.+
before_install:
- chmod +x gradlew
before_script:
- echo no | android create avd --force -n test -t android-21 --abi armeabi-v7a
- emulator -avd test -no-skin -no-audio -no-window &
- curl http://is.gd/android_wait_for_emulator > android-wait-for-emulator
- chmod u+x android-wait-for-emulator
- ./android-wait-for-emulator
- adb shell input keyevent 82 &
And error I got:
* What went wrong:
Execution failed for task ':library:connectedAndroidTest'.
com.android.builder.testing.ConnectedDevice > runTests[test(AVD) - 5.0] FAILED
com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: Failed to establish session
at com.android.builder.testing.ConnectedDevice.installPackages(ConnectedDevice.java:108)
null
So do I must do to resolve this problem? Thanks!
Add atleast one image file in your travis.yml like this
- sys-img-armeabi-v7a-android-19
- sys-img-x86-android-17

Resources