Automating builds with Jenkins and Unity · Automating builds with Jenkins and Unity Sebastian...

Preview:

Citation preview

Automating builds with Jenkins and UnitySebastian Dorda

GameDev Tech Talk

16.01.2016

Build automation is … … the process of automating the creation of a software build and the associated

processes including:

compiling computer source code into binary code,

packaging binary code

running automated tests.

(Wikipedia)

Why? Manually creating a build/release is boring and takes a lot of time

-> let the machine do the work

Documented process

Everybody can trigger it

Error checks and tests that nobody can forget to run

Collect statistics

History

Standards (improve communication, easier onboarding)

The Exiled Tiny MMO

PC (win/linux/osx)

Unity Client

Photon Server

Formerly known as Das Tal

Jenkins Open source

Java

Tons of plugins

Runs on windows too

Formerly known as Hudson

A build in The Exiled consists of Client PC

Windows

Linux

OSX

Patcher PC Windows

Linux

OSX

Server + Tests

Data LUA script files + Checks

Ini csv files

Translation

Map files

Deploy Upload Clients/Patchers/Servers/Data

Upload Translation

Upload Steam

Restart Servers

das-tal-master-client-win Checkout git master branch

Run scripts/build-pre-bash.sh script to store commit, version, date into BuildInfo.cs sed -i "s/_COMMIT_/$MY_COMMIT/" client/Assets/Plugins/Code/Common/BuildInfo.cs

Run scripts/build-win-client.bat rmdir /S /Q builds

mkdir builds"%UNITY%" -nographics -quit -batchmode -projectPath "%CD%\client" -logFile"%CD%\build_client.log" -executeMethod BuildFromCommandLine.RunWin

Run scripts/build-post-client-win.sh SEVENZIP=7z

pushd builds/${MY_PLATFORM}$SEVENZIP a ../../zips/client-${MY_PLATFORM}.zip client

Send notifications

Issues Jenkins git checkout via ssh with key

-> local mirror of the repository (cron) + local checkout

Don‘t forget to backup the job xml files

No bash-> cygwin (Execute shell step)#!C:\cygwin64\bin\bash.exeexport PATH=$PATH:/usr/bindos2unix scripts/build-pre-bash.shbash -ex scripts/build-pre-bash.sh

Too many unity instances running-> Block Queued Job PluginJenkins Exclusion Plug-in

Issues Unity serial in case of VM without real graphic card

-> Unity has a command line flag to activate license key

Execute CS in the build process-> Unity can run static methods from cmdline„-executeMethod MyClass.MyMethod“

Executable flags for linux/osx broken-> chmod 777 builds/linux/client/exiled*.x86chmod 777 builds/linux/client/exiled*.x86_64

Where is the output log-> „-logFile "%CD%\build_client.log“

Future Automate UnityTestTools for client tests

Automate feature branches

Try Unity Cloud Build

Thanks Sebastian Dorda

sebi@fairydist.com

@schattenkindnet

http://www.the-exiled.co/

Recommended