Running Phpunit and JS test at the same time via CircleCI

I am using circle to run JS and PHP test (Protractor / Phpunit).

I'd like to use parallelism to buy time, but I don't know how to set up parallelism. I am activating parallelism in circle options (2 containers).

My actual circle configuration (circle.yml):

# Depend de app/config/parameters.circle.yml (parametre symfony pour circle) et app/config/apache.circle (configuration d'Apache pour Circle)

# Configuration du serveur
machine:
    php:
        version: 5.4.21
    timezone:
        Europe/Paris
    hosts:
        bluegrey.circle.dev: 127.0.0.1

dependencies:
    pre:
        # SauceConnect (Angular)
        - wget https://saucelabs.com/downloads/sc-latest-linux.tar.gz
        - tar -xzf sc-latest-linux.tar.gz
        - ./bin/sc -u johnnyEvo -k xxx:
            background: true
            pwd: sc-*-linux
        # Installation protractor (Angular)
        - npm install -g protractor
        # On active XDebug
        - sed -i 's/^;//' ~/.phpenv/versions/$(phpenv global)/etc/conf.d/xdebug.ini
        - echo "xdebug.max_nesting_level = 250" > ~/.phpenv/versions/$(phpenv global)/etc/conf.d/xdebug.ini
        # Configuration d'Apache
        - cp app/config/apache.circle /etc/apache2/sites-available
        - a2ensite apache.circle
        - sudo service apache2 restart
    override:
        # Composer
        - composer install --prefer-source --no-interaction
    post:
        # Assets
        - app/console assetic:dump
        # Parameters
        - cp app/config/parameters.circle.yml.dist app/config/parameters.yml

database:
    pre:
        # Base de données (test)
        - app/console doctrine:database:create --env=test --no-interaction
        - app/console doctrine:schema:update --force --env=test --no-interaction
        # Base de données (prod/ angular)
        - app/console doctrine:database:drop --no-interaction --force
        - app/console doctrine:database:create --no-interaction
        - app/console doctrine:schema:update --force --no-interaction
        # Fixture
        - app/console doctrine:fixture:load --no-interaction


test:
    pre:
        # Permission pour que Protractor puisse naviguer le site
        - sudo setfacl -R -m u:www-data:rwx -m u:`whoami`:rwx app/cache app/logs app/sessions
        - sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx app/cache app/logs app/sessions
    override:
        - php -d memory_limit=-1 bin/phpunit -c app
        - protractor angutest

      

thank

+3


source to share


1 answer


I am one of the CircleCI developers.

The easiest way is to run PHP tests on one container and JS tests on another, if they have roughly the same battery life, then you have the advantage without having to manually split test suites.



In this case, the following will work:

test:
  override:
    - case $CIRCLE_NODE_INDEX in 0) php -d memory_limit=-1 bin/phpunit -c app ;; 1) protractor angutest ;; esac:
        parallel: true

      

+4


source







All Articles