docker - 如何 Codeception 和 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
解决方案
您是否也尝试过安装 zlib1g-dev ?此评论可能会有所帮助 - https://github.com/docker-library/php/issues/61#issuecomment-468874705但我建议apt install -y zlib1g-dev
在安装 php 扩展之前先添加,看看是否能解决问题。
推荐阅读
- php - 使用 parent::find 解决此错误的最佳方法是什么?
- javascript - 是否可以在图表末尾提取原始数据?
- python - 使用正则表达式提取整数的函数返回无类型
- java - Swing - How to add Crtl + JButton click
- amazon-web-services - 如何使用 Centos Vagrant guest(类似 Amazon Linux)在 Linux (Debian9) 上本地调试 Opsworks/Chef 11.10.4 食谱
- java - ESC/POS image in java
- r - Joining two data frames by multiple similar columns while maintaining non-overlapping data in R
- c++ - Display restaurant options based on dietary restrictions
- c# - 读取 DisplayMember 和 ValueMember 由 Dictionary 填充的 ComboBox 值
- tensorflow - Tensorflow:如何查找和平均每个训练实例不同数量的嵌入向量,每个小批量有多个训练实例?