VOOZH about

URL: https://deepwiki.com/friendsofhyperf/components/11.1-cicd-pipeline

⇱ CI/CD Pipeline | friendsofhyperf/components | DeepWiki


Loading...
Last indexed: 14 February 2026 (15d5ca)
Menu

CI/CD Pipeline

Purpose and Scope

This document describes the continuous integration and continuous deployment (CI/CD) infrastructure for the friendsofhyperf/components monorepo. The pipeline executes automated code quality checks, runs test suites across multiple PHP and Swoole versions, and manages the release process that splits the monorepo into individual component repositories.

For information about the testing infrastructure and test organization, see Testing Infrastructure. For monorepo management and subtree split tooling, see Monorepo Management.


GitHub Actions Workflows

The CI/CD pipeline is implemented using GitHub Actions with two primary workflows: tests.yaml for continuous integration and release.yaml for deployment.

Workflow Triggers

Test Workflow Triggers

The test workflow runs on three types of events:

Trigger TypeConfigurationPurpose
Push eventsAll paths except docs/**, .vscode/**, **.mdRun on code changes
Pull requestsSame path filters as pushValidate contributions
Scheduled runscron: '0 2 * * *'Daily regression testing

Release Workflow Triggers

The release workflow uses manual dispatch with a required tag input parameter (e.g., v3.1.0).

Sources: .github/workflows/tests.yaml3-17 .github/workflows/release.yaml3-9


Test Workflow Architecture


Test Workflow: GitHub Actions Pipeline

The workflow implements a two-stage pipeline with a mandatory code quality gate followed by parallel matrix testing.

Sources: .github/workflows/tests.yaml22-94


Matrix Testing Strategy

The test suite executes across a comprehensive matrix of PHP and Swoole versions to ensure broad compatibility.

Matrix Configuration


Matrix Testing Coverage: PHP and Swoole Version Combinations

ConfigurationValue
PHP versions['8.3', '8.2', '8.1']
Swoole versions['6.1.3', '6.0.2', '5.1.8']
Total combinations9 jobs
Parallelizationmax-parallel: 20
Failure strategyfail-fast: false
Operating systemubuntu-latest

Sources: .github/workflows/tests.yaml54-63 composer.json16-17


Code Quality Checks

The pipeline enforces three levels of code quality validation before tests execute.

PHP-CS-Fixer Validation

The code style check runs on PHP 8.1 and validates:

  1. Root composer.json normalization: Ensures consistent JSON formatting using composer normalize
  2. Component composer.json normalization: Validates all 50+ component composer.json files
  3. PHP code style: Executes php-cs-fixer fix --dry-run --diff --verbose

The PHP-CS-Fixer configuration is managed by the huangdijia/php-coding-standard package.


Sources: .github/workflows/tests.yaml23-49 composer.json44-49 composer.json308-316

PHPStan Static Analysis

PHPStan performs two types of analysis:

Standard Analysis

Analyzes the src directory for type safety, deprecated code usage, and potential runtime errors.


Type Coverage Analysis

Validates type declaration coverage to ensure comprehensive type hints.


Both analyses use PHPStan with the phpstan-deprecation-rules extension.

Sources: .github/workflows/tests.yaml83-86 composer.json306-307 composer.json108-109

Pest Type Coverage

The test suite includes type coverage validation using Pest's type coverage plugin:


This ensures that test code maintains proper type declarations.

Sources: composer.json330 composer.json104-106


Test Execution Infrastructure

Environment Setup

Each test job sets up a complete testing environment:

PHP Extensions Installation

The shivammathur/setup-php@v2 action installs:

  • redis: Redis client support
  • pdo and pdo_mysql: Database connectivity
  • bcmath: Precision mathematics
  • swoole-{version}: Coroutine runtime (version from matrix)

Service Dependencies

The .travis/setup.services.sh script provisions Docker containers:


Swoole Installation (if needed)

The .travis/setup.swoole.sh script handles Swoole installation using PIE (PHP Installer for Extensions) with specific feature flags:


Sources: .github/workflows/tests.yaml70-88 .travis/setup.services.sh3-10 .travis/setup.swoole.sh8-25

Test Execution with Retry

Tests execute using the nick-fields/retry@v3 action for resilience:

ParameterValuePurpose
timeout_minutes10Maximum execution time per attempt
max_attempts2Retry once on failure
commandphp vendor/bin/pest --parallelParallel test execution

The --parallel flag enables concurrent test execution across multiple workers.

Sources: .github/workflows/tests.yaml89-94


Release Workflow

The release workflow automates the process of splitting the monorepo into individual component repositories.


Release Workflow: Subtree Splitting Process

Release Prerequisites

The workflow requires:

  1. Manual trigger: Prevents accidental releases
  2. Tag input: Version tag must be provided (e.g., v3.1.0)
  3. Repository restriction: Only runs on friendsofhyperf/components
  4. SSH private key: Stored in GitHub secret SPLIT_PRIVATE_KEY for pushing to component repositories
  5. Full git history: Uses fetch-depth: 0 to access complete commit history for subtree operations

Release Script Execution

The ./bin/release.sh script handles:

  • Subtree splitting for each component
  • Tagging individual component repositories
  • Pushing tags to remote component repositories

Sources: .github/workflows/release.yaml11-40


Composer Script Definitions

The root composer.json defines automated script commands for development and CI/CD.

Quality Assurance Scripts

ScriptCommandPurpose
analysephpstan analyse --memory-limit=-1Run PHPStan static analysis
analyse:typesphpstan analyze --configuration="phpstan.types.neon.dist" --memory-limit=-1Analyze type coverage
cs-fixphp-cs-fixer fix $1 --verboseFix code style issues
json-fixMultiple commandsNormalize all composer.json files

Testing Scripts

ScriptCommandPurpose
testRuns test:lint, test:unit, test:typesExecute complete test suite
test:lintphp-cs-fixer fix --dry-run --diff --ansiValidate code style
test:unitpestRun unit tests
test:typespest --type-coverageValidate type coverage

Repository Management Scripts

ScriptCommandPurpose
gen:readme./bin/regenerate-readme.shRegenerate README files
repo:pendingMultiple commandsPrepare pending repositories for release

Sources: composer.json305-332


Dependency Requirements for CI/CD

The CI/CD pipeline requires specific development dependencies:

Code Quality Tools


Testing Framework


Hyperf Framework Dependencies

The test matrix requires Hyperf ~3.1.0 components across all 50+ packages, including:

  • hyperf/framework: Core framework
  • hyperf/database: Database abstraction
  • hyperf/redis: Redis client
  • hyperf/amqp: AMQP messaging
  • hyperf/kafka: Kafka client
  • hyperf/testing: Test utilities

Sources: composer.json44-118


CI/CD Pipeline Flow


Complete CI/CD Pipeline Flow

The pipeline implements a strict quality gate pattern where code style validation must pass before any tests execute. The fail-fast is disabled in the matrix (fail-fast: false), allowing all combinations to complete even if one fails, providing comprehensive feedback.

Sources: .github/workflows/tests.yaml1-94 .github/workflows/release.yaml1-40


Environment Variables and Configuration

Workflow Environment Variables

VariableValueScopePurpose
PHP_CS_FIXER_IGNORE_ENV1GlobalBypass environment checks in PHP-CS-Fixer
SW_VERSIONMatrix valuePer-jobSwoole version for installation
PHP_VERSIONMatrix valuePer-jobPHP version identifier
SSH_PRIVATE_KEYGitHub secretRelease workflowSSH key for component repo access

CI-Specific Configuration

The test workflow modifies Swoole configuration for CI:


Sources: .github/workflows/tests.yaml19-20 .github/workflows/tests.yaml64-66 .github/workflows/release.yaml16-17 .travis/setup.swoole.sh29