I've been asked to automate the build and test process for my team at office.we work on Linux and use Perforce for SCM. I've just joined this company and dont have much knowledge on unix scripts. Could someone tell me how to go about doing this?:confused:
You can post the steps that you need to carry out there...,then we got lot of helping hands who would help us. (list what you would be doing manually to accomplish your tasks.)
Beleive me, i really learn many things from there posts; they really deserve a *million* thanks!!
You can use makefiles, ant scripts or shell scripts for your build process. You haven't told us about the source files. Are they c/c++, java or something else ?
If they are java source files, then you are better off with ant scripts. The same ant script can be in used in Windows and Linux. If the source files are c/c++, then makefiles are the best. But the makefiles would differ for Windows and Linux.
Shell scripts work well on Linux. But to make them work on Windows you would need the MKS Toolkit or Cygwin.
For automating your test process, I believe you would have some existing test cases. If it is a testsuite, then you can use a framework similiar to JUnit. If they are unit test cases, then shell scripts or makefiles would be good.
For all these 3 requirements, there had been numerous number of posts discussing the same in different context
for ex:
1 build at a time -> process control. check for previous instance before instantiating a new instance
log file -> log file naming and redirecting output / debug / error messages to log file
email notifications -> sending email using mail / mailx. Sending file as inline attachment. Sending attachment with body
Please use the search facility, am sure you would find many such threads.
Use a cron job. Search the forum with the key words 'cron job'
You need to take care of this before you consider the cron jobs. The trigger for the build should be a simple script/makefile with the option of Release/Debug builds. This script/makefile may recursively go into each sub-directory and call other makefiles/scripts. Consider it like this.
Are you concerned that the cron job and the manual build will overlap ? If so, when the build starts, create an empty file to indicate that the build has started. When the build fails/end remove that file. Check for the presence of that file to decide whether to start the build or not.
Redirect all output to some log file. You need to take care of this in your parent makefile/script.
Once all the build is done, collect reports of build success/failure and attach it to the mail and send it to the concerned people. Search the forum with the keywords 'email notification'.