Jenkins构建成功,但它有错误

时间:2016-07-15 19:25:38

标签: php laravel jenkins phplint

我已经成立了Jenkins Job。它正如我编写的那样工作,除非它在Lint或PHP相关错误中有错误,它仍然成功完成。我不确定我在这里缺少什么。

的build.xml     

<target name="build"
    depends="build-common,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,phpcb" />

<target name="build-clean"
    depends="clean,build-common,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,phpcb" />

<target name="build-dox"
    depends="build-common,phpdox,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,phpcb" />

<target name="build-dox-clean"
    depends="clean,build-common,phpdox,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,phpcb" />

<target name="build-parallel"
    depends="build-common,tools-parallel" />

<target name="build-parallel-clean"
    depends="clean,build-common,tools-parallel" />

<target name="build-common" depends="lint,prepare,storage-permissions,composer,phpunit" />

<target name="tools-parallel" description="Run tools in parallel">
    <parallel threadCount="2">
        <sequential>
            <antcall target="pdepend" />
            <antcall target="phpcs-ci" />
            <antcall target="phpmd-ci" />
        </sequential>
        <antcall target="phpcb" />
        <antcall target="phpcpd" />
        <antcall target="phpdox" />
        <antcall target="phploc" />
    </parallel>
</target>

<target name="clean" depends="clean-build,clean-composer" description="Cleanup build and composer artifacts" />

<target name="clean-build" description="Cleanup build artifacts">
    <echo>Cleaning out the build artifacts</echo>
    <delete dir="${basedir}/build/api" />
    <delete dir="${basedir}/build/code-browser" />
    <delete dir="${basedir}/build/coverage" />
    <delete dir="${basedir}/build/logs" />
    <delete dir="${basedir}/build/pdepend" />
</target>

<target name="clean-composer" description="Cleanup composer artifacts">
    <echo>Cleaning out the composer artifacts</echo>
    <delete dir="${basedir}/vendor" />
    <delete file="${basedir}/composer.lock" />
</target>

<target name="composer" depends="composer-install,composer-update" description="Install or update dependencies" />

<!--// Check to see it the vendor folder already exist, if so, then no reason to run //-->
<target name="composer.check">
    <condition property="composer.exist">
        <available file="${basedir}/vendor" type="dir" />
    </condition>
</target>

<target name="composer-install" depends="composer.check" unless="composer.exist" description="Installing dependencies">
    <echo>Installing dependencies</echo>
    <exec executable="composer" failonerror="true">
        <arg value="install" />
    </exec>
</target>

<target name="composer-update" depends="composer.check" if="composer.exist" description="Updating dependencies">
    <echo>Updating dependencies</echo>
    <exec executable="composer" failonerror="true">
        <arg value="update" />
    </exec>
</target>

<target name="lint" description="Perform syntax check of sourcecode files">
    <apply executable="php" failonerror="false">
        <arg value="-l" />
        <fileset dir="${basedir}/app">
            <include name="**/*.php" />
            <modified />
        </fileset>
    </apply>
</target>

<target name="pdepend" description="Calculate software metrics using PHP_Depend">
    <exec executable="pdepend">
        <arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" />
        <arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" />
        <arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
        <arg path="${basedir}/app" />
    </exec>
</target>

<target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
    <exec executable="phpcb">
        <arg value="--log" />
        <arg path="${basedir}/build/logs" />
        <arg value="--source" />
        <arg path="${basedir}/app" />
        <arg value="--output" />
        <arg path="${basedir}/build/code-browser" />
    </exec>
</target>

 <target name="phpcpd" description="Find duplicate code using PHPCPD">
    <exec executable="phpcpd">
        <arg value="--log-pmd" />
        <arg value="${basedir}/build/logs/pmd-cpd.xml" />
        <arg path="${basedir}/app" />
    </exec>
</target>

<target name="phpcs"
     description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
    <exec executable="phpcs">
        <arg value="--standard=${basedir}/build/phpcs.xml" />
        <arg path="${basedir}/app" />
    </exec>
