-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.xml
104 lines (87 loc) · 4.08 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?xml version="1.0" encoding="UTF-8"?>
<project name="happyrecruiting" default="deploy-no-pull">
<!-- Use this when you want to test the current code -->
<target name="test" depends="prepare,composer,phpunit"/>
<!-- This target should be used when you what to update a currently running version of the website -->
<target name="deploy" depends="git-pull,bump-version,deploy-no-pull"/>
<!-- This makes a deploy but does not pull the git -->
<target name="deploy-no-pull" depends="prepare,composer,update-assets,clear-cache"/>
<!-- update the assets -->
<target name="update-assets" depends="bower,npm,assetic"/>
<!-- Prepare for build -->
<target name="prepare" depends="create-folders,purge-cache"/>
<!-- Remove the logs and cache folders -->
<target name="clean" description="Cleanup remains from old build">
<delete dir="${basedir}/app/var/build/logs"/>
</target>
<!-- Create new logs and cache folders -->
<target name="create-folders" depends="clean" description="Prepare for build, create some folders">
<mkdir dir="${basedir}/app/var/build/logs"/>
<mkdir dir="${basedir}/app/cache"/>
<mkdir dir="${basedir}/app/logs"/>
<mkdir dir="${basedir}/app/var/sessions"/>
<mkdir dir="${basedir}/web/js"/>
</target>
<target name="phpunit" description="Run unit tests with PHPUnit">
<exec executable="phpunit" failonerror="true">
<arg line="-c ${basedir}/app/phpunit.xml.dist ${basedir}/src"/>
</exec>
</target>
<!-- The composer does also clear the cache -->
<target name="composer" description="Install all the vendors">
<exec executable="composer" failonerror="true">
<arg value="install"/>
<!--<arg value="-o"/> This is an error with hhvm-->
<arg value="--working-dir"/>
<arg path="${basedir}"/>
</exec>
</target>
<target name="assetic" description="Dump the assetics">
<exec executable="php" dir="${basedir}" failonerror="true">
<arg line="app/console assetic:dump --env=prod --no-debug"/>
</exec>
</target>
<target name="git-pull" description="Update to the latest source in the current branch">
<exec executable="git" dir="${basedir}" failonerror="true">
<arg line="reset --hard HEAD"/>
</exec>
<exec executable="git" dir="${basedir}" failonerror="true">
<arg line="pull"/>
</exec>
</target>
<target name="purge-cache" description="Removes cache with force">
<delete includeEmptyDirs="true">
<fileset dir="${basedir}/app/cache" includes="**/*"/>
</delete>
</target>
<target name="clear-cache" depends="clear-sessions" description="Clear all the caches">
<exec executable="php" dir="${basedir}" failonerror="true">
<arg line="app/console cache:clear --no-warmup --env=prod --no-debug"/>
</exec>
<exec executable="php" dir="${basedir}" failonerror="true">
<arg line="app/console cache:clear --no-warmup --env=dev --no-debug"/>
</exec>
</target>
<!-- remove sessions that are more than 14 days old -->
<target name="clear-sessions" description="Clear old sessions">
<exec executable="find" dir="${basedir}" failonerror="false">
<arg value="app/var/sessions"/>
<arg line="-name 'sess_*' -mtime +14 -exec rm {} ';'"/>
</exec>
</target>
<target name="bower" description="Update the bower dependencies">
<exec executable="bower" dir="${basedir}" failonerror="true">
<arg line="install"/>
</exec>
</target>
<target name="npm" description="Update the npm dependencies">
<exec executable="npm" dir="${basedir}" failonerror="true">
<arg line="install"/>
</exec>
</target>
<target name="bump-version" description="Update the git version in the configs">
<exec executable="sh" dir="${basedir}" failonerror="true">
<arg value="app/var/scripts/updateVersion.sh" />
</exec>
</target>
</project>