Travis-CI - Continuos integration in the cloud for PHP

1,643 views

Published on

Published in: Technology

Travis-CI - Continuos integration in the cloud for PHP

  1. 1. Travis-CI Continuous integration in the cloud for PHP
  2. 2. Federico Lozada Mosto @mostofreddy @federicolozadamosto
  3. 3. Who makes tests? Who makes builds?
  4. 4. Who uses CI server?
  5. 5. Who uses multiple environments?
  6. 6. Hi, I’m Travis CI, a hosted continuous integration service for open-source and private projects.
  7. 7. What?
  8. 8. Continous integration Open source Distributed
  9. 9. Android C/C++ Clojure Erlang Go Groovy Haskell Java Javascript NodeJS Objective-C PERL PHP Phyton Ruby Scala
  10. 10. Services: MySQL PostgreSQL MongoDB CouchDB Redis Riak RabbitMQ Memcached Cassandra Neo4j Elasticsearch Krestel SQLite3 ZeroMQ
  11. 11. Notifications: Email IRC Campfire Flowdock HipChat Sqwiggle Slack Webhook
  12. 12. Deploy: Appfog Cloud66 Heroku Modulus Nodejitsu OpenShift cloudControl CloudFoundry RubyGems AWS OpsWorks PyPI Divshot.io Rackspace Cloud Files Npm S3 Ninefold Engine Yard Github Releases Custom deployment
  13. 13. How?
  14. 14. login How does it work?
  15. 15. service hook How does it work?
  16. 16. gi add .travis.yml git commit .travis.yml git push …. How does it work?
  17. 17. gi add . git commit . git push …. service hook run tests / builds fresh environments How does it work?
  18. 18. .travis.yml
  19. 19. .travis.yml
  20. 20. .travis.yml
  21. 21. Build lifecycle 1. before_install 2. install 3. before_script 4. script 5. after_script 6. after_success or after_failure
  22. 22. Build status
  23. 23. Why?
  24. 24. The end goal is...
  25. 25. with less effort Higher-quality code and...
  26. 26. #HAPPYDAY
  27. 27. Extras
  28. 28. xdebug xml xmlreader Xmlrpc xmlwriter xsl zip zlib [Zend Modules] Xdebug bcmath bz2 Core ctype curl date dom ereg exif fileinfo filter ftp gd gettext hash iconv intl json libxml mbstring mcrypt mysql mysqli mysqlnd openssl pcntl pcre PDO pdo_mysql pdo_pgsql pdo_sqlite pgsql Phar posix readline Reflection session shmop SimpleXML soap sockets SPL sqlite3 standard sysvsem sysvshm tidy tokenizer VM - PHP
  29. 29. email recipients: - dummy@server.com on_success: [always|never|change] # default: change on_failure: [always|never|change] # default: always irc: channels: - "chat.freenode.net#my-channel" on_success: [always|never|change] # default: always on_failure: [always|never|change] # default: always notifications
  30. 30. Apc Memcache Memcached Mongo Amqp Zmq Xdebug Redis PHP extensions before_script - echo "extension = <extension>.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
  31. 31. PHP extensions before_script - pear install <extension> - echo "extension = <extension>.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - php -m
  32. 32. PHP extensions
  33. 33. http://yaml.travis-ci.org/ Travis lint
  34. 34. apt-get install !!! before_script: - curl http://repo.varnish-cache.org/debian/GPG-key.txt | sudo apt-key add - - echo "deb http://repo.varnish-cache.org/ubuntu/ precise varnish-3.0" | sudo tee -a /etc/apt/sources.list - sudo apt-get update -qq - sudo apt-get install varnish
  35. 35. services services: - mongodb - couchdb - memcached env: - DB=mysql before_script: - mongo mydb_test --eval 'db.addUser("travis", "test");' - if [[ "$DB" == "mysql" ]]; then mysql -e "create database IF NOT EXISTS hello_world_test;" -uroot; fi
  36. 36. How to skip a build [ci skip]
  37. 37. Federico Lozada Mosto @mostofreddy @federicolozadamosto Thanks!

×