The PHP test build pipeline automates code checkout, compilation, unit testing, and result recording, with test statistics to minimize manual intervention, improve project transparency, and provide effective logs that assist developers in identifying and resolving issues more efficiently.
Step one: create a new test build pipeline
-
Log on to the Pipeline Flow Service ConsoleCreate pipeline., in the console interface, click the button at the top right.
-
In the pop-up window, select the PHP test build pipeline template and click the Create button.
Step two: configure pipeline source
Add a pipeline source and select the appropriate code project for your needs. For this example, select the sample code source PHP and complete the addition.
Step three: configure test build
-
In the pipeline task node operation interface, click the PHP Metrics static scan or PHP unit test task node. In the pop-up right Edit page, configure the basic parameters.
Parameter
Description
Task name
Enter a name for the custom task.
Build cluster
Select an appropriate default public or private build cluster according to your needs.
Build environment
Select an appropriate build environment according to your needs.
NoteDuring task execution, the pipeline task build environment is assigned for user use. The build environment usage permission belongs to the user, and the task execution script is customized by the user.
Download pipeline source
Select different methods to download the pipeline source according to your needs.
-
On the PHP Metrics static scan task edit page, configure the Task step configuration item and set the relevant parameters for the PHP Metrics static scan task.
Parameter
Description
Step name
Enter a name for the custom step.
Scan command
Set the scan command according to your needs.
Report relative path
Set the relative path address of the report according to your needs.
Red line information
Set the conditions to determine whether this task is successful or failed.
-
On the PHP unit test task edit page, configure the Task step configuration item and set the relevant parameters for the PHP Unit unit test task.
Parameter
Description
Step name
Enter a name for the custom step.
Select PHP version
Select the preset PHP version according to your needs.
Test command
Set the PHP unit test command according to your needs.
Report relative path
Set the relative path address of the output report according to your needs.
Red line information
Set the conditions to determine whether this task is successful or failed.
-
In the pipeline task node operation interface, click the PHP build upload to repository task node. In the pop-up right Edit page, configure parameters, view the Task step configuration item for the PHP build task, and set the appropriate build command according to project needs.
Step four: run and view the target pipeline task
-
In the Flow console interface, under My pipelines, click the run button next to the target pipeline
. Then click the pipeline name to view the task node interface, where you can see the test report and logs.
-
After the pipeline task completes, click Log at the bottom right of the build image task node to view the execution process result log.
-
View the uploaded build output in the artifact repository.