-
Notifications
You must be signed in to change notification settings - Fork 43
/
build.xml
74 lines (70 loc) · 5.32 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
<project name="OLOY" basedir="." default="none">
<property name="workspace" value="${basedir}" />
<property name="sourcedir" value="${basedir}/src" />
<target name="none">
<echo>By default I do nothing! Add -l to see all available tasks</echo>
</target>
<target name="ci-setup-test" description="Setup everything and test (for CI)" depends="generate-jwt-keys">
<exec command="bin/console oloy:user:projections:index:create --drop-old -n" checkreturn="true" passthru="true"/>
<exec command="bin/console doctrine:schema:update --env=test -n --force" checkreturn="true" passthru="true"/>
<exec command="bin/console broadway:event-store:schema:drop -n" checkreturn="true" passthru="true"/>
<exec command="bin/console broadway:event-store:schema:init -n" checkreturn="true" passthru="true"/>
<exec command="bin/console doctrine:fixtures:load --env=test -n" checkreturn="true" passthru="true"/>
<exec command="bin/console oloy:segment:recreate -vv" checkreturn="true" passthru="true"/>
<exec command="bin/console security:check" checkreturn="true" passthru="true"/>
<exec command="bin/console doctrine:schema:validate --env=test --skip-sync" checkreturn="true" passthru="true"/>
<exec command="vendor/phpunit/phpunit/phpunit" checkreturn="true" passthru="true"/>
<exec command="bin/php-cs-fixer fix --dry-run --diff src" checkreturn="true" passthru="true"/>
</target>
<target name="setup" description="Setup everything" depends="generate-jwt-keys">
<exec command="bin/console oloy:user:projections:index:create --drop-old -n" checkreturn="true" passthru="true"/>
<exec command="bin/console doctrine:schema:update --force" checkreturn="true" passthru="true"/>
<exec command="bin/console broadway:event-store:schema:drop -n" checkreturn="true" passthru="true"/>
<exec command="bin/console broadway:event-store:schema:init -n" checkreturn="true" passthru="true"/>
<exec command="bin/console doctrine:fixtures:load -n -vvv" checkreturn="true" passthru="true"/>
<exec command="bin/console oloy:segment:recreate -vv" checkreturn="true" passthru="true"/>
</target>
<target name="test" description="Setup everything and run tests">
<exec command="bin/console oloy:user:projections:index:create --drop-old -n --env=test" checkreturn="true" passthru="true"/>
<exec command="bin/console broadway:event-store:schema:drop -n --env=test" checkreturn="true" passthru="true"/>
<exec command="bin/console broadway:event-store:schema:init -n --env=test" checkreturn="true" passthru="true"/>
<exec command="bin/console doctrine:fixtures:load -n --env=test" checkreturn="true" passthru="true"/>
<exec command="vendor/phpunit/phpunit/phpunit" checkreturn="true" passthru="true"/>
</target>
<target name="test-security" description="Setup everything and run tests">
<exec command="bin/console oloy:user:projections:index:create --drop-old -n --env=test" checkreturn="true" passthru="true"/>
<exec command="bin/console broadway:event-store:schema:drop -n --env=test" checkreturn="true" passthru="true"/>
<exec command="bin/console broadway:event-store:schema:init -n --env=test" checkreturn="true" passthru="true"/>
<exec command="bin/console doctrine:fixtures:load -n --env=test" checkreturn="true" passthru="true"/>
<exec command="vendor/phpunit/phpunit/phpunit --stop-on-failure --testsuite Security" checkreturn="true" passthru="true"/>
</target>
<target name="test-domain" description="Setup everything and run tests">
<exec command="vendor/phpunit/phpunit/phpunit --stop-on-failure --testsuite Domain" checkreturn="true" passthru="true"/>
</target>
<target name="demo" description="Setup for demo purposes" depends="generate-jwt-keys">
<exec command="bin/console oloy:user:projections:index:create --drop-old -n" checkreturn="true" passthru="true"/>
<exec command="bin/console doctrine:schema:update --force" checkreturn="true" passthru="true"/>
<exec command="bin/console broadway:event-store:schema:drop -n" checkreturn="true" passthru="true"/>
<exec command="bin/console broadway:event-store:schema:init -n" checkreturn="true" passthru="true"/>
<exec command="bin/console doctrine:fixtures:load --fixtures src/OpenLoyalty/Bundle/DemoBundle/_DataFixtures/ORM/ -n" checkreturn="true" passthru="true"/>
<exec command="bin/console oloy:segment:recreate -vv" checkreturn="true" passthru="true"/>
</target>
<target name="generate-jwt-keys" description="Generate new JWT keys if needed">
<if>
<not>
<or>
<available file="app/var/jwt/private.pem" type="file"/>
<available file="app/var/jwt/public.pem" type="file"/>
</or>
</not>
<then>
<mkdir dir="app/var/jwt"/>
<exec command="openssl genrsa -out app/var/jwt/private.pem 4096" checkreturn="true" passthru="true"/>
<exec command="openssl rsa -pubout -in app/var/jwt/private.pem -out app/var/jwt/public.pem" checkreturn="true" passthru="true"/>
</then>
<else>
<echo>JWT tokens already exist in app/var/jwt/!</echo>
</else>
</if>
</target>
</project>