Created
September 17, 2015 22:14
-
-
Save iolson/2c6941c9780b1ebcc25f to your computer and use it in GitHub Desktop.
GitLab CI Laravel 5.1.*
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DB_HOST=mysql | |
DB_DATABASE=homestead | |
DB_USERNAME=homestead | |
DB_PASSWORD=secret |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Before Script | |
before_script: | |
- composer self-update | |
- composer install --prefer-dist > /dev/null | |
- cp .env.example .env | |
- php artisan key:generate | |
- php artisan migrate:refresh --seed | |
# Services | |
services: | |
- mysql:latest | |
# Variables | |
variables: | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_USER: homestead | |
MYSQL_PASSWORD: secret | |
MYSQL_DATABASE: homestead | |
# PHP 5.5 | |
php:5.5: | |
image: bobey/docker-gitlab-ci-runner-php5.5 | |
script: | |
- echo "Running PHPUnit Tests" | |
- php vendor/bin/phpunit --colors --debug --coverage-text | |
# PHP 5.6 | |
php:5.6: | |
image: bobey/docker-gitlab-ci-runner-php5.6 | |
script: | |
- echo "Running PHPUnit Tests" | |
- php vendor/bin/phpunit --colors --debug --coverage-text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> php artisan clear-compiled | |
> php artisan optimize | |
$ cp .env.example .env | |
$ php artisan key:generate | |
Application key [Dg4rH8UrV4klq49ORLJrXGbe84Y96XTf] set successfully. | |
$ php artisan migrate:refresh --seed | |
[PDOException] | |
SQLSTATE[HY000] [2002] No route to host | |
ERROR: Build failed with: exit code 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[runners]] | |
name = "php" | |
url = "<domain name removed>" | |
token = "<token removed>" | |
limit = 1 | |
executor = "docker" | |
environment = ["MYSQL_ALLOW_EMPTY_PASSWORD=1"] | |
[runners.docker] | |
allowed_images = ["*", "*/*"] | |
allowed_services = ["*", "*/*"] | |
privileged = false | |
volumes = ["/cache", "/composer-auth.json:/root/.composer/auth.json:ro"] | |
wait_for_services_timeout = 0 |
In config.toml
[runners]]
Typo?
I used the above .yml file but still have an issue with database migration during the build with GitLab. Anyone, if have any idea please throw some inputs here.
WARNING: Service mysql:latest is already created. Ignoring.
Waiting for services to be up and running...
*** WARNING: Service runner-8c63a854-project-962504-concurrent-0-mysql probably didn't start properly.
didn't respond in timely maner: runner-8c63a854-project-962504-concurrent-0-mysql (consider modifying wait_for_services_timeout: 30s).
2016-03-13T15:56:34.933385100Z Initializing database
[PDOException]
SQLSTATE[HY000] [2002] No such file or directory
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://doc.gitlab.com/ce/ci/services/mysql.html you need to use mysql as hostname