34
Ian McLean Con$nuous Build Systems: Start to Finish Thursday, December 17, 2009

Continuous Build Systems Start to Finish

Embed Size (px)

Citation preview

Ian  McLean      

Con$nuous  Build  Systems:  Start  to  Finish

Thursday, December 17, 2009

Who  is  this  guy?

Me  Now:• Flex  since  2005.• Flash  for  much  longer.• Currently  a  minion  for  the  evil  internet  ad  syndicate.

Also  me:• Background  in  engineering,  game  development.• I  write  dance  music  {150,  170}  bpm• I  like  kung  fu• Fluent  in  Japanese  when  drunk  enough.

Thursday, December 17, 2009

Build  Systems  FTW!!

Thursday, December 17, 2009

Two  parts

One  Part  Build  Automa$onScripted  build  process  (think  “Make”  scripts)

One  Part  Build  Management•Scheduling  and  build  execu$on    •Repor$ng  on  build  status•Maintaining  history

Most  importantly,make  builds  results  readily  available!

Thursday, December 17, 2009

Benefits

Internal• Automate  complex  tasks• Know  when  builds  really  fail

• Compiler  errors• Test  failures

External•   Visibility  into  the  project.

Yes,  stakeholders  can  monitor  your  progress!(WARNING:  You  may  or  not  want  this)

Thursday, December 17, 2009

Some$mes  presenta$ons  use  diagrams

Thursday, December 17, 2009

Other  common  tasks

• Running  unit  tests

• Crea>ng  documenta>on

• Packaging

• Produc>on  Deployment

Thursday, December 17, 2009

Popular  Build  Systems

Commercial:

• Atlassian  Bamboo

Open  Source:

• Hudson,  Apache  Con>nuum

• CruiseControl

– Flexible

– Lots  of  func>onality

– A  much  higher  learning  curve

Thursday, December 17, 2009

Common  build  automa>on  tools

Apache  Ant

Apache  Maven•   -­‐Similar  to  Ant

•   -­‐Enforces  good/standard  project  structure

…We’ll  be  looking  at  Ant.

Thursday, December 17, 2009

How  does  it  work  with  Flex?

A  Couple  of  op>ons:

• Manually  execute  Flex  compiler  binaries

• Use  Flex  Ant  tasks– Provides  MXMLC  and  COMPC  tasks

Thursday, December 17, 2009

A  build  script  from  scratch

• Step  one:  Write  targets  for  the  following

1. Define  paths  and  proper$es2. Clean3. SCM  update4. Build  target  (mxmlc)5. Run  tests  (FlexUnit)6. Handle  applica$on  versioning/update  system7. Package  target  (adt)8. Generate  documenta$on  (AsDoc)9. Deploy  to  produc$on

• Step  two:  – Say  goodbye  to  your  sanity

Thursday, December 17, 2009

Antennae  is  your  friend

• Antennae– Flex/Air  Build  automa>on  scripts– h_p://code.google.com/p/antennae/

Capabili>es  (to  name  a  few):– Compile  SWF/SWC/AIR– Compile  Java– Run  tests– ASDoc  genera>on

Thursday, December 17, 2009

Demo  

Building  Flex  and  AIR  with  Antennae

Thursday, December 17, 2009

AIR  building  >ps

Just  use  the  Antennae  AIR  template.

Tips:

• Don’t  forget  to  set    <content>mySwf.swf</content>in  AIR  applica$on  descriptor  xml– FlashBuilder  automa$cally  does  this,  Antennae  doesn’t

• Build.xml  has  mul$ple  targets– Build,  stage,  package,  run– You’ll  need  to  manually  call  what  you  want

Thursday, December 17, 2009

 CruiseControl  Concepts

BootstapperA  Task  that  runs  before  each  aeempted  build

Scheduler:  Specifies  when  build  aeempts  run

Modifica4onSetAllows  the  execu$on  of  builds  if  changes  are  detected

Ar4factsThe  file  to  download  when  the  build  succeeds

Thursday, December 17, 2009

Demo  

Cruisecontrol  overview

Thursday, December 17, 2009

Build  on  SVN  Commit

Use  SvnAnt  or  manually  exec  svn

In  CruiseControl

• Configure  a  SVN  modifica>on  set

• Call  svn  update  in  bootstrapper

Thursday, December 17, 2009

Demo  

Cruisecontrol  Install  +  svn  integra$on  

Thursday, December 17, 2009

Configuring  other  build  intervals

Op#ons:  Weekly,  Nightly,  Hourly  etc…

• In  config.xml

<project requireModification = false>

• Specify  

<schedule interval=“?”>

• Note:  You  must  have  a  modifica#on  set  tag  despite  not  requiring  modifica#on  

Thursday, December 17, 2009

Unit  Tes>ng

• FlexUnit– Flex  Unit  tes>ng  framework• Based  on  JUnit

• Use  Antennae  tes>ng  templates

What  Antennae  doesn’t  do:– No  support  for  FlexUnit4

Thursday, December 17, 2009

Demo  

Running  tests  with  Antennae

Thursday, December 17, 2009

Produc>on  deploy

• Copy  the  output  file  to  your  web  server

• Use  the  <copy>  or  <gp>  tasks

Thursday, December 17, 2009

Demo  

Produc$on  deploy

Thursday, December 17, 2009

Asdoc  genera>on

• Put  AsDoc  comments  in  code

• Add  the  Antennae  “asdoc”  target  to  your  build  script

• You  can  use  <artifactspublisher> to  make  docs  available  in  CruiseControl

Thursday, December 17, 2009

Demo  

AsDoc  genera$on

Thursday, December 17, 2009

Version  Tracking  in  Ant

• Use  the  <buildnumber>  task

• Set  your  applica>on  version  property

Thursday, December 17, 2009

Sekng  the  version  in  AIR

• Create  applica>on  descriptor  template  with  tokens

• Use  <replace>  tokens  with  fill  values

*You  can  hand  edit  build.num  file  if  its  out  of  sync  with  CruiseControl

Thursday, December 17, 2009

Demo  

Building  version  info  into  AIR  app

Thursday, December 17, 2009

Display  version  in  SWF

Only  slightly  different:

• Deploy  build.num  file  with  swf

• Load  its  contents  with  URLoader()  

Thursday, December 17, 2009

Auto-­‐upda>ng  AIR  apps  for  QA  

1. Deploy  your  build.num  to  a  server

2. Load  value  in  from  AIR

3. Use  AIR  update  manager  to  update  (if  outdated)

Note:  not  recommended  for  official  releases

Thursday, December 17, 2009

Gekng  no>fica>ons

• Email– People  don’t  like  this

• CCTray  (WIN)

• CCMenu  (OSX)

• AirBob  (Yup,  AIR  based)

Thursday, December 17, 2009

General  >ps

• Run  CC  in  a  console  for  tes>ng

• Test  your  ant  scripts  from  the  command  line  BEFORE  running  them  in  CruiseControl

Thursday, December 17, 2009

Shameless-­‐plug

“Flex  based  Workflow  tools  for  the  Flash  IDE”

Adobe  MAX

Tuesday  at  1:30  pm

511C

Be  there  or  be  somewhere  else!  (En#rely  up  to  you  really)

Thursday, December 17, 2009

@ianmclean

[email protected]

h_p://devote.your.life.auricom.comThursday, December 17, 2009