This page provides a set of instructions that will help you configure Future for GitLab.
- Open the
.gitlab-ci.yml
file and create thefuture
stage
stages:
- ...
- future
- Copy the job defined in the
vendor/evozon/future/ci/gitlab/future-proofing.yaml
file (link) into.gitlab-ci.yml
future-proofing:
...
- Configure the platform you target for the upgrade by defining the base image for the
future-proofing
job. If you project has a Dockerfile, use that instead and update itsFROM
instruction to match the targeted platform.
future-proofing:
...
image: php:fpm-alpine
...
- Define the
services
required for running your test suite. This section will be similar to the job that executes your project's test suite.
future-proofing:
...
services:
- mysql:latest
...
- Define the environment
variables
required for running your test suite. This section will be similar to the job that executes your project's test suite.
future-proofing:
...
variables:
MYSQL_DATABASE: $TEST_MYSQL_DATABASE
MYSQL_ROOT_PASSWORD: $TEST_MYSQL_ROOT_PASSWORD
...
...
- Run any scripts and installation steps required for executing your project's test suite in the
before_script
section of thefuture-proofing
job (install Composer dependencies, install PHP extensions, install Xdebug, run migrations, load fixtures, etc.)
future-proofing:
...
before_script:
...
- docker-php-ext-install ldap pdo_mysql
- curl --silent --show-error "https://getcomposer.org/installer" | php -- --install-dir=/usr/local/bin --filename=composer
- composer install --no-interaction --no-scripts --prefer-dist
- bin/console --env=test doctrine:schema:create
- bin/console --env=test doctrine:fixtures:load --no-interaction
...
...
- Configure the upgrade process in the
script
section. By default, Future will bump PHP to the latest version, will bump your direct Composer dependencies to their latest version, and will apply Rector to your code with a handpicked set of rectors. Everything is fully configurable, and you can keep whatever you need for your upgrade
future-proofing:
...
script:
- vendor/bin/future bump-php
- vendor/bin/future bump-deps
- composer update -W --no-interaction --no-scripts
...
...
- Configure your test suite to run at the end of the
script
section
future-proofing:
...
script:
...
- vendor/bin/phpunit --no-interaction --colors=never
...