Build Infrastructure: What It Is, Why You Need It, and How to Use Python to Fuel it
1. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
BUILD
INFRASTRUCTURE
What It Is, Why You Need It,
and How to Use Python to
Fuel It
2. COPYRIGHT 2014 @ UNITY
TECHNOLOGIES
COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
WHAT IS BUILD
ENGINEERING?
BUILD ENGINEERING
IS THE GLUE THAT
HOLDS THE
SOFTWARE
DEVELOPMENT
PROCESS
TOGETHER.
3. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
EXAMPLES OF BUILD
ENGINEERING
• Choosing, configuring, customizing, and
maintaining a CI server
• Applying/optimizing development models
(branch-based, patch-based, etc)
• Build optimizations (distributed builds, bulk
builds, etc)
• … and much more
4. COPYRIGHT 2014 @ UNITY
TECHNOLOGIES
COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
WHY DO I CARE?
5. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
• Na’Tosha J. Bard
• Copenhagen, Denmark
• Engineering Tools Lead at Unity
Technologies (5+ years)
• Open-Source & Linux Enthusiast
• Married
• 2 cats
ABOUT THE
SPEAKER
6. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
FOR YOUR REFERENCE
Slides will be available here:
http://natoshabard.com/speaking
Keep in touch:
Twitter: @natosha_bard
E-mail: natosha@gmail.com
7. COPYRIGHT 2014 @ UNITY
TECHNOLOGIES
COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
WHAT IS UNITY?
8. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
9. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
10. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
11. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
12. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
13. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
WHAT IS UNITY?
• Game Engine & Content Creation Toolkit
• Editor for Mac OS X & Windows
• Experimental build for Linux
• Runtime ported to 22 platforms
• Mostly written in C++
• Gameplay scripts written in C#
• Scripting engine for gameplay code built on
top of Mono
15. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
2010
• Unstable SVN Server
• All developers commit directly to trunk
• Unstable CI Server
• 6 VisualStudio and Xcode projects wrapped
in Perl
• Automated Tests nightly on 2 platforms
• 4 machines for building
• Deployment scripts running from developer
machines
• No automatic verification of deployed builds
16. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
2015
• DVCS with Mercurial
• Branch-based development
• Project files generated with Jamplus
• Stable CI Solution (Internally-Developed)
• Automated tests running on developer branches
and on our mainline on various platforms
• Build cloud of over 200 virtual and physical
machines
• Web-based publishing portal for deploying
builds
17. COPYRIGHT 2014 @ UNITY
TECHNOLOGIES
COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
OUR RELEASE
CYCLES WENT
FROM AS LONG AS
18 MONTHS
TO EVERY 3
MONTHS
WHILE OUR
DEVELOPMENT
TEAM GREW 400%.
18. COPYRIGHT 2014 @ UNITY
TECHNOLOGIES
COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
FOUNDATION OF
BUILD
INFRASTRUCTURE
20. COPYRIGHT 2014 @ UNITY
TECHNOLOGIES
COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
WHAT ON EARTH
DOES THIS ALL HAVE
TO DO WITH
PYTHON?
PYTHON IS AN
AMAZING LANGUAGE
FOR WRITING
DEVELOPMENT
TOOLS.
21. COPYRIGHT 2014 @ UNITY
TECHNOLOGIES
COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
ONE-CLICK BUILDS:
BUILDING YOUR
SOFTWARE WITH
JUST ONE CLICK
22. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
BENEFITS OF ONE-CLICK BUILDS
• KISS principle
• Build early, Build often
• Groundwork for other software
development principles
23. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
GETTING STARTED WITH ONE-
CLICK BUILDS
• Depends on your application
• Possible Solutions: SCons, Waf
• Cohesive buildsystem
• Keep platform-dependent issues in mind!
24. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
WHAT UNITY DOES
• Currently using Jamplus and Perl
• Didn’t find a good Python-based tool that
met all of our requirements :-(
• Migrating to Gradle
• http://gradle.org/migrating-a-large-c-
codebase-to-gradle/
25. COPYRIGHT 2014 @ UNITY
TECHNOLOGIES
COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
BUILD
AUTOMATION:
A BUILD SERVER
TO RUN YOUR ONE-
CLICK BUILDS
26. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
BENEFITS OF BUILD AUTOMATION
• Verification
• Parallelization
• Groundwork for other software
development principles
27. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
GETTING STARTED WITH BUILD
AUTOMATION
• Depends on feature set you need
• Possible Solution: Buildbot
• Give careful thought to buildserver/
buildsystem configuration split
28. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
HOW UNITY DOES IT
• Custom solution built on top of Buildbot -
“Katana”
• https://github.com/Unity-Technologies/katana/
• http://mariangemarcano.blogspot.dk/
• Katana’s Build Cloud configured with Salt
• http://saltstack.com/
29. COPYRIGHT 2014 @ UNITY
TECHNOLOGIES
COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
CONTINUOUS
INTEGRATION:
CONTINUOUSLY
RUN THOSE
AUTOMATED
BUILDS
30. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
BENEFITS OF CONTINUOUS
INTEGRATION
• Increased Developer Productivity
• Helps avoid “Integration Hell”
• Automatically identifies exact failure point
31. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
GETTING STARTED WITH
CONTINUOUS INTEGRATION
• Generally, the same solutions as for Build
Automation apply here
• Note: Sometimes “Frequent Integration” is
good enough
32. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
HOW UNITY DOES IT
• We don’t…yet
• Frequent integration
• Nightly builds on mainlines
• On-demand builds on other branches
33. COPYRIGHT 2014 @ UNITY
TECHNOLOGIES
COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
AUTOMATED
TESTING:
RUN TESTS ON
THOSE
CONTINUOUSLY-
RUNNING BUILDS
34. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
BENEFITS OF AUTOMATED
TESTING
• Provides protection against regressions
• Saves human resources
• Keeps test suites from bit-rotting
35. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
GETTING STARTED WITH
AUTOMATED TESTING
• Find a test framework for your technology
• PyUnit (unittest), nose
• Sometimes creating your own frameworks
is an answer (i.e, High-Level Integration
Tests)
36. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
HOW UNITY DOES IT
• No Python :-(
• Custom test frameworks in C#
• Heavy use of NUnit
• Custom test runner in Perl
38. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
BENEFITS OF AUTOMATED
DEPLOYMENT
• Less error-prone than manual publishing
• Easy to verify
• Easy to track release history
39. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
GETTING STARTED WITH
AUTOMATED DEPLOYMENT
• Often related to build automation/CI
solution
• Highly dependent on your organization’s
server infrastructure and type of software
• Start with a simple script and expand
• Consider integrating directly with your
already-existing build server solution
40. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
HOW UNITY DOES IT
• Web-based publishing portal - “Saihai”
• Promoting builds to internal QA and
publishing to external testers.
• Publishing final releases to CDN
• Provides API regarding published releases
for other internal services
42. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
A CALL TO ARMS: TIPS FOR
GETTING STARTED
• Just do something
• When advocating for change, focus on the
benefits
• Don’t underestimate the value of having
dedicated build engineers on your team
43. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
COME JOIN US!
• Release Managers
• Web Developers (Full-Stack & Front-End
Only)
• Low-level Build Engineers
• High-level Build Engineers
• Version Control Experts
• Packaging & Distribution Engineers
http://unity3d.com/jobs
44. COPYRIGHT 2015 @ UNITY
TECHNOLOGIES
les
vels
pt.
pt.
pt.
pt.
pt.
AB
ely,
Thank You!
@natosha_bard