Continuous integration/nightly builds for your games?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
clofresh
Citizen
Posts: 87
Joined: Sun Jul 26, 2009 4:21 pm
Contact:

Continuous integration/nightly builds for your games?

Post by clofresh » Sat Mar 30, 2013 2:37 pm

Hey guys,

Does anyone have a continuous integration process running for their games? I was thinking it'd be cool to have a service that pulled from source control every night, ran some tests, built the .love and uploaded it somewhere where everyone can download it. Maybe even integrate with itch.io so people can always buy the latest version of the game.

Does anyone currently do something similar to that?

.Carlo
----------------------------------------
Sluicer Games

User avatar
vitaminx
Citizen
Posts: 95
Joined: Fri Oct 19, 2012 7:16 am
Location: international
Contact:

Re: Continuous integration/nightly builds for your games?

Post by vitaminx » Mon Apr 01, 2013 3:05 am

Yes, I have.

Let's take one of my projects called "bananaracer" as an example.

This project is on GitHub and I've activated a WebHook URL for it, the hook points to http://www.callistix.net/cgi/gitpush_bananaracer.cgi.

callistix is a Linux VPS where I'm running Apache and I've written a CGI to automatically build a .love package each time a change in the codetree is pushed.
This would be more like a build on demand, not a nightly build, but it's in my opinion much better because you get the packages immediately.

The finished packages are then copied to the "files" subdomain on the same server: http://files.callistix.net/bananaracer/

The CGI is only building a .love package for the moment, but could easily be extended to build a .deb, .rpm or a readymade Windows game archive including love itself.
Also, the script assumes that the code itself is under the git subdirectory "code", because this is the way I organize it. But that also can easily be changed.

Well, here's the CGI:

Code: Select all

#!/bin/bash

echo "Content-type: text/plain"
echo

REPO=bananaracer

if [ "$REQUEST_METHOD" = "POST" ]; then
    if [ "$CONTENT_LENGTH" -gt 0 ]; then
        read -n $CONTENT_LENGTH POST_DATA <&0

        # check if something below /code has been changed
        GREP_SUC=$(echo $POST_DATA | grep -l '%5B%22code%2F' | wc -l | xargs)

        # if yes, then rebuild
        if [ "$GREP_SUC" == "1" ];then
            cd /tmp
            if [ -d $REPO ]; then rm -rf $REPO; fi

            echo -n "Pulling repository from github..."
            git clone https://github.com/humansarepuppies/$REPO.git

            if [ $? -ne 0 ]; then echo " FAILED."
            else
                echo " OK."
                cd $REPO/code

                echo -n "Creating archive..."
                if [ -f /home/vitaminx/www/files/$REPO/$REPO\_`date +%y%m%d`.love ]; then rm -f /home/vitaminx/www/files/$REPO/$REPO\_`date +%y%m%d`.love; fi
                zip -r /home/vitaminx/www/files/$REPO/$REPO\_`date +%y%m%d`.love * >/dev/null
                if [ $? -ne 0 ]; then echo " FAILED."; else echo " OK."; fi

                cd ../..
                rm -rf $REPO
            fi
        fi
    fi
fi
Greetings,
vitaminx

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests