Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

From the joel test:

Can you make a build in one step?

I've got to say I can't. I'm currently working on a web app that has a spreadsheet list of items that must be carried out in order to deploy. So my question is how can I automate this? Does it have to be organisation wide? Tips/techniques?

share|improve this question
3  
It depends what the items in the list are? Ideally, yes you should be able to automate it. –  rmx Jan 13 '11 at 12:29
4  
en.wikipedia.org/wiki/Build_automation BTW: Some stay one step is one too much :) –  Mchl Jan 13 '11 at 12:30
    
All sorts - move files over, script out stored procedures etc - there are 14 steps! –  billy.bob Jan 13 '11 at 12:31
2  
From a differrent angle, what on the list do you feel you can't automate? –  Tyanna Jan 13 '11 at 12:42
1  
The question of how to automate a build isn't subjective, and should be asked on Stack Overflow. The question should also have more information on the tasks needed, to get a useful answer. –  David Thornley Jan 13 '11 at 14:58

6 Answers 6

up vote 9 down vote accepted

Make can automate the build process into one step. Make can do pretty much what ever you want. I am not sure why sapporo thinks that Make only applies to C/C++. You can use make to run any type of command. It is not even tied to programing though that is what it is typically used for.

share|improve this answer
2  
make is one of those "swiss army knife" kind of tools; love working with it. Something else to point out where make would be useful is that if you are automating your build/process/etc, and one or more steps depend on another completing successfully, make will stop if that step fails, not allowing those other steps to proceed and possibly cause problems. –  Will Jan 13 '11 at 14:09
1  
Since many 'nix apps/systems are installed with './configure; make; make install' I think make also doubles up as an installation engine. If it can do that, I'm also sure it can solve the OP's quandry. –  JBRWilkinson Jan 13 '11 at 17:52
    
Make, but the syntax is pretty obscure. To date I've encountered 2 alternatives: SCons (much easier than Make + makedepend) and a tool to automate the creation of the Makefile (proprietary). –  Matthieu M. Jan 13 '11 at 18:08
    
@JbRWilkinson...like I said make can do pretty much whatever you want ;) –  Pemdas Jan 13 '11 at 18:15

Depending on your environment, you may want to look at Make (C/C++), Ant/Maven (Java), Gradle (Groovy) - that's the ones I'm familiar with. Chances are high there's a popular solution for your environment.

share|improve this answer
    
Its an ASP.NET / SQL environment –  billy.bob Jan 13 '11 at 12:35
    
@m.edmondson - then cruisecontrol.sourceforge.net is probably your way to go –  bobah Jan 13 '11 at 12:45
    
Another good continuous integration environment for ASP.NET is TeamCity. I've used by CruiseControl and TeamCity and I found TeamCity to be a bit easier to use and a bit more powerful. But that might no longer be the case. –  RationalGeek Jan 13 '11 at 13:07
    
NANT is the .NET ANT variant which we've used well as a complement to Cruise Control which I wouldn't use to build code for deployment where you tend to want a few additional things included / tweaked / parameters set and changed and so on. That's what ANT/NANT are good at. –  Jon Hopkins Jan 13 '11 at 17:22
    
I second @Jon Hopkinds suggestion - nant is a great match for your environment. –  JBRWilkinson Jan 13 '11 at 17:53

At work, we use FinalBuilder, which makes it easy to set up a script to automate the entire process: check out code, build everything, run tests, create deployment package, etc.

It's a very good tool, and it recently won the Dr. Dobbs Jolt Award for Change and Configuration Management tools.

share|improve this answer

Sure there is a way to automate this. With tools like Chef, setting up a brand new freshly-installed server can be as easy as:

knife bootstrap ip.address -N aNameForTheServer -r "role[some functionality]"

In my case some steps executed by that single command are:

  • Install required libraries, programs and Python modules
  • Create new users with specified access privaleges
  • Create new databases, load required schema, set ownership and access rights
  • Download and stage project code and then write out configuration info
  • Bring everything into production mode by launching database servers, setting up cron jobs, etc.

I'm not sure how Chef will perform in your environment as Windows support is listed as "preliminary", but for UNIX-based system it's the bee's knees.

Puppet is a similar system that is a little older than chef and may offer better Windows support.

share|improve this answer

It's straightforward with Maven in the Java world

mvn clean deploy

In our configuration, this does all the necessary building of the WAR file (pulling in the JAR dependencies as needed), the deployment to the dev web server and creation of canned test data on the dev database. Once that's in place Maven handles the comprehensive functional testing through SeleniumRC to verify the application works.

This single command gets the application fully deployed to the dev server cluster so it's readily available for other developers to immediately work with (assuming it passed the tests). It's unusual for a dev deployment to fail since developers have verified it works locally with mvn clean install.

The snapshot artifact (WAR) is then copied into the Maven repository for sharing with other developers (as per the standard Maven deploy behaviour).

OK, but you've only deployed a snapshot to dev, what about test and production?

The distribution to the test and (later) production servers is handled through the Maven release process which we like to handle manually to ensure that someone is watching for any suspicious output. Testers only work with released artifacts, not snapshots.

Once it's released then a simple build script is used to SFTP the WAR file to the test server cluster, again with someone watching the process to ensure nothing goes wrong.

Finally, after all the testers are happy the unchanged WAR file is SFTP'd up to the failover production server cluster, with someone keeping a close eye and an immediate rollback position in place in case of disaster.

share|improve this answer

I figured I could check that one off our Joel test so...

I made a build server in python automated it using pychron.

The code was synced with VSS from the command line, build with borland make (most IDEs'll create make files for you whether or not they call them that. Delphi used to pump out make files and call them .BPG files, now they're MSBuild XML files and you can use MSBuild) and the errors were put in an XML file which I just kept adding to.

So.. Just write a batch file and do these things.

  1. Synchronize Code from Source Control
  2. Delete dumb stuff (individual config files for projects) that you know will stop you from being able to build everything.
  3. Build everything (I'd build everything, make all brother).
  4. Log your errors and warning and stuff, but don't stop building. (If you're really smart you'll extract the name of the last person to check in the file that caused the build to break and send him a nastygram)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.