DokuWiki

It's better when it's simple

User Tools

Site Tools


Sidebar

Translations of this page?:

Learn about DokuWiki

Advanced Use

Corporate Use

Our Community


Follow us on Facebook, Twitter and other social networks.

tips:build_report

Build reports

Here's a script to use a wiki page for an automated build report. In this example, git-svn is used as revision control system. The script is intended to run as a cron-job.

#!/bin/bash
 
LOCKFILE=/tmp/compile.lock
 
# don't do anything if we are compiling
if [ -f $LOCKFILE ]
then
  exit 0
fi
 
WIKITEXT=/tmp/compile_failure.txt
LASTREVTXT=/tmp/last_compile.txt
LASTRESULTTXT=/tmp/last_result.txt
 
cd /var/scm/your_project
 
# get current and last revision
SVNREV=`git svn log --oneline --limit=1 | sed 's/r\([0-9]*\).*/\1/'`
 
# make sure it exists
if [ ! -f $LASTREVTXT ]
then
  echo "0" >$LASTREVTXT
fi
 
LASTREV=`cat $LASTREVTXT`
 
# exit if we already compiled this revision
if [ $SVNREV -eq $LASTREV ]
then
  exit 0
fi
 
echo $SVNREV >$LASTREVTXT
 
touch $LOCKFILE
 
# make clean
make clean >/dev/null
 
# build project
make 2>errout.txt
 
RESULT=$?
 
rm $LOCKFILE
 
GCC_VERSION=`gcc --version | head -n1`
OS_VERSION=`uname -s -m`
 
# wiki page header
echo "====== Current compile issues ======" >$WIKITEXT
echo >>$WIKITEXT
echo "Compiling with **$GCC_VERSION** on **$OS_VERSION**.">>$WIKITEXT
echo >>$WIKITEXT
echo "Revision **#$SVNREV**, compilation from `date`." >>$WIKITEXT
echo >>$WIKITEXT
 
# wiki page content
if [ $RESULT -ne 0 ]
then
  RESULTMSG=FAILURE
  echo "<file>" >>$WIKITEXT
  cat /var/scm/your_project/errout.txt >>$WIKITEXT
  echo "</file>" >>$WIKITEXT
else
  RESULTMSG=SUCCESS
  echo "//There are currently no issues.//" >>$WIKITEXT
fi
 
# make sure the result file exists
if [ ! -f $LASTRESULTTXT ]
then
  echo "0" >$LASTRESULTTXT
fi
 
LASTRESULT=`cat $LASTRESULTTXT`
echo $RESULTMSG > $LASTRESULTTXT
 
# figure out if this result is different from the last one
if [ "$LASTRESULT" == "$RESULTMSG" ]
then
  MINOR=-t
else
  MINOR=
fi
 
# commit to wiki
sudo -u apache php /path_to_your_dokuwiki_installation/bin/dwpage.php $MINOR -m "Updated for revision #$SVNREV, result: $RESULTMSG" commit $WIKITEXT build_report

Example output

Build success

Compiling with gcc (Gentoo 4.4.3 p1.0) 4.4.3 on Linux x86_64.

Revision #7726, compilation from Tue Apr 6 12:50:03 CEST 2010.

There are currently no issues.

Build failure

Compiling with gcc (Gentoo 4.4.3 p1.0) 4.4.3 on Linux x86_64.

Revision #7701, compilation from Sun Apr 4 17:03:14 CEST 2010.

src/softlist.c: In function 'bool load_software_part(running_device*, const char*, software_info**, software_part**, char**)':
src/softlist.c:978: error: 'load_software_part_region' was not declared in this scope
make: *** [obj/sdl/softlist.o] Error 1
tips/build_report.txt · Last modified: 2010-04-06 13:05 by duke