Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: add docker testing #62

Merged
merged 47 commits into from
Aug 27, 2024
Merged

feat: add docker testing #62

merged 47 commits into from
Aug 27, 2024

Conversation

spion
Copy link
Owner

@spion spion commented Jan 24, 2023

This PR adds a scaffold for automated tests based on docker and an android emulator. The neat thing about this approach is that we can also use multiple versions of android, and while that may not be fully exhaustive in terms of the devices out there, its way better than having nothing.

Without tests, changes to this project are quite high risk. With tests, I think we can get things going 😄

Currently covers only a single Android version, but its easy to add a second dockerfile.

To try it out

docker build -t adbfs-rootless-v1 -f docker/Dockerfile .
docker run --privileged --rm adbfs-rootless-v1

The reason --privileged is needed is because the android emulators need virtualization support (/dev/kvm needs to be available). I'm still hoping we'll be able to run these in GitHub actions but I've not tried yet.

This is WIP. Would be great to have some ideas about good representative tests to run and ways to verify that everything is ok.

docker/Dockerfile Outdated Show resolved Hide resolved
@spion
Copy link
Owner Author

spion commented Jan 28, 2023

For running priviledged actions, refer to actions/container-action#2 (comment)

@spion
Copy link
Owner Author

spion commented Jan 29, 2023

Looks like this is not happening with github actions for now: actions/runner-images#183

@spion
Copy link
Owner Author

spion commented Jan 30, 2024

TODO: check if this helps https://www.ubicloud.com/use-cases/github-actions

@ViliusSutkus89
Copy link

ViliusSutkus89 commented Aug 12, 2024

Hello @spion , how's it going?

I have a question, since you're trying to combine emulator and docker, why exactly do you need docker? Dockerfile is basically a script with extra tools. You can install whatever tools you need on GHA Ubuntu machine and then run your test.sh inside reactivecircus/android-emulator-runner

Is it because of libfuse? Is Docker needed in order to use libfuse on GHA?

@spion
Copy link
Owner Author

spion commented Aug 12, 2024

Its so I can also run the tests locally (with multiple android versions, as well as multiple versions of ubuntu/fuse/etc) without having to rely on GHA. But I'm probably going to be reworking that bit to use separate containers for the emulator and the filesystem "host"

@ViliusSutkus89
Copy link

The way I see it, you need docker to be able to test locally on different ubuntu/fuse versions. Just because you need that, it doesn't mean that the script should ONLY be callable through docker. You could use docker locally, and plain naked script in GHA. Both still calling the same adb calls. With GHA you get an easy way to set up a test matrix with all relevant android versions and maybe even fuse versions, if different fuse versions are easily reachable through apt-get or whatever.

Keep in mind that GHA Android emulators are x86/x86_64. I haven't tried anything with the new macos armv8 images, maybe they would allow armv8 emulator images in addition to ubuntu's x86/x86_64.

Let me know if you want help here on the emulator or GHA

@spion
Copy link
Owner Author

spion commented Aug 12, 2024

Yeah, the script is already called directly in GHA now from an action that sets up the emulator. The code is a year old and went through quite a few iterations - my main goal yesterday was to get it working in case there is a new influx of contributions but there is some cleanup left to do for sure 😅

@spion spion merged commit 297a7b3 into master Aug 27, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants