-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.xml
177 lines (154 loc) · 6.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<?xml version="1.0" encoding="UTF-8"?>
<project name="Case Converter" description="Case Converter class" default="help" phingVersion="3">
<defaultexcludes default="true"/><!--Initializing default excludes-->
<defaultexcludes add="**/.idea"/>
<defaultexcludes add="**/.idea/**"/>
<target name="help">
<visualizer format="svg"/>
<open path="build.svg"/>
</target>
<target name="setup" description="Install dependencies" depends="composer:install, cc:get"/>
<target name="qa" description="Run quality tests"
depends="php:lint, composer:validate, phpunit:run, behat:run, phpstan:analyse, psalm:run"/>
<target name="docs:refresh-images" description="Update and regenerate docs images"
depends="phing:visualize, plantuml:puml-to-png"/>
<target name="composer:validate" description="Check composer.json syntax">
<composer command="validate">
<arg value="--strict"/>
<arg value="--no-check-lock"/>
</composer>
</target>
<target name="composer:install">
<composer command="install">
<arg value="--no-interaction"/>
<arg value="--profile"/>
<arg value="--ansi"/>
<arg value="--prefer-dist"/>
</composer>
</target>
<target name="phpunit:open-coverage" description="Open coverage site" depends="phpunit:run">
<exec executable="xdg-open">
<arg file="resources/coverage-html/index.html"/>
</exec>
</target>
<target name="php:lint" description="Check syntax on PHP files">
<phplint haltonfailure="true">
<fileset dir="${project.basedir}">
<include name="**/*.php"/>
<exclude name="vendor/"/>
</fileset>
</phplint>
</target>
<target name="behat:run" description="Run behat tests">
<exec executable="vendor/bin/behat" passthru="true" checkreturn="true">
<arg value="--colors"/>
<arg value="--no-interaction"/>
<arg value="--stop-on-failure"/>
<arg value="--rerun"/>
<arg value="--strict"/>
</exec>
</target>
<target name="phpunit:run" description="Run unit tests">
<mkdir dir="resources/coverage-html/"/>
<exec executable="vendor/bin/phpunit" passthru="true" checkreturn="true">
<env key="XDEBUG_MODE" value="coverage"/>
<arg line="--configuration=config/phpunit.xml"/>
<arg value="--testdox"/>
</exec>
</target>
<target name="changelog:links" description="Update links in composer.json">
<composer command="require">
<arg value="symplify/changelog-linker:^v6"/>
</composer>
<exec executable="vendor/bin/changelog-linker">
<arg value="link"/>
</exec>
<composer command="remove">
<arg value="symplify/changelog-linker"/>
</composer>
</target>
<target name="cc:get" description="Download Code Climate">
<property name="cc.dir" value="bin"/>
<property name="cc.filename" value="cc-test-reporter"/>
<if>
<not>
<available file="${cc.dir}/${cc.filename}"/>
</not>
<then>
<mkdir dir="${cc.dir}"/>
<httpget dir="${cc.dir}" filename="${cc.filename}" followRedirects="true"
url="https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64"/>
</then>
</if>
<chmod file="${cc.dir}/${cc.filename}" mode="0775"/>
<exec executable="${cc.dir}/${cc.filename}" passthru="true" checkreturn="true">
<arg value="--version"/>
</exec>
</target>
<target name="cc:before-build" description="To run before a build">
<fail unless="env.CC_TEST_REPORTER_ID" message="you must supply a CC_TEST_REPORTER_ID ENV variable"/>
<exec executable="bin/cc-test-reporter" passthru="true" checkreturn="true">
<arg value="before-build"/>
</exec>
</target>
<target name="cc:after-build" description="Handle & upload coverage payload">
<fail unless="env.CC_TEST_REPORTER_ID" message="you must supply a CC_TEST_REPORTER_ID ENV variable"/>
<exec executable="bin/cc-test-reporter" passthru="true" checkreturn="true">
<arg value="after-build"/>
<arg line="--coverage-input-type clover"/>
</exec>
</target>
<target name="plantuml:puml-to-png" description="Parse PlantUML files to image from docs dir">
<composer command="require">
<arg value="jawira/plantuml"/>
</composer>
<exec executable="vendor/bin/plantuml" passthru="true" checkreturn="true">
<arg value="-checkmetadata"/>
<arg path="docs/**.puml"/>
</exec>
<composer command="remove">
<arg value="jawira/plantuml"/>
</composer>
</target>
<target name="git:tags-listing" description="List all git tags">
<!-- https://stackoverflow.com/a/34239190/4345061 -->
<exec executable="git" passthru="true">
<arg value="log"/>
<arg line="--graph --all --decorate --oneline --simplify-by-decoration"/>
</exec>
</target>
<target name="phing:visualize" description="Update build.png">
<visualizer format="puml" destination="docs/images"/>
</target>
<target name="docs:serve" description="Generate and open static site" depends="docs:build">
<parallel threadCount="2">
<exec executable="mkdocs" passthru="true" checkreturn="true">
<arg value="serve"/>
</exec>
<exec executable="xdg-open" passthru="true" checkreturn="true">
<!--Please F5 after some seconds-->
<arg value="http://127.0.0.1:8000/"/>
</exec>
</parallel>
</target>
<target name="docs:build" description="Builds static site" depends="docs:refresh-images">
<exec executable="mkdocs" passthru="true" checkreturn="true">
<arg value="build"/>
</exec>
</target>
<target name="psalm:run" description="Check code with Psalm">
<exec executable="vendor/bin/psalm" checkreturn="true" passthru="true">
<arg line="--no-cache --long-progress"/>
</exec>
</target>
<target name="phpstan:analyse" description="Analyse at max level">
<exec executable="vendor/bin/phpstan" passthru="true" checkreturn="true">
<arg value="analyse"/>
<arg line="--level=max"/>
<arg value="--no-progress"/>
<arg value="--no-interaction"/>
<arg value="--ansi"/>
<arg path="src"/>
</exec>
</target>
</project>