Search code examples
dockerpipelinegitlab-cicodeception

How to Codeception and Gitlab CI (Continuous Integration)


I am currently running my acceptance tests via codeception manually. Now its time to do the next step.

I want to create a pipeline in Gitlab to run my acceptance tests automatically.

The very first problem is the .gitlab-ci.yml, where I dont really know how to implement it.

I did it like it was described in this documentation: https://codeception.com/docs/12-ContinuousIntegration

But I am always getting errors.

The newest error is the following: *error: zip support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB include and library are located*

I ve tried serveral images from docker hub, but none of them were successful.

This is my current .gitlab-ci.yml:


# Select what we should cache
cache:
  paths:
  - vendor/

services:
    - selenium/standalone-chrome:latest

before_script:

# Install git and unzip (composer will need them)
- apt-get update && apt-get install -qqy git unzip

#zip
- apt-get install -y zlib1g-dev
- apt-get update && apt-get install -y libzip-dev
- docker-php-ext-install zip

# Install composer
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# Install all project dependencies
- composer install

#install node
- apt-get update && curl -sL https://deb.nodesource.com/setup_8.x | bash - && apt-get install -y build-essential nodejs
- npm init -y 
- npm install -g eslint --unsafe-perm=true --alow-root
- npm config set prefix ~/.local  
- PATH=~/.local/bin/:$PATH
- apt-get update -q -y
- apt-get --yes install libnss3
- apt-get --yes install libgconf-2-4

#install wget
- apt-get --yes install wget

#install gnupg2
- apt-get update && apt-get install -y gnupg2


# Install chrome
# Add key
- curl -sS -L https://dl.google.com/linux/linux_signing_key.pub | apt-key add -
# Add repo
- echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list
- apt-get update -q -y
- apt-get install -y google-chrome-stable

- npm install chromedriver -g
- npm install https://gitlab.com/gitlab-org/gitlab-selenium-server.git -g
# The `&` at the end causes it to run in the background and not block the following commands

- nohup chromedriver --port=4444 --url-base=wd/hub &
- nohup gitlab-selenium-server &


# Test
test:
  script:
  - vendor/bin/codecept run --env chrome



Solution

  • Have you tried installing zlib1g-dev as well? This comment might be helpful - https://github.com/docker-library/php/issues/61#issuecomment-468874705 But I suggest by just starting with adding apt install -y zlib1g-dev before installing the php extension and see if that solves the issue.