eea / eea.docker.volto-test

DEPRECATED: Please use official @plone/volto-addon-ci
1 stars 0 forks source link

Feature request #1

Closed sneridagh closed 3 years ago

sneridagh commented 3 years ago

Hi @avoinea ! I tested it and it's awesome! Your craftsmanship of docker images is legendary :)

However, I miss from it three features:

I would love to use it locally too, mounting the current addon directory in this fashion: docker run -it --rm -e GIT_NAME=volto-blocks -v $(pwd):/opt/frontend/my-volto-project/src/addons/volto-blocks eeacms/volto-test test

so I would like it to have a method of not doing all the git clone dance. -e NOCLONE or something like that, so we can plug directly the current directory. (I already tested manually, no parameter, and works like a charm).

Also, if possible, run the tests in a non CI way, so:

if [[ "$1" == "test"* ]]; then
  exec bash -c "set -o pipefail; RAZZLE_JEST_CONFIG=jest-addons.config.js yarn test src/addons/$GIT_NAME --watchAll=false"
fi

using another parameter to choose from... maybe we can unify both features with a -e LOCAL or so.

Finally, using the jest config extender we introduced lately would be great, instead of using bare jest override.

What do you think? I can try to put together a PR with it. Then we can add it to the generator as a generic method for test/lint etc addons.

Thanks!

avoinea commented 3 years ago

Thank you @sneridagh

It should already work with local volumes:

https://github.com/eea/eea.docker.volto-test/blob/260fb9d79361e39c31d3ff375ae7850996eddd9c/docker-entrypoint.sh#L50

I'd love to learn more about the jest config extender.

sneridagh commented 3 years ago

@avoinea https://docs.voltocms.com/developer-guidelines/testing/#jest-configuration-override

Something I added along with the Razzle upgrade in Volto 9. The use case is precisely the one you have in here. It's only required to have the config keys you have to override, it gets merged with the main Volto one.

sneridagh commented 3 years ago

@avoinea oh you are correct, no need for my first request! :) I will work on the other two then if you think is worth it.

avoinea commented 3 years ago

@sneridagh I have a feeling that also the second one works :smile:

Try passing the RAZZLE_JEST_CONFIG env to the container, like:

docker run -e RAZZLE_JEST_CONFIG=jest-addons.config.js ...
sneridagh commented 3 years ago

@avoinea lol you are right!! Too much work last days! :P

And for the third, it's a matter of modify the call I guess like:

docker run -it --rm ...  eeacms/volto-test bash -c "set -o pipefail; yarn test"
avoinea commented 3 years ago

But yes, the jest config extender sounds good:

https://github.com/eea/eea.docker.volto-test/blob/260fb9d79361e39c31d3ff375ae7850996eddd9c/docker-entrypoint.sh#L62-L63

We should also consider having this image on plone repo and DockerHub like:

docker run plone/volto-test

Or maybe a better name:

sneridagh commented 3 years ago
avoinea commented 3 years ago

Sounds good. Seems that I don't have the rights to create new repos on plone:

2020-12-14-115150_333x41_scrot

sneridagh commented 3 years ago

@avoinea outrageous! here it is: https://github.com/plone/volto-addon-ci

avoinea commented 3 years ago
git push

ERROR: Permission to plone/volto-addon-ci.git denied to avoinea.
fatal: Could not read from remote repository