stages:
    - test
    - deploy

.composer_cache: &composer_cache
    cache:
        paths:
            - vendor/

.install_dependencies: &install_dependencies
    before_script:
        - composer install --prefer-dist --classmap-authoritative --no-interaction --no-progress

.composer_test: &composer_test
    script:
        - composer test

lint (phpstan):
    image: $CI_REGISTRY/mathew-davies/dockerimages/php:7.1
    stage: test
    <<: *install_dependencies
    <<: *composer_cache
    script:
        - composer lint

test php 7.0:
    image: $CI_REGISTRY/mathew-davies/dockerimages/php:7.0
    stage: test
    <<: *install_dependencies
    <<: *composer_test
    <<: *composer_cache

test php 7.1:
    image: $CI_REGISTRY/mathew-davies/dockerimages/php:7.1
    stage: test
    <<: *install_dependencies
    <<: *composer_test
    <<: *composer_cache
    artifacts:
        paths:
            - coverage/

test php 7.2:
    image: $CI_REGISTRY/mathew-davies/dockerimages/php:7.2
    stage: test
    <<: *install_dependencies
    <<: *composer_test
    <<: *composer_cache

pages:
    stage: deploy
    dependencies:
        - test php 7.1
    script:
        - mv coverage/ public/
    artifacts:
        expire_in: 30 days
        paths:
            - public
    only:
        - master

stages:
    - test
    - deploy

.composer_cache: &composer_cache
    cache:
        paths:
            - vendor/

.install_dependencies: &install_dependencies
    before_script:
        - composer install --prefer-dist --classmap-authoritative --no-interaction --no-progress

.composer_test: &composer_test
    script:
        - composer test

lint (phpstan):
    image: $CI_REGISTRY/mathew-davies/dockerimages/php:7.1
    stage: test
    <<: *install_dependencies
    <<: *composer_cache
    script:
        - composer lint

test php 7.1:
    image: $CI_REGISTRY/mathew-davies/dockerimages/php:7.1
    stage: test
    <<: *install_dependencies
    <<: *composer_test
    <<: *composer_cache
    artifacts:
        paths:
            - coverage/

test php 7.2:
    image: $CI_REGISTRY/mathew-davies/dockerimages/php:7.2
    stage: test
    <<: *install_dependencies
    <<: *composer_test
    <<: *composer_cache

pages:
    stage: deploy
    dependencies:
        - test php 7.1
    script:
        - mv coverage/ public/
    artifacts:
        expire_in: 30 days
        paths:
            - public
    only:
        - master

Remove support for PHP 7.0
Remove support for PHP 7.0
