如何使用travis ci

时间:2019-12-16 19:49:44

标签: docker-compose phpunit travis-ci

我只有几个Docker容器。见docker-compose.yml:

version: "3.1"
services:

    mysql:
      image: mysql:5.6
      container_name: jobtest-mysql
      working_dir: /application
      volumes:
        - ./src:/application
        - ./mysql:/var/lib/mysql
      environment:
        - DB_HOST=jobtest-mysql
        - MYSQL_ROOT_PASSWORD=password
        - MYSQL_DATABASE=users
        - MYSQL_USER=admin
        - MYSQL_PASSWORD=password
      ports:
        - "3306:3306"

    webserver:
      image: nginx:alpine
      container_name: jobtest-webserver
      working_dir: /application
      volumes:
          - ./src:/application
          - ./phpdocker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf
      ports:
       - "8085:80"

    php-fpm:
      build: phpdocker/php-fpm
      container_name: jobtest-php-fpm
      working_dir: /application
      volumes:
        - ./src:/application
        - ./phpdocker/php-fpm/php-ini-overrides.ini:/etc/php/7.2/fpm/conf.d/99-overrides.ini

我是travis ci的新手。 我的travis.yml很简单:

language: php
php:
    - '7.2'
os: linux
services:
    - docker
env:
    - DOCKER_COMPOSE_VERSION=1.24.1
install:
    - docker-compose up -d
before_script:
    - docker exec -it jobtest-php-fpm /bin/bash
    - composer update
script:
    - vendor/bin/phpunit tests

开始运行travis build之后,我得到以下结果:

...
jobtest-mysql | 2019-12-16 19:32:53 1 [Warning] 'proxies_priv' entry '@ root@a82ea90a2dad' ignored in --skip-name-resolve mode.
jobtest-mysql | 2019-12-16 19:32:53 1 [Note] Event Scheduler: Loaded 0 events
jobtest-mysql | 2019-12-16 19:32:53 1 [Note] mysqld: ready for connections.
jobtest-mysql | Version: '5.6.46'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)
No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#build-times-out-because-no-output-was-received
The build has been terminated

因此,docker-compose up中的“ -d”无效。

我的问题:

  

如何使用travis ci在docker容器中运行phpunit?

0 个答案:

没有答案