</target>

<target name="phpcs-ci" description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server">
    <exec executable="phpcs" output="/dev/null">
        <arg value="--report=checkstyle" />
        <arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
        <arg value="--standard=${basedir}/build/phpcs.xml" />
        <arg path="${basedir}/app" />
    </exec>
</target>

<target name="phpdox" description="Generate API documentation using phpDox">
    <exec executable="phpdox">
        <arg value="-f" />
        <arg value="${basedir}/build/phpdox.xml" />
    </exec>
</target>

<target name="phploc" description="Measure project size using PHPLOC">
    <exec executable="phploc">
       <arg value="--log-csv" />
       <arg value="${basedir}/build/logs/phploc.csv" />
       <arg path="${basedir}/app" />
    </exec>
</target>

 <target name="phpmd" description="Perform project mess detection using PHPMD and print human readable output. Intended for usage on the command line before committing.">
    <exec executable="phpmd">
        <arg path="${basedir}/app" />
        <arg value="text" />
        <arg value="${basedir}/build/phpmd.xml" />
    </exec>
</target>

<target name="phpmd-ci" description="Perform project mess detection using PHPMD creating a log file for the continuous integration server">
    <exec executable="phpmd">
        <arg path="${basedir}/app" />
        <arg value="xml" />
        <arg value="${basedir}/build/phpmd.xml" />
        <arg value="--reportfile" />
        <arg value="${basedir}/build/logs/pmd.xml" />
    </exec>
</target>

<target name="phpunit" description="Run unit tests with PHPUnit">
    <exec executable="phpunit" failonerror="true">
        <arg value="-c" />
        <arg value="${basedir}/phpunit.xml.dist" />
        <arg value="--coverage-html" />
        <arg value="${basedir}/build/coverage" />
    </exec>
</target>

<target name="storage-permissions" depends="storage-permissions.unix,storage-permissions.windows" description="Setting storage permissions" />

<target name="storage-permissions.unix" depends="storage.unix.check" if="storage.unix.exist" description="Setting storage permissions on unix">
    <echo>Setting app/storage to 777</echo>
    <chmod file="${basedir}/app/storage/**" perm="777" type="dir" failonerror="false" />
</target>

<target name="storage-permissions.windows" depends="storage.windows.check" if="storage.windows.exist" description="Setting storage permissions on windows">
    <echo>Setting app/storage to writable</echo>
    <attrib file="${basedir}/app/storage/**" perm="+R" failonerror="false" />
</target>

<!--// Check to see it the app/storage folder exist, if so, then can change permissions //-->
<target name="storage.unix.check" description="Check for app/storage on unix">
    <condition property="storage.unix.exist">
        <and>
            <available file="${basedir}/app/storage" type="dir" />
            <os family="unix" />
        </and>
    </condition>
</target>

<!--// Check to see it the app/storage folder exist, if so, then can change permissions //-->
<target name="storage.windows.check" description="Check for app/storage on windows">
    <condition property="storage.windows.exist">
        <and>
            <available file="${basedir}/app/storage" type="dir" />
            <os family="windows" />
        </and>
    </condition>
</target>

 <target name="prepare" depends="clean-build" description="Prepare for build">
    <echo>Making the build artifact folders</echo>
    <mkdir dir="${basedir}/build/api" />
    <mkdir dir="${basedir}/build/code-browser" />
    <mkdir dir="${basedir}/build/coverage" />
    <mkdir dir="${basedir}/build/logs" />
    <mkdir dir="${basedir}/build/pdepend" />
</target>

和控制台输出:(注意:如果你在Lint中看到:存在严重的语法错误,但构建成功)

 GitHub PR #<a href="https://github.com/yousafsyed/fyp_fuzzy_keyword/pull/7">7</a>, PR opened
