Pierstoval
2/20/2018 - 12:23 PM

CircleCI 2.0 config for @StudioAgate

version: 2

workflows:
    version: 2
    php_and_node:
        jobs:
            - php
            - node

jobs:
    php:
        docker:
            # Docker build here:
            # https://hub.docker.com/r/pierstoval/studio-agate-portal/
            # https://github.com/StudioAgate/DockerPortalApp
            - image: pierstoval/studio-agate-portal:v0.2.1

        working_directory: ~/app

        environment:
            SYMFONY_ENV:   test
            SYMFONY_DEBUG: 1
            RECREATE_DB:   1

        steps:
            - checkout

            - restore_cache:
                keys:
                    - composer-cache-{{ checksum "composer.lock" }}

            - run:
                name: 'Show config'
                command: |
                    pwd
                    php --ini
                    composer config -l
                    env

            - run:
               name: 'Install Project Dependencies'
               command: |
                    composer install --no-interaction --no-suggest --ignore-platform-reqs --no-progress

            - run:
               name: 'Execute Linting tests'
               command: |
                    php bin/console security:check
                    php bin/console lint:twig templates src
                    php bin/console lint:yaml config
                    php bin/console lint:yaml src

            - run:
               name: 'Execute PHPUnit tests'
               command: |
                    vendor/bin/phpunit --log-junit=build/log/logfile.xml

            - save_cache:
                key: composer-cache-{{ checksum "composer.lock" }}
                paths:
                    - ~/.composer/cache

    node:
        docker:
            - image: node:8

        working_directory: ~/app

        environment:
            NODE_ENV: production

        steps:
            - checkout

            - restore_cache:
                keys:
                    - yarn-cache-{{ checksum "yarn.lock" }}

            - run:
                name: 'Show config'
                command: |
                    pwd
                    env
                    node --version
                    yarn --version

            - run:
               name: 'Install Project Dependencies'
               command: |
                    yarn install

            - run:
               name: 'Execute node tests'
               command: |
                    yarn gulp test --prod --verbose -LLLL

            - save_cache:
                key: yarn-cache-{{ checksum "yarn.lock" }}
                paths:
                    - node_modules