Github, Travis-CI and Perl

87
Github, Travis-CI & Perl Dave Cross [email protected] @davorg

description

A quick introduction to using Github and Travis-CI to test Perl projects

Transcript of Github, Travis-CI and Perl

Page 1: Github, Travis-CI and Perl

Github,Travis­CI

& PerlDave Cross

[email protected]@davorg

Page 2: Github, Travis-CI and Perl

Github is Awesome

Page 3: Github, Travis-CI and Perl

Github is Awesome Because

Page 4: Github, Travis-CI and Perl

Github is Awesome Because

● Git

Page 5: Github, Travis-CI and Perl

Github is Awesome Because

● Git● Social coding

Page 6: Github, Travis-CI and Perl

Github is Awesome Because

● Git● Social coding● Free

Page 7: Github, Travis-CI and Perl

Github is Awesome Because

● Git● Social coding● Free● Octocat

Page 8: Github, Travis-CI and Perl

Github is Awesome Because

API

Page 9: Github, Travis-CI and Perl

APIs are Awesome

APIs allow you to add cool features to 

Github

Page 10: Github, Travis-CI and Perl

APIs are Awesome

APIs allow other people to add cool features to Github

Page 11: Github, Travis-CI and Perl

APIs are Awesome

APIs allow other people to add cool features to Github

Page 12: Github, Travis-CI and Perl

APIs are Awesome

APIs allow whole ecosystem of cool 

new toys

Page 13: Github, Travis-CI and Perl

Continuous Integration

Page 14: Github, Travis-CI and Perl

Continuous Integration

● Source code control is awesome

Page 15: Github, Travis-CI and Perl

Continuous Integration

● Source code control is awesome● Units tests are awesome

Page 16: Github, Travis-CI and Perl

Continuous Integration

● Source code control is awesome● Units tests are awesome● Continuous integration is running 

unit tests whenever you commit code

Page 17: Github, Travis-CI and Perl

Continuous Integration

● Source code control is awesome● Units tests are awesome● Continuous integration is running 

unit tests whenever you commit code● Which is awesome

Page 18: Github, Travis-CI and Perl

Travis­CI is Awesome

Page 19: Github, Travis-CI and Perl

Travis­CI is Awesome

● Travis­CI monitors your Github projects

Page 20: Github, Travis-CI and Perl

Travis­CI is Awesome

● Travis­CI monitors your Github projects● Watches for commits

Page 21: Github, Travis-CI and Perl

Travis­CI is Awesome

● Travis­CI monitors your Github projects● Watches for commits● Runs unit tests

Page 22: Github, Travis-CI and Perl

Travis­CI is Awesome

● Travis­CI monitors your Github projects● Watches for commits● Runs unit tests● Reports success or failure

Page 23: Github, Travis-CI and Perl

Travis­CI is Awesome

● Travis­CI monitors your Github projects● Watches for commits● Runs unit tests● Reports success or failure● Which is awesome

Page 24: Github, Travis-CI and Perl

Travis­CI & Perl

● Easy to enable Travis­CI for Perl projects

Page 25: Github, Travis-CI and Perl

Travis­CI & Perl

● Easy to enable Travis­CI for Perl projects● Just add a file to your repos

Page 26: Github, Travis-CI and Perl

Travis­CI & Perl

● Easy to enable Travis­CI for Perl projects● Just add a file to your repos● .travis.yml

Page 27: Github, Travis-CI and Perl

Travis­CI & Perl

● Easy to enable Travis­CI for Perl projects● Just add a file to your repos● .travis.yml● Sign up with Travis

Page 28: Github, Travis-CI and Perl

Travis­CI & Perl

● Easy to enable Travis­CI for Perl projects● Just add a file to your repos● .travis.yml● Sign up with Travis● Activate project

Page 29: Github, Travis-CI and Perl

.travis.yml

language: perlperl:  ­ "5.18"  ­ "5.16"  ­ "5.14"

Page 30: Github, Travis-CI and Perl

(Sidebar)

● No Perl 5.20 support yet● Planned but not implemented● There is a workaround● See http://mgnm.at/travis520

Page 31: Github, Travis-CI and Perl

Sign Up With Travis­CI

Page 32: Github, Travis-CI and Perl

Sign Up With Travis­CI

● http://travis­ci.org/

Page 33: Github, Travis-CI and Perl

Sign Up With Travis­CI

● http://travis­ci.org/● Sign in with your Github account

Page 34: Github, Travis-CI and Perl

Sign Up With Travis­CI

Page 35: Github, Travis-CI and Perl

Sign Up With Travis­CI

Page 36: Github, Travis-CI and Perl

Integrating Continuously

● Now you're set up

Page 37: Github, Travis-CI and Perl

Integrating Continuously

● Now you're set up● Commit a change to your repository

Page 38: Github, Travis-CI and Perl

Integrating Continuously

● Now you're set up● Commit a change to your repository● And wait

Page 39: Github, Travis-CI and Perl

Integrating Continuously

● Now you're set up● Commit a change to your repository● And wait● ...

Page 40: Github, Travis-CI and Perl

Build Results

Page 41: Github, Travis-CI and Perl

Build Results

Page 42: Github, Travis-CI and Perl

