首頁 後端開發 php教程 基于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>
登入後複製

@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>
登入後複製

@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>
登入後複製

@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>
登入後複製


本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

在PHP API中說明JSON Web令牌(JWT)及其用例。 在PHP API中說明JSON Web令牌(JWT)及其用例。 Apr 05, 2025 am 12:04 AM

JWT是一種基於JSON的開放標準,用於在各方之間安全地傳輸信息,主要用於身份驗證和信息交換。 1.JWT由Header、Payload和Signature三部分組成。 2.JWT的工作原理包括生成JWT、驗證JWT和解析Payload三個步驟。 3.在PHP中使用JWT進行身份驗證時,可以生成和驗證JWT,並在高級用法中包含用戶角色和權限信息。 4.常見錯誤包括簽名驗證失敗、令牌過期和Payload過大,調試技巧包括使用調試工具和日誌記錄。 5.性能優化和最佳實踐包括使用合適的簽名算法、合理設置有效期、

會話如何劫持工作,如何在PHP中減輕它? 會話如何劫持工作,如何在PHP中減輕它? Apr 06, 2025 am 12:02 AM

會話劫持可以通過以下步驟實現:1.獲取會話ID,2.使用會話ID,3.保持會話活躍。在PHP中防範會話劫持的方法包括:1.使用session_regenerate_id()函數重新生成會話ID,2.通過數據庫存儲會話數據,3.確保所有會話數據通過HTTPS傳輸。

描述紮實的原則及其如何應用於PHP的開發。 描述紮實的原則及其如何應用於PHP的開發。 Apr 03, 2025 am 12:04 AM

SOLID原則在PHP開發中的應用包括:1.單一職責原則(SRP):每個類只負責一個功能。 2.開閉原則(OCP):通過擴展而非修改實現變化。 3.里氏替換原則(LSP):子類可替換基類而不影響程序正確性。 4.接口隔離原則(ISP):使用細粒度接口避免依賴不使用的方法。 5.依賴倒置原則(DIP):高低層次模塊都依賴於抽象,通過依賴注入實現。

在PHPStorm中如何進行CLI模式的調試? 在PHPStorm中如何進行CLI模式的調試? Apr 01, 2025 pm 02:57 PM

在PHPStorm中如何進行CLI模式的調試?在使用PHPStorm進行開發時,有時我們需要在命令行界面(CLI)模式下調試PHP�...

PHP 8.1中的枚舉(枚舉)是什麼? PHP 8.1中的枚舉(枚舉)是什麼? Apr 03, 2025 am 12:05 AM

PHP8.1中的枚舉功能通過定義命名常量增強了代碼的清晰度和類型安全性。 1)枚舉可以是整數、字符串或對象,提高了代碼可讀性和類型安全性。 2)枚舉基於類,支持面向對象特性,如遍歷和反射。 3)枚舉可用於比較和賦值,確保類型安全。 4)枚舉支持添加方法,實現複雜邏輯。 5)嚴格類型檢查和錯誤處理可避免常見錯誤。 6)枚舉減少魔法值,提升可維護性,但需注意性能優化。

如何在系統重啟後自動設置unixsocket的權限? 如何在系統重啟後自動設置unixsocket的權限? Mar 31, 2025 pm 11:54 PM

如何在系統重啟後自動設置unixsocket的權限每次系統重啟後,我們都需要執行以下命令來修改unixsocket的權限:sudo...

解釋PHP中的晚期靜態綁定(靜態::)。 解釋PHP中的晚期靜態綁定(靜態::)。 Apr 03, 2025 am 12:04 AM

靜態綁定(static::)在PHP中實現晚期靜態綁定(LSB),允許在靜態上下文中引用調用類而非定義類。 1)解析過程在運行時進行,2)在繼承關係中向上查找調用類,3)可能帶來性能開銷。

See all articles