Travis CI - PHP

19

Transcript of Travis CI - PHP

Who Am I?

Developer/Evangelist at LaunchKey

Founder/Co-Organizer of Las Vegas PHP UG

Co-Organizer of Las Vegas Developer UG

#vegastech enthusiast

Continuous Integration

As referred to in Wikipedia as a later elaboration of

continuous integration: build servers, which

automatically run the unit tests periodically or even after

every commit and report the results to the developer.

Travis CI

Free for open source software projects

Monthly rates for concurrent jobs for private projects

Direct integration with GitHub

Extremely customizable

Simple to use and configure

Build Configuration

Project configuration determines when builds are run

.travis.yml file contains build configuration

Matrix configuration will launch concurrent jobs

Builds can be triggered off of branches and pull

requests

Build Sections

Language

Versions

Environment

Script with hooks

Install with hooks

Service

Matrix

Notification

Language

Many languages supported

Specify PHP with:

language: php

Versions

Specify the versions of PHP to test against:

php:

- 5.4

- 5.5

- 5.6

- hhvm

Environment

Used to create multiple environments for testing via

environment variables:

env:

- SYMFONY_VERSION="2.0.*" DB=mysql

- SYMFONY_VERSION="dev-master" DB=mysql

Install with Hooks

Prepares environment

before_install:

- sudo apt-get update > /dev/null

install:

- composer --prefer-source --dev install

Script

Runs the tests

before_script:

- composer require

"guzzle/guzzle:${GUZZLE_VERSION}" --

prefer-source

script: bin/phpunit

Service

Data stores, messaging brokers, etc

Supports a wide array of ready to use services

services:

- rabbitmq

- memcached

Matrix

The build matrix allows for specifying

inclusion/exclusion of version and environment

combinations. Useful for known unsupported

combinations.

Provides for allowing failure in build combinations

that will not cause the entire build to fail. Useful for

testing non-production combinations.

Matrix Example

matrix:

allow_failures:

- php: hhvm

- env: GUZZLE_VERSION=dev-master

Notifications

Email notifications

IRC notification

Campfire notification

Flowdock notification

HipChat notification

Sqwiggle

notifications

Slack notifications

Webhook notification

Encryption

Encryption of special data is possible

Ruby CLI client to encrypt the data

Specify that data is encrypted in .travis.tml by

prepending data encrypted by client with “secure: “

Files can also be encrypted

Browser Testing

Supports XVFP. PhantomJS, and Sauce Labs

addons:

sauce_connect:

username: “username"

access_key: “access key"

Continuous Deployment

after_success hook can be used to deploy after

successful build.

Supports multiple providers as well as custom

deploy:

provider: heroku

api_key: "YOUR API KEY"

https://www.slideshare.net/AdamEnglander/travis-ci

https://github.com/LaunchKey/launchkey-

php/blob/master/.travis.yml

https://travis-ci.org/LaunchKey/launchkey-php

@adam_englander

#launchkey on freenode.net

#vegastech on freenode.net

[email protected]