Godot and Jenkins

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By EIREXE
:warning: Old Version Published before Godot 3 was released.

If for some reason you want CI, you can use jenkins with godot, here’s my script, I usually like to divide into different build steps even if it could be one giant script for organization.

Preparation

First of all you need godot server installed, I installed mine under /usr/bin/godot-server

Then you need the export templates installed under the jenkins user, to do that you can simply unzip the export templates file (it’s a zip with a different extension), and put the templates folder under /var/lib/jenkins/.godot

Script
Clean the build folder and recreate it.

if [ -d "builds" ]; then
  rm -rf builds
fi
mkdir builds
mkdir builds/linux
mkdir builds/windows

This one is optional, because we store all of our binary files in a sepearate SVN server (because SVN handles them so much better than git)

if [ -d "Assets" ]; then
  svn update Assets --username <user> --password <pass>
else
  svn checkout http://wiki.modulous.net/repos/pcg_assets/trunk Assets --username <user> --password <pass>
fi

Calls the server to export the game, for some strange reason the godot server reports an error ocurred even when it didn’t, so we have to temporaly add the set +e line and the echo line.

set +e
godot_server -export_debug 'Linux X11' builds/linux/peppercarrotgame
godot_server -export_debug 'Windows Desktop' builds/windows/peppercarrotgame.exe
echo

We zip the files so that then jenkins can archive them.

zip -rj builds/PepperCarrotGame-master-$BUILD_NUMBER-Linux.zip builds/linux/*
zip -rj builds/PepperCarrotGame-master-$BUILD_NUMBER-Windows.zip builds/windows/*

enter image description here