Build Results

Page 43: Github, Travis-CI and Perl

Build Results

Page 44: Github, Travis-CI and Perl

Build Results

Page 45: Github, Travis-CI and Perl

Build Results

Page 46: Github, Travis-CI and Perl

Badges

Page 47: Github, Travis-CI and Perl

Badges

Page 48: Github, Travis-CI and Perl

Badges

Page 49: Github, Travis-CI and Perl

Badges

Page 50: Github, Travis-CI and Perl

More Complex Stuff

● That's all very easy

Page 51: Github, Travis-CI and Perl

More Complex Stuff

● That's all very easy● Not all code is that simple

Page 52: Github, Travis-CI and Perl

More Complex Stuff

● That's all very easy● Not all code is that simple● Can we do more?

Page 53: Github, Travis-CI and Perl

More Complex Stuff

● That's all very easy● Not all code is that simple● Can we do more?● Rhetorical question

Page 54: Github, Travis-CI and Perl

Example: Adding Database

● A database is a common requirement

Page 55: Github, Travis-CI and Perl

Example: Adding Database

● A database is a common requirement● Include schema in repo

Page 56: Github, Travis-CI and Perl

Example: Adding Database

● A database is a common requirement● Include schema in repo● Include data in repo

Page 57: Github, Travis-CI and Perl

Example: Adding Database

● A database is a common requirement● Include schema in repo● Include data in repo● Load database before testing

Page 58: Github, Travis-CI and Perl

Example: Adding Database

● A database is a common requirement● Include schema in repo● Include data in repo● Load database before testing● “before_script” (in .travis.yml)

Page 59: Github, Travis-CI and Perl

Example: Adding Database

before_script: - mysql -e 'create database my_db;' - mysql -D my_db < db/load_db.sql

Page 60: Github, Travis-CI and Perl

Example: Connecting to Database

● Travis­CI sets up a database user

Page 61: Github, Travis-CI and Perl

Example: Connecting to Database

● Travis­CI sets up a database user● Called “travis”

Page 62: Github, Travis-CI and Perl

Example: Connecting to Database

● Travis­CI sets up a database user● Called “travis”● No password

Page 63: Github, Travis-CI and Perl

Example: Connecting to Database

● Travis­CI sets up a database user● Called “travis”● No password● Use env variables

Page 64: Github, Travis-CI and Perl

Example: Connecting to Database

● Travis­CI sets up a database user● Called “travis”● No password● Use env variables● “env” (in .travis.yml)

Page 65: Github, Travis-CI and Perl

Example: Connecting to Database

env: MYAPP_DB_SERVER=localhost MYAPP_DB_NAME=my_db MYAPP_DB_USER=travis MYAPP_DB_PASS=''

Page 66: Github, Travis-CI and Perl

Example: Test Coverage

● Automatically run test coverage

Page 67: Github, Travis-CI and Perl

Example: Test Coverage

● Automatically run test coverage● http://coveralls.io/

Page 68: Github, Travis-CI and Perl

Example: Test Coverage

● Automatically run test coverage● http://coveralls.io/● Add to .travis.yml

Page 69: Github, Travis-CI and Perl

.travis.ymlinstall:  cpanm ­­quiet –notest \           Devel::Cover::Report::Coveralls

script:  ­ PERL5OPT=­Mdevel::Cover=­coverage,statement, \    branch,condition,path,subroutine prove ­lrsv t  ­ cover

after_success:  ­ cover ­report coveralls

Page 70: Github, Travis-CI and Perl

See also

● http://mgnm.at/travis520

Page 71: Github, Travis-CI and Perl

Example: Test Coverage

Page 72: Github, Travis-CI and Perl

Example: Test Coverage

Page 73: Github, Travis-CI and Perl

Example: Test Coverage

Page 74: Github, Travis-CI and Perl

More and More

● Many more things are possible

Page 75: Github, Travis-CI and Perl

More and More

● Many more things are possible● Barely scratching the surface

Page 76: Github, Travis-CI and Perl

More and More

● Many more things are possible● Barely scratching the surface● See http://docs.travis­ci.com/

Page 77: Github, Travis-CI and Perl

More and More

● Many more things are possible● Barely scratching the surface● See http://docs.travis­ci.com/● If you do something cool, please blog it

Page 78: Github, Travis-CI and Perl

Summary

Page 79: Github, Travis-CI and Perl

Summary

● Github is awesome

Page 80: Github, Travis-CI and Perl

Summary

● Github is awesome● Unit tests are awesome

Page 81: Github, Travis-CI and Perl

Summary

● Github is awesome● Unit tests are awesome● Continuous integration is awesome

Page 82: Github, Travis-CI and Perl

Summary

● Github is awesome● Unit tests are awesome● Continuous integration is awesome● Travis­CI is awesome

Page 83: Github, Travis-CI and Perl

Summarised Summary

Page 84: Github, Travis-CI and Perl

Summarised Summary

● APIs are awesome

Page 85: Github, Travis-CI and Perl

Summarised Summary

● APIs are awesome● Other people are awesome

Page 86: Github, Travis-CI and Perl

Questions?

Page 87: Github, Travis-CI and Perl

Thank You

Dave [email protected]

@davorg