Home Backend Development PHP Tutorial 基于window下的jenkins php集成环境搭建分享(2)

基于window下的jenkins php集成环境搭建分享(2)

Jun 20, 2016 pm 12:39 PM

 @build.xml (ant构建配置文件) 

<?xml version="1.0" encoding="UTF-8"?><project name="name-of-project" default="build">    <!-- By default, we assume all tools to be on the $PATH -->    <property name="toolsdir" value=""/>    <!--改成您相应的应用目录和测试目录-->    <property name="testdir" value="${basedir}/Test"/>    <property name="appdir" value="${basedir}/PHPCbping"/>    <available file="${basedir}/build" property="build_path"/>    <available file="${basedir}/App/TestControllers1" property="TestControllers1_exist"/>    <!--<property name="version-m"  value="1.1" />-->    <!--<property name="version"    value="1.1.0" />-->    <!--<property name="stability"  value="stable" />-->    <!--<property name="releasenotes" value="" />-->    <!--<property name="tarfile"     value="${phing.project.name}.${buildnumber}.${buildid}.tar.gz" />-->    <!--<property name="pkgfile"     value="${phing.project.name}.${version}.tgz" />-->    <!--<property name="distfile"    value="dist/${tarfile}" />-->    <!--<property name="tests.dir" value="test" />-->    <!-- -->    <!--<fileset id="api.tar.gz" dir=".">-->        <!--<include name="test/**"/>-->        <!--<include name="*.php"/>-->        <!--<include name="*.xml"/>-->    <!--</fileset>-->    <!--<target name="check" description="Check variables" >-->        <!--<fail unless="version" message="Version not defined!" />-->        <!--<fail unless="buildnumber" message="buildnumber not defined!" />-->        <!--<fail unless="buildid" message="buildid not defined!" />-->        <!--<delete dir="dist" failonerror="false" />-->        <!--<mkdir dir="dist" />-->    <!--</target>-->    <!--<target name="tar" depends="check" description="Create tar file for release">-->        <!--<echo msg="Creating distribution tar for ${phing.project.name} ${version}"/>-->        <!--<delete file="${distfile}" failonerror="false"/>-->        <!--<tar destfile="${distfile}" compression="gzip">-->            <!--<fileset refid="api.tar.gz"/>-->        <!--</tar>-->    <!--</target>-->    <!-- Uncomment the following when the tools are in ${basedir}/vendor/bin -->    <!-- <property name="toolsdir" value="${basedir}/vendor/bin/"/> -->    <target name="build"            depends="prepare,lint,phploc-ci,pdepend,phpmd-ci,phpcpd-ci,phpunit,phpdox"            description=""/>    <target name="build-parallel"            depends="prepare,lint,tools-parallel,phpunit,phpdox"            description=""/>    <target name="tools-parallel" description="Run tools in parallel">        <parallel threadCount="2">            <sequential>                <antcall target="pdepend"/>                <antcall target="phpmd-ci"/>            </sequential>            <antcall target="phpcpd-ci"/>            <!--<antcall target="phpcs-ci"/>-->            <antcall target="phploc-ci"/>        </parallel>    </target>    <target name="clean"            unless="clean.done"            if="build_path"            description="Cleanup build artifacts">        <delete includeEmptyDirs="true">            <fileset dir="build" includes="**/*"/>        </delete>        <property name="clean.done" value="true"/>    </target>    <target name="prepare"            unless="prepare.done"            depends="clean,phpunit-init-clean"            description="Prepare for build">        <chmod dir="build" perm="0777"/>        <mkdir dir="${basedir}/build/api"/>        <mkdir dir="${basedir}/build/coverage"/>        <mkdir dir="${basedir}/build/logs"/>        <mkdir dir="${basedir}/build/pdepend"/>        <mkdir dir="${basedir}/build/phpdox"/>        <property name="prepare.done" value="true"/>    </target>    <target name="phpunit-init-clean" if="TestControllers1_exist" depends="clean">        <move todir="${testdir}/TestControllers1" failonerror="">            <fileset dir="${basedir}/App/TestControllers1"/>        </move>    </target>    <target name="lint"            unless="lint.done"            description="Perform syntax check of sourcecode files">        <apply executable="php" failonerror="true" taskname="lint">            <arg value="-l"/>            <fileset dir="${appdir}">                <include name="**/*.php"/>                <modified/>            </fileset>            <fileset dir="${testdir}">                <include name="**/*.php"/>                <modified/>            </fileset>        </apply>        <property name="lint.done" value="true"/>    </target>    <target name="phploc"            unless="phploc.done"            description="Measure project size using PHPLOC and print human readable output. Intended for usage on the command line.">        <exec executable="${toolsdir}phploc.bat" taskname="phploc">            <arg value="--count-tests"/>            <arg path="${appdir}"/>            <!--<arg path="${testdir}"/>-->        </exec>        <property name="phploc.done" value="true"/>    </target>    <target name="phploc-ci"            unless="phploc.done"            depends="prepare"            description="Measure project size using PHPLOC and log result in CSV and XML format. Intended for usage within a continuous integration environment.">        <exec executable="${toolsdir}phploc.bat" taskname="phploc">            <arg value="--count-tests"/>            <arg value="--log-csv"/>            <arg path="${basedir}/build/logs/phploc.csv"/>            <arg value="--log-xml"/>            <arg path="${basedir}/build/logs/phploc.xml"/>            <arg path="${appdir}"/>            <!--<arg path="${testdir}"/>-->        </exec>        <property name="phploc.done" value="true"/>    </target>    <target name="pdepend"            unless="pdepend.done"            depends="prepare"            description="Calculate software metrics using PHP_Depend and log result in XML format. Intended for usage within a continuous integration environment.">        <exec executable="${toolsdir}pdepend.bat" taskname="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="${appdir}"/>        </exec>        <property name="pdepend.done" value="true"/>    </target>    <target name="phpmd"            unless="phpmd.done"            description="Perform project mess detection using PHPMD and print human readable output. Intended for usage on the command line before committing.">        <exec executable="${toolsdir}phpmd.bat" taskname="phpmd">            <arg path="${appdir}"/>            <arg value="text"/>            <arg path="${basedir}/phpmd.xml"/>        </exec>        <property name="phpmd.done" value="true"/>    </target>    <target name="phpmd-ci"            unless="phpmd.done"            depends="prepare"            description="Perform project mess detection using PHPMD and log result in XML format. Intended for usage within a continuous integration environment.">        <exec executable="${toolsdir}phpmd.bat" taskname="phpmd">            <arg path="${appdir}"/>            <arg value="xml"/>            <arg path="${basedir}/phpmd.xml"/>            <arg value="--reportfile"/>            <arg path="${basedir}/build/logs/pmd.xml"/>        </exec>        <property name="phpmd.done" value="true"/>    </target>    <target name="phpcpd"            unless="phpcpd.done"            description="Find duplicate code using PHPCPD and print human readable output. Intended for usage on the command line before committing.">        <exec executable="${toolsdir}phpcpd.bat" taskname="phpcpd">            <arg path="${appdir}"/>        </exec>        <property name="phpcpd.done" value="true"/>    </target>    <target name="phpcpd-ci"            unless="phpcpd.done"            depends="prepare"            description="Find duplicate code using PHPCPD and log result in XML format. Intended for usage within a continuous integration environment.">        <exec executable="${toolsdir}phpcpd.bat" taskname="phpcpd">            <arg value="--log-pmd"/>            <arg path="${basedir}/build/logs/pmd-cpd.xml"/>            <arg path="${appdir}"/>        </exec>        <property name="phpcpd.done" value="true"/>    </target>    <target name="phpunit"            unless="phpunit.done"            depends="prepare"            description="Run unit tests with PHPUnit">        <exec executable="${toolsdir}phpunit.bat" failonerror="true" taskname="phpunit">            <arg value="--configuration"/>            <arg path="${basedir}/phpunit.xml.dist"/>            <arg value="--include-path"/>            <arg path="${appdir}"/>        </exec>        <property name="phpunit.done" value="true"/>    </target>    <target name="phpdox"            unless="phpdox.done"            depends="phploc-ci"            description="Generate project documentation using phpDox">        <exec executable="${toolsdir}phpdox.bat" dir="${basedir}" taskname="phpdox"/>        <property name="phpdox.done" value="true"/>    </target></project>
Copy after login

