Which the correct form to execute tests using codeception on github actions?

I have little experience with docker, and what I know so far has not helped me much in solving a problem with github actions.

Have some automated testing routines: acceptance, unit, api and functional, they are executed through the command. php vendor/bin/codecept run --steps

Have a Docker development environment, which uses an image with Nginx and PHP 7.3 and some additional containers

All my tests are performed perfectly on my local machine

I started using github actions, and set up my environment for executing php actions, I soon realized that I would need to put nginx because my tests are not just based on CLI, they also use the local host, in the github actions documentation you can find guidelines for how to make use of the nginx container.

But the execution is in no way able to find my local host.

In dozens of different attempts it was not possible to obtain the result.

I tried to use the container inside the github actions’ own yml, I created a separate action just to run my tests inside the container, I tried to run only via CLI, and my local host is never found.

Some things I already checked.

Sharing between volumes is OK, I can see all files inside the container at the time of execution

The NGINX settings are also OK, I can see the default.conf changed for my scenario.

Nginx as well as PHP FPM are running inside the container.

Some prints of executions

Using an action to execute my code inside a container


Using the nginx container within YML


My Current YML File

name: build

    branches: [master]
    branches: [master]

    runs-on: ${{ matrix.operating-system }}
        operating-system: [ubuntu-latest]
        php-versions: ['7.3']
    name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}

        image: mysql:5.7
          MYSQL_ROOT_PASSWORD: root
          MYSQL_DATABASE: root
          - 33306:3306

      - name: Prepare
        run: sudo chown -R $USER:$USER ${{ github.workspace }}

      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup PHP
        uses: shivammathur/setup-php@v1
          php-version: ${{ matrix.php-versions }}
          extensions: mbstring, pdo, pdo_mysql, intl, zip, json, xdebug
          coverage: true

      - name: Check PHP Version
        run: php -v

      - name: Check Composer Version
        run: composer -V

      - name: Check PHP Extensions
        run: php -m

      - name: Start MySQL
        run: sudo systemctl start mysql

      - name: Create database
        run: mysql -uroot -proot -e 'CREATE DATABASE IF NOT EXISTS slim_skeleton CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'

      - name: Copy settings
        run: cp config/env.exemplo.php config/development.php

      - name: Validate composer.json and composer.lock
        run: composer validate

      - name: Install dependencies
        run: composer install --prefer-dist --no-progress

      - name: Install tables
        run: composer console:migrate

      - name: tests
        uses: jerfeson/codeception-action@v8

My Custom action

# Container image that runs your code
FROM wyveo/nginx-php-fpm:php73

# Copies your code file from your action repository to the filesystem path `/` of the container
COPY entrypoint.sh /entrypoint.sh

# Copies your code file from your action repository to the filesystem path of nginx
COPY default.conf /etc/nginx/conf.d/


# Code file to execute when the docker container starts up (`entrypoint.sh`)
ENTRYPOINT ["/entrypoint.sh"]


#!/bin/sh -l

service nginx start
service php7.3-fpm restart

service nginx status
service php7.3-fpm status

# Run codeception tests
vendor/bin/codecept run $*


server {
    # Port that the web server will listen on.
     listen 80; ## listen for ipv4; this line is default and implied

    # The location of our projects public directory.
    root /github/workspace/public/;
     # Point index to the Laravel front controller.
    index index.php index.html;

    # Host that will serve this project.
    server_name localhost;

    # Disable sendfile as per https://docs.vagrantup.com/v2/synced-folders/virtualbox.html
    sendfile off;

    # Security - Hide nginx version number in error pages and Server header
    server_tokens off;

    # Add stdout logging
    error_log /dev/stdout info;
    access_log /dev/stdout;

    # reduce the data that needs to be sent over network
    gzip on;
    gzip_min_length 10240;
    gzip_proxied expired no-cache no-store private auth;
    gzip_types text/plain text/css text/xml application/json text/javascript application/x-javascript application/xml;
    gzip_disable "MSIE [1-6]\."

    # Useful logs for debug.
    access_log /var/log/nginx/localhost_access.log;
    error_log /var/log/nginx/localhost_error.log;
    rewrite_log on;

    location / {
        # URLs to attempt, including pretty ones.
        try_files $uri $uri/ /index.php?$query_string;

 # redirect server error pages to the static page /50x.html
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    # Remove trailing slash to please routing system.
    if (!-d $request_filename) {
        rewrite ^/(.+)/$ /$1 permanent;

    # PHP FPM configuration.
    location ~* \.php$ {
        fastcgi_pass unix:/run/php/php7.3-fpm.sock;
        fastcgi_index index.php;
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        include /etc/nginx/fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    # We don't need .ht files with nginx.
    location ~ /\.ht {
        deny all;
        log_not_found off;

    # Set header expirations on per-project basis
    location ~* \.(?:ico|css|js|jpe?g|JPG|png|svg|woff)$ {
        expires 365d;

Codeception YML


actor: AcceptanceTester
            - PhpBrowser:
                url: http://localhost
            - \Helper\Acceptance
        step_decorators: ~


actor: ApiTester
        - REST:
            url: http://localhost/api/v1/
            depends: PhpBrowser
            part: Json


actor: FunctionalTester
        # add a framework module here
        - \Helper\Functional
    step_decorators: ~


actor: UnitTester
        - Asserts
        - \Helper\Unit
    step_decorators: ~

Here is my skeleton, with all the code, in case you need to look at something, And here’s my action

@jerfeson ,

I find an action for codeception tests (Codeception Action) from the GitHub Marketplace.
Maybe, you can reference this action to improve yourself action, or try using this action in your workflow to see if it is available to your project.


I usually do not look for alternatives in the community without first trying all the possibilities, that I have found and testing Codeception Action was one of them, it runs my tests based on CLI, but does not run all tests, does not run tests that need to use the browser. I even created a separate action of mine precisely in an attempt to increase the possibility of testing that this action offered. Thanks for trying to help.