如何进行代码接收和Gitlab CI(持续集成)

时间:2019-06-17 11:39:50

标签: docker pipeline gitlab-ci codeception

我目前正在通过代码接收手动运行验收测试。现在该进行下一步了。

我想在Gitlab中创建一个管道来自动运行验收测试。

第一个问题是.gitlab-ci.yml,在这里我真的不知道如何实现它。

我做到了,就像本文档中所述:https://codeception.com/docs/12-ContinuousIntegration

但是我总是出错。

最新错误如下: *error: zip support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB include and library are located*

我已经尝试过从docker hub获得服务器映像,但是没有一个成功。

这是我当前的.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


1 个答案:

答案 0 :(得分:1)

您是否也尝试过安装zlib1g-dev? 此评论可能会有所帮助-https://github.com/docker-library/php/issues/61#issuecomment-468874705,但我建议您从安装PHP扩展名之前先添加apt install -y zlib1g-dev开始,看看是否能解决问题。