Giter Club home page Giter Club logo

Comments (14)

hannesa2 avatar hannesa2 commented on August 22, 2024 4

Just for the records, this is the final way I go without color noise

      script: |
        adb logcat -c
        adb logcat *:E &
        ./gradlew cAT

Thank you !

from android-emulator-runner.

ychescale9 avatar ychescale9 commented on August 22, 2024

The action supports multi-line script, e.g.

script: |
  ./gradlew connectedCheck
  adb logcat

from android-emulator-runner.

hannesa2 avatar hannesa2 commented on August 22, 2024

Yes, I tried it

  - name: Android Emulator test
    uses: ReactiveCircus/[email protected]
    with:
      api-level: 28
      disable-animations: true
      arch: x86_64
      profile: Nexus 6
      script: |
        ./gradlew cAT
        echo ${{ github.workspace }}
        ls ${{ github.workspace }} -la
        adb logcat -d > ${{ github.workspace }}/owncloudApp/build/reports/androidTests/connected/logcat.txt
  - uses: actions/upload-artifact@v2
    if: failure()
    with:
      name: owncloudApp-Espresso-test-report
      path: ${{ github.workspace }}/owncloudApp/build/reports/androidTests/connected/*

But when you look into job https://github.com/hannesa2/owncloud-android/pull/5/checks?check_run_id=701706066 you see, the command is fired before the ./gradlew cAT is finished (when I understood right). --> useless

from android-emulator-runner.

ychescale9 avatar ychescale9 commented on August 22, 2024

I think the commands you are referring to are just printed at the start of the action but not executed, due to the gradlew cAT command failing and the step finishing early. What happens if you move those commands to a separate if failure() step after the “Android Emulator test” step and before the upload-artifact step?

from android-emulator-runner.

hannesa2 avatar hannesa2 commented on August 22, 2024

What happens if you move those commands to a separate if failure() step after the “Android Emulator test” step and before the upload-artifact step?

Sorry there is no point doing it, the emulator is killed in step Android Emulator test
image

any adb command will not work anymore.

To be honest, I see only a solution in android-emulator-runner to separate processes in multi line scripts. But I'm to dump to do this, I guess @ychescale9 you are the right person !

from android-emulator-runner.

ychescale9 avatar ychescale9 commented on August 22, 2024

Right now the action will exit with a failure whenever the script throws a non-0 exit code. I guess we could instead cache the error and still have the action execute the rest of the scripts and throws the error at the end. But I think it's much better to just write a custom script to catch the error instead of having the action does this by default which is not the expected behavior for most people.

I just had a another look at your workflow and looks like you can just do the following?

script: |
  adb logcat > ${{ github.workspace }}/owncloudApp/build/reports/androidTests/connected/logcat.txt &
  ./gradlew cAT

from android-emulator-runner.

hannesa2 avatar hannesa2 commented on August 22, 2024

I guess we could instead cache the error and still have the action execute the rest of the scripts and throws the error at the end.

This is in my point of view the most elegant solution

But I think it's much better to just write a custom script to catch the error

Following this idea how can I use ${{ github.workspace }} in a shell script ?

script: |
  adb logcat -d > ${{ github.workspace }}/owncloudApp/build/reports/androidTests/connected/logcat.txt
  ./gradlew cAT

Sorry, this adb logcat ... must be run after ./gradlew cAT and not before

from android-emulator-runner.

ychescale9 avatar ychescale9 commented on August 22, 2024

Sorry you need to continuously stream logcat in the background. Updated the snippet above.

from android-emulator-runner.

ychescale9 avatar ychescale9 commented on August 22, 2024

And if you just do:

adb logcat -c
adb logcat *:E -v color &
./gradlew connectedCheck

You'll be able to see the error logs from logcat since you started running ./gradlew connectedCheck all from the console log without having to upload and download them.

from android-emulator-runner.

hannesa2 avatar hannesa2 commented on August 22, 2024

Sorry you need to continuously stream logcat in the background. Updated the snippet above.

That's a smart idea !

      script: |
        adb logcat > ${{ github.workspace }}/owncloudApp/build/reports/androidTests/connected/logcat.txt &
        ./gradlew cAT

But it don't upload logcat.txt I've no clue why

https://github.com/hannesa2/owncloud-android/pull/5/checks?check_run_id=703292637

... now I try the second proposal with direct print to console

from android-emulator-runner.

hannesa2 avatar hannesa2 commented on August 22, 2024

Btw, this
./gradlew cAT || adb logcat -d > ${{ github.workspace }}/owncloudApp/build/reports/androidTests/connected/logcat.txt
uploads the logcat.txt but then the job is always successful

from android-emulator-runner.

hannesa2 avatar hannesa2 commented on August 22, 2024

And if you just do:

adb logcat -c
adb logcat *:E -v color &
./gradlew connectedCheck

You'll be able to see the error logs from logcat since you started running ./gradlew connectedCheck all from the console log without having to upload and download them.

Works ! But the color output is useless

https://github.com/hannesa2/owncloud-android/pull/5/checks?check_run_id=703314765

from android-emulator-runner.

ychescale9 avatar ychescale9 commented on August 22, 2024

Great! I haven't done adb for a while and I know there are a lot of things you can do like filtering the logs with tag etc.

from android-emulator-runner.

ychescale9 avatar ychescale9 commented on August 22, 2024

I'm going to close this issue now. Please feel free to re-open or create another one if you run into other issues 😃

from android-emulator-runner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.