0

Update 1: Got mailatcher working but running every test now takes 4 minutes.

I need to do some Mailcatcher Acceptance Tests inside a Github Workflow. All other Tests are running fine. I also got the Mailcatcher running but installing the gem with all dependencies takes around 4 Minutes(!) which is not acceptable.

Is there a way to speed this up? The environment is LAMP.

So this is the YAML file:

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

The 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"
        }
    ]
}

The Acceptance Suite:

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
Mike
  • 5,416
  • 4
  • 40
  • 73
  • I could speed things up by doing `gem install mailcatcher --no-update-sources --no-document`. Could still be faster. Is all of this really needed: https://pastebin.com/Vw0DNWZq ? – Mike Jul 05 '21 at 19:35
  • If you don't want all the dependencies loaded during CI/CD workflow to decrease time usage, maybe add all dependencies in the source itself. That would reduce time :) – Jishan Shaikh Jul 06 '21 at 13:17
  • Or, you could cache the dependencies inside GitHub Actions blob like this https://github.com/jstrieb/github-stats/blob/ff563dff6701ab69f8f3786ad71a6ad410f381d1/.github/workflows/main.yml#L33 – Jishan Shaikh Jul 08 '21 at 15:26

0 Answers0