Created
February 12, 2013 11:57
-
-
Save vdubyna/4761841 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project name="Build lasenza application" default="default"> | |
<property file="build.properties" /> | |
<property name="application.dir" value="${project.basedir}/.." /> | |
<property name="build.dir" value="${project.basedir}/build" /> | |
<target name="default"> | |
<input propertyName="input.db.user" message="Input DB user" defaultValue="root" /> | |
<input propertyName="input.db.host" message="Input DB host" defaultValue="localhost" /> | |
<input propertyName="input.db.name" message="Input DB name" /> | |
<input propertyName="input.db.password" message="Input DB password" /> | |
<input propertyName="input.hostname" message="Input local hostname for installation" defaultValue="http://localhost.dev/" /> | |
<copy file="${project.basedir}/templates/build.properties.dist" tofile="${project.basedir}/build.properties"> | |
<filterchain> | |
<replacetokens begintoken="###" endtoken="###"> | |
<token key="install.mysql.user" value="${input.db.user}" /> | |
<token key="install.mysql.host" value="${input.db.host}" /> | |
<token key="install.mysql.db" value="${input.db.name}" /> | |
<token key="install.mysql.password" value="${input.db.password}" /> | |
<token key="install.host" value="${input.hostname}" /> | |
</replacetokens> | |
</filterchain> | |
</copy> | |
</target> | |
<target name="build-install" depends="prepare-install, install" /> | |
<target name="prepare-install"> | |
<echo message="Delete local.xml" /> | |
<delete file="${application.dir}/app/etc/local.xml" /> | |
<echo message="Drop db" /> | |
<exec executable="/usr/local/bin/mysql" checkreturn="true" passthru="true"> | |
<arg line=" -h${install.mysql.host} -u${install.mysql.user} --password='${install.mysql.password}' -e'DROP DATABASE IF EXISTS ${install.mysql.db};'" /> | |
</exec> | |
<echo message="Create db" /> | |
<exec executable="/usr/local/bin/mysql" checkreturn="true" passthru="true"> | |
<arg line=" -h${install.mysql.host} -u${install.mysql.user} --password='${install.mysql.password}' -e'CREATE DATABASE ${install.mysql.db};'" /> | |
</exec> | |
</target> | |
<target name="install"> | |
<echo message="Start install" /> | |
<exec executable="php" checkreturn="true" passthru="true"> | |
<arg line=" -f ${application.dir}/install.php -- --license_agreement_accepted yes" /> | |
<arg line=" --locale en_US --timezone ${install.timezone} --default_currency USD " /> | |
<arg line=" --db_host ${install.mysql.host} --db_name ${install.mysql.db} " /> | |
<arg line=" --db_user ${install.mysql.user} --db_pass ${install.mysql.password} " /> | |
<arg line=" --url '${install.host}' --use_rewrites yes --skip_url_validation yes " /> | |
<arg line=" --use_secure no --use_secure_admin no --secure_base_url '${install.host}' " /> | |
<arg line=" --admin_lastname Owner --admin_firstname Store " /> | |
<arg line=" --admin_email ${install.admin.email} --admin_username ${install.admin.login} " /> | |
<arg line=" --admin_password ${install.admin.password}" /> | |
</exec> | |
<echo message="Installation finished" /> | |
</target> | |
<target name="build-on-stage" description="You have to pass feature name as param of cli ex: -Dfeature=feature/myfeature"> | |
<tstamp /> | |
<property name="build.number" value="${DSTAMP}${TSTAMP}" /> | |
<echo message="Check/create feature directory" /> | |
<copy file="${project.basedir}/templates/build.sh.dist" tofile="${build.dir}/${build.number}_build.sh"> | |
<filterchain> | |
<replacetokens begintoken="###" endtoken="###"> | |
<token key="build.feature.name" value="${build.number}" /> | |
</replacetokens> | |
</filterchain> | |
</copy> | |
<scp username="vdubyna" password="11111" | |
host="123.123.123.123" file="${build.dir}/${build.number}_build.sh" | |
todir="./Tmp/builds" /> | |
<ssh username="vovikha" password="11111" | |
host="123.123.123.123" command="chmod +x ./Tmp/builds/${build.number}_build.sh; ./Tmp/builds/${build.number}_build.sh" /> | |
<echo message="prepare local.xml" /> | |
<copy file="${project.basedir}/templates/local.xml.dist" tofile="${build.dir}/local.xml"> | |
<filterchain> | |
<replacetokens begintoken="###" endtoken="###"> | |
<token key="install.mysql.db" value="lasenza_${build.number}" /> | |
</replacetokens> | |
</filterchain> | |
</copy> | |
<scp username="vdubyna" password="11111" | |
host="123.123.123.123" file="${build.dir}/local.xml" | |
todir="./Tmp/builds/${build.number}/app/etc" /> | |
<echo message="prepare pom.xml for sonar" /> | |
<copy file="${project.basedir}/templates/pom.xml.dist" tofile="${build.dir}/pom.xml"> | |
<filterchain> | |
<replacetokens begintoken="###" endtoken="###"> | |
<token key="build.feature.name" value="${build.number}" /> | |
<token key="application.dir" value="${application.dir}" /> | |
</replacetokens> | |
</filterchain> | |
</copy> | |
<echo message="Prepare env for unit tests" /> | |
<copy file="${project.basedir}/templates/local.xml.phpunit.dist" tofile="${application.dir}/app/etc/local.xml.phpunit"> | |
<filterchain> | |
<replacetokens begintoken="###" endtoken="###"> | |
<token key="install.mysql.db" value="lasenza_${build.number}_phpunit" /> | |
<token key="build.hostname" value="http://mage.dev/${build.number}/" /> | |
</replacetokens> | |
</filterchain> | |
</copy> | |
<scp username="vdubyna" password="11111" | |
host="123.123.123.123" file="${application.dir}/app/etc/local.xml.phpunit" | |
todir="./Tmp/builds/${build.number}/app/etc" /> | |
<delete dir="${build.dir}/phpunit/" /> | |
<mkdir dir="${build.dir}/phpunit/" description="Make sure that artifacts directory exists" /> | |
<ssh username="vdubyna" password="11111" | |
host="123.123.123.123" command="/usr/local/pear/bin/phpunit --log-junit ./Tmp/builds/${build.number}/dev/build/phpunit/phpunit.xml ./Tmp/builds/${build.number}/UnitTests.php" /> | |
<scp username="vdubyna" password="11111" | |
host="123.123.123.123" fetch="true" file="./Tmp/builds/${build.number}/dev/build/phpunit/phpunit.xml" | |
todir="${build.dir}/phpunit" /> | |
<echo message="##teamcity[importData type='junit' path='${build.dir}/phpunit/phpunit.xml' whenNoDataPublished='error']" description="Import test status to TeamCity" /> | |
<!--<echo message="##teamcity[publishArtifacts '${build.dir}/phpunit.log']" description="Import phpunit log to TeamCity" />--> | |
<echo message="http://lasenza-dev.lcgosc.com/${build.number}" /> | |
</target> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment