Skip to content

Instantly share code, notes, and snippets.

@n0ni0
Last active November 11, 2019 10:14
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save n0ni0/fc4ce99a1026a2a7559b3d29aaf36bca to your computer and use it in GitHub Desktop.
Save n0ni0/fc4ce99a1026a2a7559b3d29aaf36bca to your computer and use it in GitHub Desktop.
Travis-CI file for PHP/Symfony 3
# Project language
language: php
# Allows use container-based infrastructure
sudo: false
# Start mysql service
services:
- mysql
# Cache composer packages so "composer install" is faster
cache:
directories:
- $HOME/.composer/cache/files
# Matrix to test in every php version
matrix:
# Fast finish allows to set the build as "finished" even if the "allow_failures" matrix elements are not finished yet.
fast_finish: true
include:
- php: 5.5
- php: 5.6
- php: 7.0
- php: hhvm
allow_failures:
- php: hhvm
# Define an environment variable
env:
- SYMFONY_VERSION="3.0.*" DB=mysql
# Update composer
before-install:
- composer self-update
# Install composer dependencies,
# Create database, schema and fixtures
install:
- composer install
- cp app/config/parameters.yml.dist app/config/parameters.yml
- php bin/console doctrine:database:create --env=test
- php bin/console doctrine:schema:create --env=test
- php bin/console doctrine:fixtures:load -n --env=test
# Run script
script:
- phpunit
# After a build, send email notification with the build results
notifications:
email: your_email
@n0ni0
Copy link
Author

n0ni0 commented Aug 1, 2017

Removed my email, I receive travis emails from multiple users :)

@erksch
Copy link

erksch commented Dec 26, 2017

For everyone who is looking for Travis-CI configuration for Symfony 4:
Set the desired version at SYMFONY_VERSION.
Replace - cp app/config/parameters.yml.dist app/config/parameters.yml
with - cp .env.dist .env

If your database configuration in .env.dist is not suitable for Travis,
consider adjusting it or create a new .env.travis with suitable database configuration for Travis-CI
(in this case use - cp .env.travis .env)

@tolry
Copy link

tolry commented Jan 27, 2018

before-install schould be before_install and composer self-update seems to be called automatically, even if the before_install-line is not in there

@ahmed-bhs
Copy link

Can you add deploy section !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment