Camelia

Continuous Integration for Perl 6 modules using Travis-CI

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.

Note! This site is about Perl 6.
If you are looking for a solution for the current production version of Perl 5, please check out the Perl 5 tutorial.

Use this sample as .travis.yml or follow the instructions for Perl 6 on Travis-CI.

branches:
  except:
    - gh-pages
sudo: false
language: perl6
perl6:
  - latest
install:
  - rakudobrew build-panda
  - panda installdeps .

Old Article

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.

Go to Travis-CI, sign up, let in synchronize with your GitHub repository and then in your account switch the specific project on.

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.

Examples

I have set up the repository with the content of this site, and with the source code of this site to use Travis-CI. You can take a look at the .travis.yml and the README.md files in both projects.

Dependencies

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

Building Rakudo Star for Travis-CI on Vagrant

Let me also include the instructions how I built Rakudo Star that is used in this process:

$ git clone git@github.com: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.

Extra steps for Building Rakudo Star for Travis-CI on a Digital Ocean Droplet

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 root@IP

# 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.


The Perl 6 Tricks and Treats newsletter has been around for a while. If you are interested to get special notification when there is new content on this site, it is the best way to keep track:
Email:
Full name:
This is a newsletter temporarily running on my personal site (szabgab.com) using Mailman, till I implement an alternative system in Perl 6.
Gabor Szabo
Written by Gabor Szabo

Published on 2015-01-01



Comments

In the comments, please wrap your code snippets within <pre> </pre> tags and use spaces for indentation.
comments powered by Disqus
Suggest a change
Elapsed time: 3.69209926

Perl 6 Tricks and Treats newsletter

Register to the free newsletter now, and get updates and news.
Email:
Name: