Basic Travis CI configuration for Laravel
After some hours for trial and error, I’ve came up with this basic .travis.yml
file ready to work with my Laravel project.
Note: my Laravel is 5.8 version and works with MariaDB and PHP 7.2.
# .travis.yml
dist: precise
language: php
php:
- 7.2
addons:
mariadb: 10.4
cache:
directories:
- node_modules
- vendor
before_script:
- cp .env.travis .env
- sudo mysql -e 'CREATE DATABASE testing;'
- composer self-update
- composer install --no-interaction
- php artisan key:generate
- php artisan migrate --no-interaction -vvv
script:
- vendor/bin/phpunit
The .env.travis
file is versioned and contains the following code.
# .env.travis
APP_NAME=Laravel
APP_ENV=testing
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost/
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=testing
DB_USERNAME=travis
DB_PASSWORD=
BCRYPT_ROUNDS=4
CACHE_DRIVER=array
MAIL_DRIVER=array
QUEUE_CONNECTION=sync
SESSION_DRIVER=array
Thanks for your time!
I'm nahuelhds. If you like what I do, you can...