Building in workspace /var/lib/jenkins/workspace/fypproject
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url git@github.com:yousafsyed/fyp_fuzzy_keyword.git # timeout=10
Fetching upstream changes from git@github.com:yousafsyed/fyp_fuzzy_keyword.git
 > git --version # timeout=10
using GIT_SSH to set credentials 
 > git -c core.askpass=true fetch --tags --progress git@github.com:yousafsyed/fyp_fuzzy_keyword.git +refs/pull/*:refs/remotes/origin/pr/*
Seen branch in repository origin/master
Seen branch in repository origin/pr/1/head
Seen branch in repository origin/pr/1/merge
Seen branch in repository origin/pr/2/head
Seen branch in repository origin/pr/2/merge
Seen branch in repository origin/pr/3/head
Seen branch in repository origin/pr/3/merge
Seen branch in repository origin/pr/4/head
Seen branch in repository origin/pr/4/merge
Seen branch in repository origin/pr/5/head
Seen branch in repository origin/pr/5/merge
Seen branch in repository origin/pr/6/head
Seen branch in repository origin/pr/7/head
Seen branch in repository origin/pr/7/merge
Seen branch in repository origin/test
Seen 15 remote branches
Checking out Revision c21af3b12115a29c826702a4acf08de24483f27d (origin/pr/7/merge)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f c21af3b12115a29c826702a4acf08de24483f27d
First time build. Skipping changelog.
[fypproject] $ ant build-clean
Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-7-openjdk-amd64/lib/tools.jar
Buildfile: /var/lib/jenkins/workspace/fypproject/build.xml

clean-build:
     [echo] Cleaning out the build artifacts
   [delete] Deleting directory /var/lib/jenkins/workspace/fypproject/build/api
   [delete] Deleting directory /var/lib/jenkins/workspace/fypproject/build/code-browser
   [delete] Deleting directory /var/lib/jenkins/workspace/fypproject/build/coverage
   [delete] Deleting directory /var/lib/jenkins/workspace/fypproject/build/logs
   [delete] Deleting directory /var/lib/jenkins/workspace/fypproject/build/pdepend

clean-composer:
     [echo] Cleaning out the composer artifacts
   [delete] Deleting directory /var/lib/jenkins/workspace/fypproject/vendor
   [delete] Deleting: /var/lib/jenkins/workspace/fypproject/composer.lock

clean:

lint:
    [apply] Errors parsing /var/lib/jenkins/workspace/fypproject/app/Libraries/FuzzyObject.php
    [apply] PHP Parse error:  syntax error, unexpected '}', expecting ',' or ';' in /var/lib/jenkins/workspace/fypproject/app/Libraries/FuzzyObject.php on line 15
    [apply] Result: 255

prepare:
     [echo] Making the build artifact folders
    [mkdir] Created dir: /var/lib/jenkins/workspace/fypproject/build/api
    [mkdir] Created dir: /var/lib/jenkins/workspace/fypproject/build/code-browser
    [mkdir] Created dir: /var/lib/jenkins/workspace/fypproject/build/coverage
    [mkdir] Created dir: /var/lib/jenkins/workspace/fypproject/build/logs
    [mkdir] Created dir: /var/lib/jenkins/workspace/fypproject/build/pdepend

storage.unix.check:

storage-permissions.unix:

storage.windows.check:

storage-permissions.windows:

storage-permissions:

composer.check:

composer-install:
     [echo] Installing dependencies
     [exec] You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
     [exec] Loading composer repositories with package information
     [exec] Updating dependencies (including require-dev)
     [exec]   - Installing symfony/polyfill-util (v1.2.0)
     [exec]     Loading from cache
     [exec]   - Installing jakub-onderka/php-console-color (0.1)
     [exec]     Loading from cache
     [exec] 
     [exec]   - Installing jakub-onderka/php-console-highlighter (v0.3.2)
     [exec]     Loading from cache
     [exec] 
     [exec]   - Installing dnoegel/php-xdg-base-dir (0.1)
     [exec]     Loading from cache
     [exec] 
     [exec]   - Installing paragonie/random_compat (v1.4.1)
     [exec]     Loading from cache
     [exec] 
     [exec]   - Installing nesbot/carbon (1.21.0)
     [exec]     Loading from cache
     [exec] 
     [exec]   - Installing mtdowling/cron-expression (v1.1.0)
     [exec]     Loading from cache
     [exec] 
     [exec]   - Installing monolog/monolog (1.20.0)
     [exec]     Loading from cache
     [exec] 
     [exec]   - Installing league/flysystem (1.0.24)
     [exec]     Loading from cache
     [exec] 
     [exec] 
     [exec]   - Installing mockery/mockery (0.9.5)
     [exec]     Loading from cache
     [exec] 
     [exec]   - Installing symfony/yaml (v3.1.2)
     [exec]     Loading from cache
     [exec] 
     [exec]   - Installing sebastian/version (1.0.6)
     [exec]     Loading from cache
     [exec] 
     [exec]   - Installing sebastian/global-state (1.1.1)
     [exec]     Loading from cache
     [exec] 
     [exec]   - Installing sebastian/recursion-context (1.0.2)
     [exec]     Loading from cache
     [exec] 
     [exec] symfony/var-dumper suggests installing ext-symfony_debug ()
     [exec] symfony/translation suggests installing symfony/config ()
     [exec] symfony/routing suggests installing doctrine/annotations (For using the annotation loader)
     [exec] symfony/routing suggests installing symfony/config (For using the all-in-one router or any loader)
     [exec] symfony/routing suggests installing symfony/dependency-injection (For loading routes from a service)
     [exec] symfony/routing suggests installing symfony/expression-language (For using expression matching)
     [exec] symfony/event-dispatcher suggests installing symfony/dependency-injection ()
     [exec] symfony/http-kernel suggests installing symfony/browser-kit ()
     [exec] symfony/http-kernel suggests installing symfony/class-loader ()
     [exec] symfony/http-kernel suggests installing symfony/config ()
     [exec] symfony/http-kernel suggests installing symfony/dependency-injection ()
     [exec] paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
     [exec] monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log messages to AWS services like DynamoDB)
     [exec] monolog/monolog suggests installing doctrine/couchdb (Allow sending log messages to a CouchDB server)
     [exec] monolog/monolog suggests installing ext-amqp (Allow sending log messages to an AMQP server (1.0+ required))
     [exec] monolog/monolog suggests installing ext-mongo (Allow sending log messages to a MongoDB server)
     [exec] monolog/monolog suggests installing graylog2/gelf-php (Allow sending log messages to a GrayLog2 server)
     [exec] monolog/monolog suggests installing mongodb/mongodb (Allow sending log messages to a MongoDB server via PHP Driver)
     [exec] monolog/monolog suggests installing php-amqplib/php-amqplib (Allow sending log messages to an AMQP server using php-amqplib)
     [exec] monolog/monolog suggests installing php-console/php-console (Allow sending log messages to Google Chrome)
     [exec] monolog/monolog suggests installing rollbar/rollbar (Allow sending log messages to Rollbar)
     [exec] monolog/monolog suggests installing ruflin/elastica (Allow sending log messages to an Elastic Search server)
     [exec] monolog/monolog suggests installing sentry/sentry (Allow sending log messages to a Sentry server)
     [exec] league/flysystem suggests installing league/flysystem-aws-s3-v2 (Allows you to use S3 storage with AWS SDK v2)
     [exec] league/flysystem suggests installing league/flysystem-aws-s3-v3 (Allows you to use S3 storage with AWS SDK v3)
     [exec] league/flysystem suggests installing league/flysystem-azure (Allows you to use Windows Azure Blob storage)
     [exec] league/flysystem suggests installing league/flysystem-cached-adapter (Flysystem adapter decorator for metadata caching)
     [exec] league/flysystem suggests installing league/flysystem-copy (Allows you to use Copy.com storage)
     [exec] league/flysystem suggests installing league/flysystem-dropbox (Allows you to use Dropbox storage)
     [exec] league/flysystem suggests installing league/flysystem-eventable-filesystem (Allows you to use EventableFilesystem)
     [exec] league/flysystem suggests installing league/flysystem-rackspace (Allows you to use Rackspace Cloud Files)
     [exec] league/flysystem suggests installing league/flysystem-sftp (Allows you to use SFTP server storage via phpseclib)
     [exec] league/flysystem suggests installing league/flysystem-webdav (Allows you to use WebDAV storage)
     [exec] league/flysystem suggests installing league/flysystem-ziparchive (Allows you to use ZipArchive adapter)
     [exec] psy/psysh suggests installing ext-pdo-sqlite (The doc command requires SQLite to work.)
     [exec] laravel/framework suggests installing aws/aws-sdk-php (Required to use the SQS queue driver and SES mail driver (~3.0).)
     [exec] laravel/framework suggests installing doctrine/dbal (Required to rename columns and drop SQLite columns (~2.4).)
     [exec] laravel/framework suggests installing guzzlehttp/guzzle (Required to use the Mailgun and Mandrill mail drivers and the ping methods on schedules (~5.3|~6.0).)
     [exec] laravel/framework suggests installing league/flysystem-aws-s3-v3 (Required to use the Flysystem S3 driver (~1.0).)
     [exec] laravel/framework suggests installing league/flysystem-rackspace (Required to use the Flysystem Rackspace driver (~1.0).)
     [exec] laravel/framework suggests installing pda/pheanstalk (Required to use the beanstalk queue driver (~3.0).)
     [exec] laravel/framework suggests installing predis/predis (Required to use the redis cache and queue drivers (~1.0).)
     [exec] laravel/framework suggests installing pusher/pusher-php-server (Required to use the Pusher broadcast driver (~2.0).)
     [exec] laravel/framework suggests installing symfony/psr-http-message-bridge (Required to psr7 bridging features (0.2.*).)
     [exec] sebastian/global-state suggests installing ext-uopz (*)
     [exec] phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
     [exec] Writing lock file
     [exec] Generating autoload files
     [exec] > Illuminate\Foundation\ComposerScripts::postUpdate
     [exec] > php artisan optimize
     [exec] Generating optimized class loader
     [exec] Compiling common classes

composer-update:

composer:

phpunit:
     [exec] PHPUnit 4.8.26 by Sebastian Bergmann and contributors.
     [exec] 
     [exec] 
     [exec] 
     [exec] Time: 165 ms, Memory: 12.75MB
     [exec] 
     [exec] No tests executed!
     [exec] 
     [exec] Generating code coverage report in Clover XML format ... done
     [exec] 
     [exec] Generating code coverage report in HTML format ... done

build-common:

phploc:
     [exec] phploc 3.0.1 by Sebastian Bergmann.
     [exec] 
     [exec] Directories                                         13
     [exec] Files                                               30
     [exec] 
     [exec] Size
     [exec]   Lines of Code (LOC)                             1484
     [exec]   Comment Lines of Code (CLOC)                     446 (30.05%)
     [exec]   Non-Comment Lines of Code (NCLOC)               1038 (69.95%)
     [exec]   Logical Lines of Code (LLOC)                     375 (25.27%)
     [exec]     Classes                                        257 (68.53%)
     [exec]       Average Class Length                           8
     [exec]         Minimum Class Length                         0
     [exec]         Maximum Class Length                        98
     [exec]       Average Method Length                          3
     [exec]         Minimum Method Length                        0
     [exec]         Maximum Method Length                       13
     [exec]     Functions                                       10 (2.67%)
     [exec]       Average Function Length                        1
     [exec]     Not in classes or functions                    108 (28.80%)
     [exec] 
     [exec] Cyclomatic Complexity
     [exec]   Average Complexity per LLOC                     0.13
     [exec]   Average Complexity per Class                    2.66
     [exec]     Minimum Class Complexity                      1.00
     [exec]     Maximum Class Complexity                     22.00
     [exec]   Average Complexity per Method                   1.76
     [exec]     Minimum Method Complexity                     1.00
     [exec]     Maximum Method Complexity                     5.00
     [exec] 
     [exec] Dependencies
     [exec]   Global Accesses                                    0
     [exec]     Global Constants                                 0 (0.00%)
     [exec]     Global Variables                                 0 (0.00%)
     [exec]     Super-Global Variables                           0 (0.00%)
     [exec]   Attribute Accesses                               100
     [exec]     Non-Static                                     100 (100.00%)
     [exec]     Static                                           0 (0.00%)
     [exec]   Method Calls                                     155
     [exec]     Non-Static                                     109 (70.32%)
     [exec]     Static                                          46 (29.68%)
     [exec] 
     [exec] Structure
     [exec]   Namespaces                                        14
     [exec]   Interfaces                                         0
     [exec]   Traits                                             0
     [exec]   Classes                                           29
     [exec]     Abstract Classes                                 3 (10.34%)
     [exec]     Concrete Classes                                26 (89.66%)
     [exec]   Methods                                           59
     [exec]     Scope
     [exec]       Non-Static Methods                            58 (98.31%)
     [exec]       Static Methods                                 1 (1.69%)
     [exec]     Visibility
     [exec]       Public Methods                                55 (93.22%)
     [exec]       Non-Public Methods                             4 (6.78%)
     [exec]   Functions                                          9
     [exec]     Named Functions                                  0 (0.00%)
     [exec]     Anonymous Functions                              9 (100.00%)
     [exec]   Constants                                          0
     [exec]     Global Constants                                 0 (0.00%)
     [exec]     Class Constants                                  0 (0.00%)

pdepend:
     [exec] PHP_Depend 1.1.4 by Manuel Pichler
     [exec] 
     [exec] Parsing source files:
     [exec] ..............................                                  30
     [exec] 
     [exec] Executing Coupling-Analyzer:
     [exec] .......                                                        154
     [exec] 
     [exec] Executing CyclomaticComplexity-Analyzer:
     [exec] .......                                                        154
     [exec] 
     [exec] Executing Dependency-Analyzer:
     [exec] ....                                                            95
     [exec] 
     [exec] Executing Inheritance-Analyzer:
     [exec] .                                                               40
     [exec] 
     [exec] Executing NodeCount-Analyzer:
     [exec] ....                                                            95
     [exec] 
     [exec] Executing NodeLoc-Analyzer:
     [exec] ......                                                         121
     [exec] 
     [exec] Generating pdepend log files, this may take a moment.
     [exec] 
     [exec] The following errors occured:
     [exec] Unexpected token: class, line: 20, col: 33, file: /var/lib/jenkins/workspace/fypproject/app/Exceptions/Handler.php.
     [exec] Unexpected token: class, line: 17, col: 73, file: /var/lib/jenkins/workspace/fypproject/app/Http/Kernel.php.
     [exec] Unexpected token: }, line: 15, col: 1, file: /var/lib/jenkins/workspace/fypproject/app/Libraries/FuzzyObject.php.
     [exec] Unexpected token: class, line: 35, col: 62, file: /var/lib/jenkins/workspace/fypproject/app/Providers/FuzzySearchServiceProvider.php.
     [exec] 
     [exec] 
     [exec] Time: 00:00; Memory: 12.25Mb

phpmd-ci:
     [exec] Result: 2

phpcs-ci:

phpcpd:
     [exec] phpcpd 2.0.4 by Sebastian Bergmann.
     [exec] 
     [exec] 0.00% duplicated lines out of 1484 total lines of code.
     [exec] 
     [exec] Time: 51 ms, Memory: 4.00Mb

phpcb:

build-clean:

BUILD SUCCESSFUL
Total time: 31 seconds
Finished: SUCCESS

0 个答案:

没有答案