@phpunit.xm.dist(相关信息可以查看官方文档)

<?xml version="1.0" encoding="UTF-8"?><phpunit        colors="true"        stopOnFailure="false"        backupStaticAttributes="false"        convertErrorsToExceptions="true"        convertNoticesToExceptions="true"        convertWarningsToExceptions="true"        processIsolation="false"        addUncoveredFilesFromWhitelist="true"        syntaxCheck="false"        cacheTokens="true"        verbose="false"        >    <php>        <includePath>PHPCbping/</includePath>    </php>    <testsuites>        <testsuite name="TEST">            <directory>Test/</directory>            <!--<file phpVersion="5.3.0" phpVersionOperator=">=">Test/CommandTest.php</file>-->            <exclude>PHPCbping/</exclude>        </testsuite>    </testsuites>    <filter>        <whitelist processUncoveredFilesFromWhitelist="true">            <directory suffix=".php">PHPCbping/</directory>        </whitelist>    </filter>    <logging>        <log type="coverage-clover" target="build/logs/clover.xml"/>        <log type="coverage-html" target="build/coverage"/>        <log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/>    </logging></phpunit>
Copy after login

@phpmd.xml(相关规则信息可以查看官方文档)

<?xml version="1.0" encoding="UTF-8"?><ruleset name="phpcbping-coding-standard"         xmlns="http://pmd.sf.net/ruleset/1.0.0"         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"         xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0                      http://pmd.sf.net/ruleset_xml_schema.xsd"         xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">    <description>Description of your coding standard</description>    <rule ref="rulesets/codesize.xml"/>    <rule ref="rulesets/cleancode.xml"/>    <rule ref="rulesets/unusedcode.xml"/>    <rule ref="rulesets/design.xml"/>    <rule ref="rulesets/naming.xml"/>    <rule ref="rulesets/controversial.xml/Superglobals"/>    <!-- ... --></ruleset>
Copy after login

