Techioz Blog

Github ワークフロー内に Mailcatcher をインストールするには時間がかかります

概要

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

作曲家.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 をホストできます。私の場合、Ruby/mailcather がパッケージをコンパイル/ビルドする必要がないため、Mailcatcher は GH では 5 分ではなく、約 20 秒かかります。

ワークフロー.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: