├── .gitlab-ci.yml └── README.md /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | stages: 2 | - test 3 | 4 | # Variables: these have to match 5 | # the .env.example credentials in your Laravel app 6 | # use the default homestead/secret combination, since 7 | # that database gets created in the edbizarro/gitlab-ci-pipeline-php:7.1 8 | # docker image. 9 | variables: 10 | MYSQL_ROOT_PASSWORD: root 11 | MYSQL_USER: homestead 12 | MYSQL_PASSWORD: secret 13 | MYSQL_DATABASE: homestead 14 | DB_HOST: mysql 15 | 16 | # Speed up builds 17 | cache: 18 | key: $CI_COMMIT_REF_NAME # changed to $CI_COMMIT_REF_NAME in Gitlab 9.x 19 | paths: 20 | - vendor 21 | - node_modules 22 | - public 23 | - .yarn 24 | 25 | test: 26 | stage: test 27 | services: 28 | - mysql:5.7 29 | image: edbizarro/gitlab-ci-pipeline-php:7.1 30 | script: 31 | - yarn config set cache-folder .yarn 32 | - yarn install --pure-lockfile 33 | - composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts 34 | - cp .env.example .env 35 | - php artisan key:generate 36 | - php artisan migrate:refresh --seed 37 | - ./vendor/phpunit/phpunit/phpunit -v --coverage-text --colors=never --stderr 38 | artifacts: 39 | paths: 40 | - ./storage/logs # for debugging 41 | expire_in: 1 days 42 | when: always 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # laravel-gitlab-ci-config 2 | An example config for using Gitlab's pipelines (ci/cd) to test Laravel applications in phpunit. 3 | 4 | This builds on the [edbizarro/gitlab-ci-pipeline-php/](https://hub.docker.com/r/edbizarro/gitlab-ci-pipeline-php/) docker images for Laravel. 5 | --------------------------------------------------------------------------------