fei / phing-service
Flash phing 服务
Requires
- pear/versioncontrol_git: ^0.5
- phing/phing: 2.*
- dev-master
- v4.4.1
- v4.4.0
- v4.3.2
- v4.3.1
- v4.3.0
- v4.2.0
- v4.1.6
- v4.1.5
- v4.1.4
- v4.1.3
- v4.1.2
- v4.1.1
- v4.1.0
- v4.0.2
- v4.0.1
- v4.0.0
- v3.0.0
- v2.0.6
- v2.0.5
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.2.2
- v1.2.1
- v1.1.0
- v1.0.10
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-add_xml_support
- dev-fix/adapt_target_to_token_with_special_chars
This package is not auto-updated.
Last update: 2024-09-20 20:41:44 UTC
README
Phing Service,用于设置系统的构建脚本
开发者环境安装
在composer中简单要求 fei/phing-service
环境配置信息
所有项目都可以使用此服务来简化其自身的构建
文档
安装
需要 fei/phing-service
composer require fei/phing-service
注意:在标签 2.* 之后
Phing 配置
构建配置
添加 phing.xml 脚本
<project name="[PROJECT-NAME]" default="help" basedir="."> <import file="${project.basedir}/vendor/fei/phing-service/setup-system.xml"/> <target name="setup-system" description="Execute Deployment, Create DB" depends="setup-system-build"/> <target name="local-setup-system" description="Execute Local Deployment" depends="local-setup-system-build"/> </project>
注意:可以在此 build.xml 中添加目标以处理项目异常
在根目录下创建 settings_local.ini 脚本
config.path=[CONFIG PATH] qaPatern=[CONTAINER PHP NAME] qaUrlPatern=[QA URL] qaDatabase=[CONTAINER DB NAME] qaBeanstalk=[CONTAINER BEANSTALK NAME] (if needed)
注意:在标签 3.* 之后,必须使用 ${project.basedir} 前缀 [CONFIG PATH]
覆盖 settings_local.ini
:对于本地使用,可以覆盖默认的本地设置。为此,只需创建名为 settings_local.override.ini
的文件,该文件将
- 重新定义属性
- 定义新属性
此文件必须被忽略。
使用以下模式完成此脚本,用您的属性替换
[NAME OF CONFIG FILE].[YOUR OWN KEY]
准备配置文件
- 将配置文件 .php 重命名为 .php.dist
- 将所有环境变量替换为 @[配置文件名称].[您的自己的密钥]@
在之前
<?php return [ new EntityManager('branding', [ 'entities.locations' => ['app/features/Branding/src/Entity'], 'driver' => 'pdo_mysql', 'host' => 'branding_db', 'port' => 3306, 'user' => 'branding', 'password' => 'branding', 'dbname' => 'branding', 'charset' => 'UTF8', 'mapping_types' => [] ]) ];
在之后
<?php return [ new EntityManager('branding', [ 'entities.locations' => ['app/features/Branding/src/Entity'], 'driver' => '@doctrine.driver@', 'host' => '@doctrine.host@', 'port' => 3306, 'user' => '@doctrine.user@', 'password' => '@doctrine.password@', 'dbname' => '@doctrine.dbname@', 'charset' => 'UTF8', 'mapping_types' => [] ]) ];
- 将 tests/.suite.yml 重命名为 tests/.suite.yml.dist(除非是 unit.suite.yml)
- 将所有环境变量替换为 [您的自己的密钥](不带 @)
在之前
actor: ApiTester
modules:
enabled:
- \Helper\Api
- REST:
url: http://[containerPHPName]
depends: PhpBrowser
- Filesystem
- Db
config:
Db:
dsn: 'mysql:host=[containerDBName];dbname=branding'
user: 'root'
password: ''
cleanup: true
reconnect: true
populator: "vendor/bin/phing 'create-database'"
populate: true
gherkin:
contexts:
default:
- WebGuy
- ApiTester
coverage:
enabled: false
在之后
actor: ApiTester
modules:
enabled:
- \Helper\Api
- REST:
url: http://qaPattern
depends: PhpBrowser
- Filesystem
- Db
config:
Db:
dsn: 'mysql:host=qaDatabase;dbname=branding'
user: 'root'
password: ''
cleanup: true
reconnect: true
populator: "vendor/bin/phing -f phing.xml -propertyfile settings_local.ini 'create-database'"
populate: true
gherkin:
contexts:
default:
- WebGuy
- ApiTester
coverage:
enabled: false
访问和覆盖率
在公共路径上添加 .htaccess 脚本
RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [L] RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ RewriteRule ^(.*) - [E=BASE:%1] RewriteRule ^(.*)$ %{ENV:BASE}/index.php [L]
将 c3.php 包含到 public/index.php 中
<?php if (file_exists(__DIR__ . '/../c3.php')) { include __DIR__ . '/../c3.php'; }
注意:您还必须创建验收路径
本地运行
为了准备您的环境,您必须运行以下命令
vendor/bin/phing -f phing.xml local-setup-system
为了准备您的验收测试环境,您必须运行以下命令
vendor/bin/phing -f phing.xml load-properties setup-acceptance
Continuousphp 配置
在构建设置管道中填写
DocumentRoot => /public Phing -> 构建文件 => phing.xml
在测试设置中填写在 Codeception 中
环境变量
- CONTINUOUSPHP => continuousphp
- CPHP_SERVICE_APACHE => 2.4.0
- APP_ENV => dev
- CPHP_SERVICE_SELENIUM => 3.4.0-chromium
Phing 目标
- local-setup-system
- setup-acceptance
- create-database(如果为验收测试)
- setup-coverage
覆盖验收变量
- qaPattern => apache24
- qaDatabase => mysql
- qaUrlPattern => 127.0.0.1
- qaBeanstalk => beanstalkd(如果需要)
注意:如果您在覆盖率验收方面遇到一些麻烦,请在 branding-api 项目的设置中报告以检查 suites.yml 上的设置覆盖率
在包设置(用于部署管道)中
Phing 目标
- clean-build
附加组件
版本 >= V4.2.0
前端执行
如果您的项目 > 前端/后端在同一个存储库中,您可以使用此目标自动构建到您的后端构建中,而无需基础设施的操作。
在您的设置 ini 中,您必须添加
#Front settings
front.git.url=@github.com/[YOUR FRONTEND PROJECT].git
front.git.version=v1.0.0 #Frontend version you would like to build
front.workingdir=build #Folder where you build your front
front.config.path=src/resources #Path for your config file
local.front.config.path=src/resources/conf
在“包设置”步骤中添加目标
front-setup-config
连接密钥生成
如果您必须将连接插入到项目中,请简单地在以下属性中添加私钥
connect.key.private=[YOUR PRIVATE KEY]