github工作流程以在Magento模块存储库上运行测试

发布于 2025-02-03 02:17:56 字数 553 浏览 4 评论 0 原文

我们正在制作Magento付款模块,我们称其为ABC。我们正在使用Docker进行开发。因此,为了开发,我们正在使用Magento Image并将模块代码添加到 htdocs/app/code 通过来自 docker-compose.yml 。我们的github存储库仅包含模块代码。我们已经在 app/code/abc/payment/test 文件夹下添加了模块的一些测试。我们想设置一个将在拉动请求下自动运行测试的github工作流程。

问题是某些代码取决于Magento Core类,例如 Magento \ framework \ App \ config \ scopeconfiginterface magento \ sopor \ store \ storemanagerInterface ,以及在哪个won上在我们的GitHub仓库中可用。我们是否可以使用任何GitHub操作来设置Magento,将模块代码复制到其中并运行模块的测试?

任何帮助将不胜感激。我们无法弄清楚这一点。

We are working on a Magento payment module, let's call it ABC. We are using Docker for the development. So, for development, we are using a Magento image and adding the module code to the htdocs/app/code via volumes from docker-compose.yml. Our Github repo contains the module code only. We have added some tests for the module under app/code/ABC/Payment/Test folder. We want to setup a Github workflow that will run the test automatically on pull request.

The issue is some of the code depends on the Magento core classes like Magento\Framework\App\Config\ScopeConfigInterface, Magento\Store\Model\StoreManagerInterface and so on which won't be available in our Github repo. Is there any Github actions with which we can setup Magento, copy the module codes into it and run the module's tests?

Any help would be greatly appreciated. We are unable to figure this out.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

层林尽染 2025-02-10 02:17:56

您可能需要在GitHub工作流程中使用作曲家使用Magento。 https://github.com/marketplace/complace/complace/composer-composer-php-php-actions

如果您使用grumphp( https://github.com/phpro/grumphp )查看此示例:

You could require magento using composer within your github workflow. https://github.com/marketplace/actions/composer-php-actions

If you use grumphp (https://github.com/phpro/grumphp) you can have a look at this example: https://github.com/phpro/phpro-mage2-module-translations/blob/master/.github/workflows/grumphp.yml

左耳近心 2025-02-10 02:17:56

您没有分享太多关于什么使您无法弄清楚的是Github Actions ,但是阅读您的问题,就像您已经想出的开发:使用Docker一样。

现在,GitHub的动作也支持Docker。您需要的只是为开发环境运行设置脚本,该开发环境在运行测试之前在GitHub Action 中建立Docker设置。

您可能需要为其添加一个其他环境,以便您可以在开发系统和GitHub操作之间进行分支,但是从理论上讲,它应该已经不用了。

然后,将代码克隆后,然后设置Docker环境,在GitHub操作中执行测试。测试应该现在进行。

You have not shared much about what precisely is making you unable to figure it out for Github Actions, however reading your question it looks to me like you already have figured out for development: Using Docker.

Now Github Actions as well supports Docker. All you need is to run the setup script for the development environment that establishes that Docker setup within the Github Action before running your tests.

You may want to add an additional environment for it, so that you can branch between the development system and Github Actions, but theoretically it should already work without.

Then after you have cloned the code, and then setup the Docker environment, execute the tests in the Github Action. The tests should run now.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文