圈子CI和Behat

时间:2016-12-09 11:16:18

标签: symfony curl behat circleci

Helo我在圆圈ci上运行behat测试时遇到问题。当我尝试在我的本地运行它们时一切正常。

这是一个屏幕:https://www.dropbox.com/s/f27tfxdm1zxst8h/Screenshot%202016-11-17%2014.33.54.png?dl=0

这是我的circle.yml:

machine:
  timezone:
    Europe/Prague
  php:
    version: 7.0.7

dependencies:
  pre:
    - cp $HOME/$CIRCLE_PROJECT_REPONAME/app/config/parameters.yml.circle.dist $HOME/$CIRCLE_PROJECT_REPONAME/app/config/parameters.yml

database:
  override:
    - php app/console doctrine:migrations:migrate --no-interaction

test:
  override:
    - php bin/behat

感谢您的帮助

更新

circle.yml

machine:
  timezone:
    Europe/Prague
  php:
    version: 7.0.7

dependencies:
  pre:
    - cp $HOME/$CIRCLE_PROJECT_REPONAME/app/config/parameters.yml.circle.dist $HOME/$CIRCLE_PROJECT_REPONAME/app/config/parameters.yml

  post:
    - sudo cp $HOME/$CIRCLE_PROJECT_REPONAME/app/config/mywebsite.conf /etc/apache2/sites-available
    - sudo a2ensite mywebsite.conf
    - sudo rm /etc/apache2/mods-enabled/php5.load
    - sudo service apache2 restart

database:
  override:
    - php app/console doctrine:migrations:migrate --no-interaction -e=test

test:
  override:
    - php bin/behat

mywebsite.conf

Listen 8080

<VirtualHost *:8080>
  LoadModule php7_module /opt/circleci/php/7.0.7/usr/lib/apache2/modules/libphp7.so

  DocumentRoot /home/ubuntu/my_project/web
  ServerName mywebsite.com
  <FilesMatch \.php$>
    SetHandler application/x-httpd-php
  </FilesMatch>
</VirtualHost>

当然,现在我正在尝试连接到url mywebsite.com但响应仍然是: cURL错误6:无法解析主机:mywebsite.com(请参阅http://curl.haxx.se/libcurl/c/libcurl-errors.html)(GuzzleHttp \异常\的ConnectException)

1 个答案:

答案 0 :(得分:0)

我和你有同样的问题,最后让它运行起来。 Circle文档中的Apache配置示例永远不会起作用。对我来说,以下最终确实有效:

<VirtualHost *:80>

    DocumentRoot /home/circleci/drupal-circleci-behat/web
    ServerName drupal-circleci-behat.localhost

    <Directory /home/circleci/drupal-circleci-behat/web >
        Options FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

</VirtualHost>

此外,我已通过config.yml

将域添加到主机文件中
version: 2
jobs:
  build:
    docker:
      - image: circleci/php:7.1-apache-node-browsers

    working_directory: ~/drupal-circleci-behat

    steps:
      - checkout

      - run:
          name: Apache
          command: |
            sudo cp .circleci/drupal-circleci-behat.conf /etc/apache2/sites-available/drupal-circleci-behat.conf
            sudo a2ensite drupal-circleci-behat
            sudo service apache2 start
            echo 127.0.0.1 drupal-circleci-behat.localhost | sudo tee -a /etc/hosts
            cat /etc/hosts
            curl drupal-circleci-behat.localhost

      - run:
          name: Other stuff ...
          command: |
            ...

在此处运行样本回购:https://github.com/leymannx/drupal-circleci-behat