Skip to content

Commit

Permalink
Merge pull request #633 from mcneely/build_tools
Browse files Browse the repository at this point in the history
Added build scripts to composer.json.
  • Loading branch information
mcneely authored Feb 17, 2019
2 parents e87b9a6 + 886f095 commit 01a7487
Show file tree
Hide file tree
Showing 5 changed files with 604 additions and 41 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ matrix:
before_script:
- composer install
- cp src/config.php.dist src/config.php
- git remote set-branches --add origin master
- git fetch
script:
- ./build.sh
- composer check
19 changes: 0 additions & 19 deletions build.sh

This file was deleted.

34 changes: 13 additions & 21 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
<property name="apiv2source" value="src" />
<property name="basedir" value="."/>

<target name="initialize" description="Do Some initial setup.">
<exec command="wget https://raw.githubusercontent.com/composer/getcomposer.org/cb19f2aa3aeaa2006c0cd69a7ef011eb31463067/web/installer -O - -q | php -- --quiet" logoutput="true" checkreturn="true" />
<exec command="sudo mv composer.phar /usr/bin/composer"/>
<exec command="composer install"/>
</target>


<target name="clean" description="Clean up and create artifact directories">
<delete dir="${basedir}/build/api"/>
<delete dir="${basedir}/build/coverage"/>
Expand All @@ -18,12 +25,12 @@
</target>

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

<target name="buildTasks" description="Run the phpmd, phpcs, phploc and lint tasks.">
<phingcall target="phpcs"/>
<phingcall target="phplint"/>
<phingcall target="lint"/>
</target>

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

<target name="phpcs" description="Generate checkstyle.xml using PHP_CodeSniffer">
<phpcodesniffer standard="tools/codesniffer/JoindInPSR2/" verbosity="0" haltonerror="true" haltonwarning="true">
<fileset dir="${apiv2source}">
<patternset>
<include name="**/*.php"/>
<exclude name="**/config.php" />
<exclude name="**/database.php" />
</patternset>
</fileset>
<formatter type="checkstyle" outfile="${basedir}/build/logs/checkstyle.xml" />
</phpcodesniffer>
<exec command="composer sniff"/>
</target>

<target name="phpcs-human-summary" description="Generate human-readable Codesniffer output">
Expand Down Expand Up @@ -77,17 +75,11 @@
</phpcodesniffer>
</target>

<target name="phplint" description="Run php -l over the fileset">
<phplint haltonfailure="true">
<fileset dir="${apiv2source}">
<patternset>
<include name="**/*.php"/>
</patternset>
</fileset>
</phplint>
<target name="lint" description="Run linter over the fileset">
<exec command="composer lint" logoutput="true" checkreturn="true" />
</target>

<target name="build" depends="clean,buildTasks,phpunit"/>
<target name="build" depends="initialize,clean,buildTasks,phpunit"/>

<target name="launch">
<exec command="scripts/jenkinslaunch.sh" checkreturn="true" logoutput="true" />
Expand Down
19 changes: 19 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,25 @@
"tests/models",
"tests/routers",
"tests/views"
],
"files": ["tests/compatibility/File.php"]
},
"scripts": {
"test": "phpunit -c . tests/",
"lint": "parallel-lint --exclude vendor .",
"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 .",
"security": "security-checker security:check composer.lock",
"coverage": [
"git diff origin/master... -- > diff.txt",
"diffFilter --phpunit diff.txt build/logs/clover.xml 80"
],
"check": [
"mkdir -p build/logs",
"@lint",
"@sniff",
"@security",
"@test",
"@coverage"
]
},
"config" : {
Expand Down
Loading

0 comments on commit 01a7487

Please sign in to comment.