Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Android Tests on Github Actions (Ubuntu) #3860

Open
pavelbabenko opened this issue Jan 20, 2023 · 7 comments
Open

Android Tests on Github Actions (Ubuntu) #3860

pavelbabenko opened this issue Jan 20, 2023 · 7 comments

Comments

@pavelbabenko
Copy link

Description

Hi!
I'm trying to run detox tests on Github actions with Ubuntu and having an issue
Could you help me with it?
Here is a log:

Run borales/actions-yarn@v4
/usr/local/bin/yarn e2e:and:ci:test
yarn run v1.22.19
$ detox test -c android.prod --cleanup && ./set_env_prod.sh
16:21:0[8](https://github.com/richkirsch/mell/actions/runs/3969229695/jobs/6803438911#step:11:9).210 detox[515[9](https://github.com/richkirsch/mell/actions/runs/3969229695/jobs/6803438911#step:11:10)] B jest --config e2e/jest.config.js e2e
16:21:56.019 detox[5178] i ""/usr/local/lib/android/sdk/emulator/emulator" -version " failed with error = ChildProcessError: Command failed: "/usr/local/lib/android/sdk/emulator/emulator" -version 
/usr/local/lib/android/sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64: error while loading shared libraries: libpulse.so.0: cannot open shared object file: No such file or directory
 `"/usr/local/lib/android/sdk/emulator/emulator" -version ` (exited with error code 127) (code=127), stdout and stderr:

16:21:56.020 detox[5178] i 
16:21:56.021 detox[5178] i /usr/local/lib/android/sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64: error while loading shared libraries: libpulse.so.0: cannot open shared object file: No such file or directory

16:21:56.023 detox[5178] i Could not detect emulator binary version ChildProcessError: Command failed: "/usr/local/lib/android/sdk/emulator/emulator" -version 
/usr/local/lib/android/sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64: error while loading shared libraries: libpulse.so.0: cannot open shared object file: No such file or directory
 `"/usr/local/lib/android/sdk/emulator/emulator" -version ` (exited with error code 127)
    at callback (/home/runner/work/mell/mell/node_modules/child-process-promise/lib/index.js:33:27)
    at ChildProcess.exithandler (node:child_process:4[10](https://github.com/richkirsch/mell/actions/runs/3969229695/jobs/6803438911#step:11:11):5)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:[11](https://github.com/richkirsch/mell/actions/runs/3969229695/jobs/6803438911#step:11:12)00:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5) {
  code: [12](https://github.com/richkirsch/mell/actions/runs/3969229695/jobs/6803438911#step:11:13)7,
  childProcess: {
    _forkChild: [Function: _forkChild],
    ChildProcess: [Function: ChildProcess],
    exec: [Function: exec],
    execFile: [Function: execFile],
    execFileSync: [Function: execFileSync],
    execSync: [Function: execSync],
    fork: [Function: fork],
    spawn: [Function: spawn],
    spawnSync: [Function: spawnSync]
  },
  stdout: '',
  stderr: '/usr/local/lib/android/sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64: error while loading shared libraries: libpulse.so.0: cannot open shared object file: No such file or directory\n'
}
  error: Command failed: "/usr/local/lib/android/sdk/emulator/emulator" -version 
  /usr/local/lib/android/sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64: error while loading shared libraries: libpulse.so.0: cannot open shared object file: No such file or directory
   `"/usr/local/lib/android/sdk/emulator/emulator" -version ` (exited with error code 127)
16:21:56.025 detox[5178] i Emulator version detection failed (See previous logs)
16:22:41.159 detox[5178] i ""/usr/local/lib/android/sdk/emulator/emulator" -version " failed with error = ChildProcessError: Command failed: "/usr/local/lib/android/sdk/emulator/emulator" -version 
/usr/local/lib/android/sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64: error while loading shared libraries: libpulse.so.0: cannot open shared object file: No such file or directory
 `"/usr/local/lib/android/sdk/emulator/emulator" -version ` (exited with error code 127) (code=127), stdout and stderr:

16:22:41.160 detox[5178] i 
16:22:41.160 detox[5178] i /usr/local/lib/android/sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64: error while loading shared libraries: libpulse.so.0: cannot open shared object file: No such file or directory

16:22:41.162 detox[5178] i Could not detect emulator binary version ChildProcessError: Command failed: "/usr/local/lib/android/sdk/emulator/emulator" -version 
/usr/local/lib/android/sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64: error while loading shared libraries: libpulse.so.0: cannot open shared object file: No such file or directory
 `"/usr/local/lib/android/sdk/emulator/emulator" -version ` (exited with error code 127)
    at callback (/home/runner/work/mell/mell/node_modules/child-process-promise/lib/index.js:33:27)
    at ChildProcess.exithandler (node:child_process:410:5)
    at ChildProcess.emit (node:events:5[13](https://github.com/richkirsch/mell/actions/runs/3969229695/jobs/6803438911#step:11:14):28)
    at maybeClose (node:internal/child_process:1100:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5) {
  code: 127,
  childProcess: {
    _forkChild: [Function: _forkChild],
    ChildProcess: [Function: ChildProcess],
    exec: [Function: exec],
    execFile: [Function: execFile],
    execFileSync: [Function: execFileSync],
    execSync: [Function: execSync],
    fork: [Function: fork],
    spawn: [Function: spawn],
    spawnSync: [Function: spawnSync]
  },
  stdout: '',
  stderr: '/usr/local/lib/android/sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64: error while loading shared libraries: libpulse.so.0: cannot open shared object file: No such file or directory\n'
}
  error: Command failed: "/usr/local/lib/android/sdk/emulator/emulator" -version 
  /usr/local/lib/android/sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64: error while loading shared libraries: libpulse.so.0: cannot open shared object file: No such file or directory
   `"/usr/local/lib/android/sdk/emulator/emulator" -version ` (exited with error code 127)
16:22:41.164 detox[5178] i Failed to detect emulator version! (see previous logs)
This leaves Detox unable to tell if it should automatically apply this patch-fix: https://stackoverflow.com/a/47265664/453052, which seems to be needed in emulator versions < 28.
If you feel this is not needed, you can either ignore this message, or otherwise apply the patch manually.
16:22:41.580 detox[5178] i `/usr/local/lib/android/sdk/emulator/emulator -verbose -no-audio -no-boot-anim -read-only -port 16378 @Pixel_3_API_28` failed with code 127
  error: true
16:22:41.580 detox[5178] i INFO    | Android emulator version 31.3.[14](https://github.com/richkirsch/mell/actions/runs/3969229695/jobs/6803438911#step:11:15).0 (build_id 9322596) (CL:N/A)
INFO    | Found AVD name 'Pixel_3_API_28'
INFO    | Found AVD target architecture: x86
INFO    | argv[0]: '/usr/local/lib/android/sdk/emulator/emulator'; program directory: '/usr/local/lib/android/sdk/emulator'
VERBOSE |  Found directory: /usr/local/lib/android/sdk/system-images/android-28/google_apis/x86/
emulator: INFO: Found systemPath /usr/local/lib/android/sdk/system-images/android-28/google_apis/x86/
INFO    | emuDirName: '/usr/local/lib/android/sdk/emulator'
VERBOSE |  Found directory: /usr/local/lib/android/sdk/system-images/android-28/google_apis/x86/
emulator: INFO: Found systemPath /usr/local/lib/android/sdk/system-images/android-28/google_apis/x86/
/usr/local/lib/android/sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64: error while loading shared libraries: libpulse.so.0: cannot open shared object file: No such file or directory

FAIL e2e/tests.e2e.js
  ● Test suite failed to run

ChildProcessError: `/usr/local/lib/android/sdk/emulator/emulator -verbose -no-audio -no-boot-anim -read-only -port [16](https://github.com/richkirsch/mell/actions/runs/3969229695/jobs/6803438911#step:11:17)378 @Pixel_3_API_28` failed with code 127

at ChildProcess.<anonymous> (node_modules/child-process-promise/lib/index.js:132:23)

16:22:42.6[17](https://github.com/richkirsch/mell/actions/runs/3969229695/jobs/6803438911#step:11:18) detox[[51](https://github.com/richkirsch/mell/actions/runs/3969229695/jobs/6803438911#step:11:52)[78](https://github.com/richkirsch/mell/actions/runs/3969229695/jobs/6803438911#step:11:79)] i Jest did not exit one second after the test run has completed.

This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.
Error: The operation was canceled.

Your environment

Detox version: ^20.1.1
React Native version: 0.70.5
Node version: 16
OS: Ubuntu
Test-runner: jest

@noomorph
Copy link
Collaborator

I suggest you to set up an open-source demo project with Github Actions so that we can step by step fix and make it work (or identify blockers).

@github-actions
Copy link

Hello! We appreciate you bringing this issue to our attention.
It looks like this could be a valuable addition or fix to our project.
We believe that this feature would benefit greatly from contributions from the community,
even from first-time contributors.

If you're interested in contributing to this feature,
please take a look at our contribution guide.
It has all the information you need to know about how to submit a pull request and contribute to our project.

You're also welcome to join our Discord server
and discuss this feature with the collaborators or other contributors under the channel 'contributions'.

Please feel free to reach out to us if you have any questions, or need help with anything.
We appreciate your feedback and look forward to working with you!

@victor-chan-groundswell

I have a different issue, and I have done some extended debugging on this....
I made a bunch of changes to make sure that the tests work.

a. Make sure it has the --headless flag
b. Make sure it DOES NOT have the --cleanup flag

Now I'm stuck at a place where it seems that, even if the tests pass 100%, the process exits with an exit code of 1 due to the an error when it tries to close the detox server.

23:15:51.667 detox[5408] i ipc server socket error Error: read ECONNRESET
at Pipe.onStreamRead (node:internal/stream_base_commons:217:20) {
errno: -104,
code: 'ECONNRESET',
syscall: 'read'
}
23:15:51.668 detox[5408] i ipc socket disconnected secondary-5434
23:15:51.881 detox[5408] E lifecycle Command failed with exit code = 1:

@victor-chan-groundswell

To add additional information... when the exact same commands are ran on my Mac, it returns a exit code of zero.

I know I'm not necessarily including everything in the logs here, but from what I've seen in the logs, detox invokes the jest process, runs the test... the process returns a EXEC_SUCCESS.... but yet.... the detox command determined that something is wrong and returns a exit code of 1.

Again, this only happens when I try to run it on github actions on a Ubuntu image... the exact same tests runs with a exit code of zero on a Mac.

19:43:19.492 detox[4904] i ipc socket disconnected secondary-4918
19:43:19.493 detox[4918] i ipc connection closed primary-4904 /tmp/detox.primary-4904 0 tries remaining of 0
19:43:19.493 detox[4918] i ipc secondary-4918 exceeded connection rety amount of or stopRetrying flag set.
19:43:19.494 detox[4918] i child-process:EXEC_SUCCESS
19:43:19.754 detox[4904] E lifecycle Command failed with exit code = 1:
jest --config e2e/config/config.json e2e

@johnf
Copy link

johnf commented Mar 23, 2024

You can fix this in github actions by adding

sudo apt-get install -y libpulse0 libgl1

to your workflow

@karlhorky
Copy link

karlhorky commented Mar 28, 2024

Anyone in the thread have a GitHub Actions workflow file to share here?

We have an Android macOS GitHub Actions workflow here:

We're still running into the failed with code null intermittently (it succeeds about 15% of the time):

So we would be happy to try out the Ubuntu workflow if it works!

@johnf
Copy link

johnf commented Mar 30, 2024

@karlhorky I've been working on something the last few weeks. You can see what I have so far at https://github.com/oblador/react-native-vector-icons/blob/monorepo/.github/workflows/tests.yaml

Working on getting macosx working this weekend.

Still a work in progress

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

5 participants