Skip to content

Commit 01a7487

Browse files
authored
Merge pull request #633 from mcneely/build_tools
Added build scripts to composer.json.
2 parents e87b9a6 + 886f095 commit 01a7487

File tree

5 files changed

+604
-41
lines changed

5 files changed

+604
-41
lines changed

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,7 @@ matrix:
1212
before_script:
1313
- composer install
1414
- cp src/config.php.dist src/config.php
15+
- git remote set-branches --add origin master
16+
- git fetch
1517
script:
16-
- ./build.sh
18+
- composer check

build.sh

Lines changed: 0 additions & 19 deletions
This file was deleted.

build.xml

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
<property name="apiv2source" value="src" />
55
<property name="basedir" value="."/>
66

7+
<target name="initialize" description="Do Some initial setup.">
8+
<exec command="wget https://raw.githubusercontent.com/composer/getcomposer.org/cb19f2aa3aeaa2006c0cd69a7ef011eb31463067/web/installer -O - -q | php -- --quiet" logoutput="true" checkreturn="true" />
9+
<exec command="sudo mv composer.phar /usr/bin/composer"/>
10+
<exec command="composer install"/>
11+
</target>
12+
13+
714
<target name="clean" description="Clean up and create artifact directories">
815
<delete dir="${basedir}/build/api"/>
916
<delete dir="${basedir}/build/coverage"/>
@@ -18,12 +25,12 @@
1825
</target>
1926

2027
<target name="phpunit" description="Run unit tests using PHPUnit and generates junit.xml and clover.xml">
21-
<exec command="phpunit -c tests/phpunit.xml" logoutput="true" checkreturn="true" />
28+
<exec command="composer test" logoutput="true" checkreturn="true" />
2229
</target>
2330

2431
<target name="buildTasks" description="Run the phpmd, phpcs, phploc and lint tasks.">
2532
<phingcall target="phpcs"/>
26-
<phingcall target="phplint"/>
33+
<phingcall target="lint"/>
2734
</target>
2835

2936
<target name="frisby" description="Run API tests in Frisby">
@@ -39,16 +46,7 @@
3946
</target>
4047

4148
<target name="phpcs" description="Generate checkstyle.xml using PHP_CodeSniffer">
42-
<phpcodesniffer standard="tools/codesniffer/JoindInPSR2/" verbosity="0" haltonerror="true" haltonwarning="true">
43-
<fileset dir="${apiv2source}">
44-
<patternset>
45-
<include name="**/*.php"/>
46-
<exclude name="**/config.php" />
47-
<exclude name="**/database.php" />
48-
</patternset>
49-
</fileset>
50-
<formatter type="checkstyle" outfile="${basedir}/build/logs/checkstyle.xml" />
51-
</phpcodesniffer>
49+
<exec command="composer sniff"/>
5250
</target>
5351

5452
<target name="phpcs-human-summary" description="Generate human-readable Codesniffer output">
@@ -77,17 +75,11 @@
7775
</phpcodesniffer>
7876
</target>
7977

80-
<target name="phplint" description="Run php -l over the fileset">
81-
<phplint haltonfailure="true">
82-
<fileset dir="${apiv2source}">
83-
<patternset>
84-
<include name="**/*.php"/>
85-
</patternset>
86-
</fileset>
87-
</phplint>
78+
<target name="lint" description="Run linter over the fileset">
79+
<exec command="composer lint" logoutput="true" checkreturn="true" />
8880
</target>
8981

90-
<target name="build" depends="clean,buildTasks,phpunit"/>
82+
<target name="build" depends="initialize,clean,buildTasks,phpunit"/>
9183

9284
<target name="launch">
9385
<exec command="scripts/jenkinslaunch.sh" checkreturn="true" logoutput="true" />

composer.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,25 @@
4949
"tests/models",
5050
"tests/routers",
5151
"tests/views"
52+
],
53+
"files": ["tests/compatibility/File.php"]
54+
},
55+
"scripts": {
56+
"test": "phpunit -c . tests/",
57+
"lint": "parallel-lint --exclude vendor .",
58+
"sniff": "phpcs --standard=tools/codesniffer/JoindInPSR2/ruleset.xml --ignore=**/config.php,**/database.php,vendor,tools,tests/bootstrap.php --extensions=php --report-checkstyle=build/logs/checkstyle.xml --runtime-set ignore_warnings_on_exit true -p .",
59+
"security": "security-checker security:check composer.lock",
60+
"coverage": [
61+
"git diff origin/master... -- > diff.txt",
62+
"diffFilter --phpunit diff.txt build/logs/clover.xml 80"
63+
],
64+
"check": [
65+
"mkdir -p build/logs",
66+
"@lint",
67+
"@sniff",
68+
"@security",
69+
"@test",
70+
"@coverage"
5271
]
5372
},
5473
"config" : {

0 commit comments

Comments
 (0)