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

Docker compose for testing #9525

Merged
merged 9 commits into from
Jul 22, 2024
Merged

Conversation

pabzm
Copy link
Member

@pabzm pabzm commented Jun 28, 2024

I couldn't get the browser tests to run green locally, and felt uneasy about running a downloaded binary with superuser-rights (the IMAP-server) on my machine anyway. So I decided to build a testing setup with docker compose, which depends on external containers for the browser and the IMAP-server and helps to make the environment reproducecable. Additionally it is faster for repeated runs, because it doesn't repeatedly downloads the server-jar, installs the webdriver, etc.

And because more people might find it useful I'm posting this pull request.

We could also rebuild the automated testing workflows to use services (external containers) to speed things up. But before I do that I wanted to know if this gets merged or provokes discussion in the first place.

The container image needs to be built locally, currently. If this gets merged I'd set it up to be built repeatedly on github and to be downloadable.

@pabzm pabzm requested review from alecpl and miaulalala June 28, 2024 13:03
@alecpl
Copy link
Member

alecpl commented Jun 28, 2024

I don't like docker and I have no clue about docker, but...

  1. I'm not against using it in CI, as long as possibility to use local/external IMAP server is still there.
  2. There's more or less official roundcube/roundcubemail-docker repository, so we should not add any docker files here, unless they reside in .ci folder.

@pabzm
Copy link
Member Author

pabzm commented Jul 1, 2024

Do I understand correctly that you would merge this if the image is built in https://github.com/roundcube/roundcubemail-docker and we drop the .docker directory here?

I'm not against using it in CI, as long as possibility to use local/external IMAP server is still there.

How would you currently make the CI to use an external IMAP server?

@alecpl
Copy link
Member

alecpl commented Jul 1, 2024

How would you currently make the CI to use an external IMAP server?

Let's use docker in CI. I want possibility to run tests (manually) against an external IMAP server (and local greenmail).

As for docker. I don't care what the image we use or build it is coming from. I don't want docker related stuff outside of .ci directory.

pabzm added 5 commits July 4, 2024 17:48
So we don't have to specify them on the command line when we check
codestyle locally.
It uses standalone containers for the greenmail IMAP server and the
standalone browser.
A testrunner image is built in the CI (for `linux/amd64` only, because
Github doesn't support multi-platform building on their default
runners and we don't have our own.)

This setup helps to run the tests (reproduceably) also locally.
Previously, on my machine, they produced varying results.
It also reduces the dependencies for running the browser test.
Local execution only depends on `docker compose`, no other tools
(previously it required `sudo`, `java`, and some more.)

The previous solution should still work, if you want it.

The scripts are stored in a directory called `.ci` to hide them a little
and avoid confusion with the container images from the
`roundcubemail-docker` repo.
This only was a flaky problem only occurring sometimes.
In other code the initial connection is forced. Doing this here, too,
fixes occasional problems with lost imap connections.
@pabzm pabzm force-pushed the docker-compose-for-testing branch from f36146d to 49a6811 Compare July 5, 2024 16:12
@pabzm
Copy link
Member Author

pabzm commented Jul 8, 2024

This setup works in the CI and in a container, and still allows to run the script locally as well as using an external IMAP-Server. Please review!

Copy link
Contributor

@miaulalala miaulalala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

.github/workflows/tests.yml Outdated Show resolved Hide resolved
@alecpl
Copy link
Member

alecpl commented Jul 8, 2024

Looks good, almost there.

@pabzm pabzm requested a review from alecpl July 11, 2024 08:15
@alecpl
Copy link
Member

alecpl commented Jul 15, 2024

Looks good, but can we move compose.yaml from root?

This way it's less easy mistaken as usable for running Roundcubemail in
production.
@pabzm
Copy link
Member Author

pabzm commented Jul 16, 2024

can we move compose.yaml from root?

I moved it into tests/, is that ok?

@pabzm pabzm self-assigned this Jul 16, 2024
@alecpl
Copy link
Member

alecpl commented Jul 16, 2024

.ci folder would be a better location.

@pabzm
Copy link
Member Author

pabzm commented Jul 16, 2024

.ci folder would be a better location.

Why that? It's not used in the CI at all.

@alecpl
Copy link
Member

alecpl commented Jul 21, 2024

Everything else is in .ci including docker images and run scripts.

@pabzm
Copy link
Member Author

pabzm commented Jul 22, 2024

I don't really agree, but don't find it very important either and want this merged, so here you go. Can you merge it now?

@alecpl alecpl merged commit 8509470 into roundcube:master Jul 22, 2024
16 checks passed
@pabzm pabzm mentioned this pull request Aug 22, 2024
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.

3 participants