Upload
dave-cross
View
2.798
Download
9
Tags:
Embed Size (px)
DESCRIPTION
A quick introduction to using Github and Travis-CI to test Perl projects
Citation preview
Github is Awesome
Github is Awesome Because
Github is Awesome Because
● Git
Github is Awesome Because
● Git● Social coding
Github is Awesome Because
● Git● Social coding● Free
Github is Awesome Because
● Git● Social coding● Free● Octocat
Github is Awesome Because
API
APIs are Awesome
APIs allow you to add cool features to
Github
APIs are Awesome
APIs allow other people to add cool features to Github
APIs are Awesome
APIs allow other people to add cool features to Github
APIs are Awesome
APIs allow whole ecosystem of cool
new toys
Continuous Integration
Continuous Integration
● Source code control is awesome
Continuous Integration
● Source code control is awesome● Units tests are awesome
Continuous Integration
● Source code control is awesome● Units tests are awesome● Continuous integration is running
unit tests whenever you commit code
Continuous Integration
● Source code control is awesome● Units tests are awesome● Continuous integration is running
unit tests whenever you commit code● Which is awesome
TravisCI is Awesome
TravisCI is Awesome
● TravisCI monitors your Github projects
TravisCI is Awesome
● TravisCI monitors your Github projects● Watches for commits
TravisCI is Awesome
● TravisCI monitors your Github projects● Watches for commits● Runs unit tests
TravisCI is Awesome
● TravisCI monitors your Github projects● Watches for commits● Runs unit tests● Reports success or failure
TravisCI is Awesome
● TravisCI monitors your Github projects● Watches for commits● Runs unit tests● Reports success or failure● Which is awesome
TravisCI & Perl
● Easy to enable TravisCI for Perl projects
TravisCI & Perl
● Easy to enable TravisCI for Perl projects● Just add a file to your repos
TravisCI & Perl
● Easy to enable TravisCI for Perl projects● Just add a file to your repos● .travis.yml
TravisCI & Perl
● Easy to enable TravisCI for Perl projects● Just add a file to your repos● .travis.yml● Sign up with Travis
TravisCI & Perl
● Easy to enable TravisCI for Perl projects● Just add a file to your repos● .travis.yml● Sign up with Travis● Activate project
.travis.yml
language: perlperl: "5.18" "5.16" "5.14"
(Sidebar)
● No Perl 5.20 support yet● Planned but not implemented● There is a workaround● See http://mgnm.at/travis520
Sign Up With TravisCI
Sign Up With TravisCI
● http://travisci.org/
Sign Up With TravisCI
● http://travisci.org/● Sign in with your Github account
Sign Up With TravisCI
Sign Up With TravisCI
Integrating Continuously
● Now you're set up
Integrating Continuously
● Now you're set up● Commit a change to your repository
Integrating Continuously
● Now you're set up● Commit a change to your repository● And wait
Integrating Continuously
● Now you're set up● Commit a change to your repository● And wait● ...
Build Results
Build Results
Build Results
Build Results
Build Results
Build Results
Badges
Badges
Badges
Badges
More Complex Stuff
● That's all very easy
More Complex Stuff
● That's all very easy● Not all code is that simple
More Complex Stuff
● That's all very easy● Not all code is that simple● Can we do more?
More Complex Stuff
● That's all very easy● Not all code is that simple● Can we do more?● Rhetorical question
Example: Adding Database
● A database is a common requirement
Example: Adding Database
● A database is a common requirement● Include schema in repo
Example: Adding Database
● A database is a common requirement● Include schema in repo● Include data in repo
Example: Adding Database
● A database is a common requirement● Include schema in repo● Include data in repo● Load database before testing
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)
Example: Adding Database
before_script: - mysql -e 'create database my_db;' - mysql -D my_db < db/load_db.sql
Example: Connecting to Database
● TravisCI sets up a database user
Example: Connecting to Database
● TravisCI sets up a database user● Called “travis”
Example: Connecting to Database
● TravisCI sets up a database user● Called “travis”● No password
Example: Connecting to Database
● TravisCI sets up a database user● Called “travis”● No password● Use env variables
Example: Connecting to Database
● TravisCI sets up a database user● Called “travis”● No password● Use env variables● “env” (in .travis.yml)
Example: Connecting to Database
env: MYAPP_DB_SERVER=localhost MYAPP_DB_NAME=my_db MYAPP_DB_USER=travis MYAPP_DB_PASS=''
Example: Test Coverage
● Automatically run test coverage
Example: Test Coverage
● Automatically run test coverage● http://coveralls.io/
Example: Test Coverage
● Automatically run test coverage● http://coveralls.io/● Add to .travis.yml
.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
See also
● http://mgnm.at/travis520
Example: Test Coverage
Example: Test Coverage
Example: Test Coverage
More and More
● Many more things are possible
More and More
● Many more things are possible● Barely scratching the surface
More and More
● Many more things are possible● Barely scratching the surface● See http://docs.travisci.com/
More and More
● Many more things are possible● Barely scratching the surface● See http://docs.travisci.com/● If you do something cool, please blog it
Summary
Summary
● Github is awesome
Summary
● Github is awesome● Unit tests are awesome
Summary
● Github is awesome● Unit tests are awesome● Continuous integration is awesome
Summary
● Github is awesome● Unit tests are awesome● Continuous integration is awesome● TravisCI is awesome
Summarised Summary
Summarised Summary
● APIs are awesome
Summarised Summary
● APIs are awesome● Other people are awesome
Questions?