@phpdox.xml(相关规则信息可以查看官方文档)

<?xml version="1.0" encoding="UTF-8"?><phpdox xmlns="http://xml.phpdox.net/config">    <project name="phpdox-project" source="${basedir}/PHPCbping" workdir="${basedir}/build/api/xml">        <collector publiconly="false" backend="parser">            <include mask="*.php"/>        </collector>        <generator output="${basedir}/build/api">            <enrich base="${basedir}/build/logs">                <source type="build"/>                <source type="pmd"/>                <source type="phploc"/>            </enrich>            <build engine="html" enabled="true" output="html">                <file extension="html"/>            </build>        </generator>    </project></phpdox>
Copy after login


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

Describe the SOLID principles and how they apply to PHP development. Describe the SOLID principles and how they apply to PHP development. Apr 03, 2025 am 12:04 AM

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

How to automatically set permissions of unixsocket after system restart? How to automatically set permissions of unixsocket after system restart? Mar 31, 2025 pm 11:54 PM

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

How to debug CLI mode in PHPStorm? How to debug CLI mode in PHPStorm? Apr 01, 2025 pm 02:57 PM

How to debug CLI mode in PHPStorm? When developing with PHPStorm, sometimes we need to debug PHP in command line interface (CLI) mode...

Explain the concept of late static binding in PHP. Explain the concept of late static binding in PHP. Mar 21, 2025 pm 01:33 PM

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

How to send a POST request containing JSON data using PHP's cURL library? How to send a POST request containing JSON data using PHP's cURL library? Apr 01, 2025 pm 03:12 PM

Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...

Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

See all articles