更新 1:mailatcher 可以工作,但运行每个测试现在需要 4 分钟。
我需要在 Github 工作流程中进行一些 Mailcatcher 验收测试。所有其他测试都运行良好。我还运行了 Mailcatcher,但安装包含所有依赖项的 gem 大约需要 4 分钟(!),这是不可接受的。
有没有办法加快速度?环境是 LAMP。
这是 YAML 文件:
name: Codeception Tests
on: [push]
jobs:
tests:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: true
matrix:
operating-system: [ubuntu-latest]
php: ["7.4"]
name: PHP ${{ matrix.php }} Test on ${{ matrix.operating-system }}
env:
php-ini-values: post_max_size=32M
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: "develop"
- name: Checkout Tests
uses: actions/checkout@v2
with:
repository: xxx/tests
ref: "develop"
path: tests
- name: Install Ruby & run mailcatcher
run: |
sudo gem install mailcatcher
mailcatcher
composer.json
{
"name": "tests",
"description": "Tests",
"license": "GPL-2.0-or-later",
"require-dev": {
"codeception/codeception": "~4.0",
"codeception/module-asserts": "^1.0",
"codeception/module-webdriver": "^1.0",
"codeception/module-phpbrowser": "^1.0",
"codeception/module-filesystem": "^1.0",
"codeception/module-db": "^1.0",
"joomla-projects/joomla-browser": "@dev",
"joomla-projects/selenium-server-standalone": "~v3",
"fzaninotto/faker": "^1.6",
"behat/gherkin": "^4.4.1",
"phing/phing": "2.*",
"captbaritone/mailcatcher-codeception-module": "^2.2"
},
"repositories": [
{
"type": "git",
"url": "https://github.com/stell/joomla-browser"
}
]
}
验收套房:
class_name: AcceptanceTester
modules:
enabled:
- Asserts
- JoomlaBrowser
- Helper\Acceptance
- DbHelper
- Filesystem
- MailCatcher
config:
MailCatcher:
url: "http://127.0.0.1"
port: "1080"
JoomlaBrowser:
url: "http://127.0.0.1:800
2年前的问题,但希望这对某人有帮助......
如果可以的话,您可以使用 GitHub Actions 上的 docker 容器来托管 mailcatcher。对我来说,Mailcatcher 在 GH 上需要大约 20 秒而不是 5 分钟,因为 ruby/mailcather 不需要编译/构建包。
workflow.yml
services:
mailcatcher:
image: schickling/mailcatcher
ports:
- "1080:1080"
- "1025:1025"
.env
SMTP_HOST: 127.0.0.1
SMTP_PORT: 1025
SMTP_USERNAME:
SMTP_PASSWORD: