Travis-CI is a service that offers Continuous Integration to open source project hosted on GitHub free of charge. It supports a number of languages, including several versions of Perl 5, but it does not support Perl 6 yet.
In this article you'll see how can you set up a Perl 6 based project to use the Travis-CI infrastructure using the latest version of Rakudo Star.
Use this sample as .travis.yml or follow the instructions for Perl 6 on Travis-CI.
branches: except: - gh-pages language: perl6 sudo: false perl6: - latest install: - rakudobrew build-zef - zef install Test::META - zef --depsonly install . env: - AUTHOR_TESTING=1
In this article you'll see how can you set up a Perl 6 based project to use the Travis-CI infrastructure using a binary version of Rakudo Star 2015.07.
In the GitHub repository of your project add a file called .travis.yml with the following content:
branches: except: - gh-pages language: c before_install: - git clone https://github.com/szabgab/perl6-travis-ci.git ../perl6-travis-ci - ../perl6-travis-ci/install_rakudo.sh script: - ../perl6-travis-ci/run_tests.sh
git add, git commit and the git push.
Once this file reaches GitHub, and from that point every time you push out any of the changes you have, will start a new Travis-CI process.
Travis-CI will first get a copy of the current state of your project then the commands in the .travis.yml will be executed. The before_install part tells Travis-CI to clone the perl6-travis-ci repository I created. Once that has been cloned it will run the install_rakudo.sh script from the repository. That script download the binary version of Rakudo Star 2014.12.1 I built for this purpose.
Then the script part will be executed which will use the prove command of Perl 5 which happens to be available on the system, (It has 5.14.x) to run
prove -ve "perl6 -Ilib"
That will run all the test in the t/ directory.
You can then add a Travis-CI badge to the README.md file of your project to show the current status of the project by adding the following code:
###Status [![Build Status](https://travis-ci.org/USER/PROJECT.png)](https://travis-ci.org/USER/PROJECT)
where you'd replace USER and PROJECT with your GitHub username and the name of the repository respectively.
On thing that the current scripts don't handle yet is installing the dependencies of the module before running the tests. For now you'll need to add manually the list of dependencies using the install_module.sh script.
In this example I have installed the YAML and Web modules.
branches: except: - gh-pages language: c before_install: - git clone https://github.com/szabgab/perl6-travis-ci.git ../perl6-travis-ci - ../perl6-travis-ci/install_rakudo.sh - ../perl6-travis-ci/install_module.sh YAML - ../perl6-travis-ci/install_module.sh Web script: - ../perl6-travis-ci/run_tests.sh
Let me also include the instructions how I built Rakudo Star that is used in this process:
$ git clone [email protected]:szabgab/perl6-travis-ci.git $ cd perl6-travis-ci $ vagrant up $ vagrant ssh
$ sudo mkdir /home/travis $ sudo chown vagrant.vagrant /home/travis/ $ sudo aptitude -y install gcc make
$ wget http://rakudo.org/downloads/star/rakudo-star-2015.07.tar.gz $ tar xzf rakudo-star-2015.07.tar.gz $ cd rakudo-star-2015.07 $ perl Configure.pl --backends=moar --gen-moar --prefix=/home/travis/rakudo-2015-07-01 $ make $ make install $ cd /home/travis $ tar czf rakudo-2015-07-01.tar.gz rakudo-2015-07-01 $ mv rakudo-2015-07-01.tar.gz /vagrant $ exit
I used an extra number to represent the version numbers of my own experiments.
Finally I've uploaded rakudo-2015-07-01.tar.gz to the download directory of DWIM Perl.
Enjoy, and send me improvements.
Earlier I built Rakudo Start for Travis-CI on a Digital Ocean Droplet. Let me add a few releevant words here:
Create a Digital Ocean Droplet (1GB Ram Ubuntu 12.04.05 x64). I am using the older version of Ubuntu because AFAIK that's what Travis-CI is using.
Once the Droplet is created, Digital Ocean gives me the IP address of the machine:
First thing is to update all the packages on the server so it won't be exposed to already fixed security issues. Not even during the short period while I am building Rakudo Star.
If you want to follow these instruction you'll replace the IP with the IP address given by Digital Ocean and later you might need to replace the version number of Rakudo Star.
$ ssh [email protected] # aptitude update # aptitude -y safe-upgrade # sudo reboot
After the machine reboots comes the building of Rakudo Star as has been described above.
Then I can copied the resulting file to my local machine before uploading it to DWIM Perl.
Published on 2015-01-01