Skip to content

refactor: Remove legacy annotation docblock from FakeAnnotation #1204

refactor: Remove legacy annotation docblock from FakeAnnotation

refactor: Remove legacy annotation docblock from FakeAnnotation #1204

name: Continuous Integration
on:
push:
paths-ignore:
- '**/*.md'
- '**/*.txt'
- 'LICENSE'
pull_request:
paths-ignore:
- '**/*.md'
- '**/*.txt'
- 'LICENSE'
workflow_dispatch:
env:
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist"
SCRIPT: "demo/run.php"
jobs:
phpunit:
name: PHPUnit (${{ matrix.os }} - PHP ${{ matrix.php-version }} - ${{ matrix.dependencies }})
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
# Ubuntu: Test all PHP versions
- os: ubuntu-latest
php-version: "8.2"
dependencies: lowest
- os: ubuntu-latest
php-version: "8.2"
dependencies: highest
- os: ubuntu-latest
php-version: "8.3"
dependencies: lowest
- os: ubuntu-latest
php-version: "8.3"
dependencies: highest
- os: ubuntu-latest
php-version: "8.4"
dependencies: lowest
- os: ubuntu-latest
php-version: "8.4"
dependencies: highest
- os: ubuntu-latest
php-version: "8.5"
dependencies: lowest
- os: ubuntu-latest
php-version: "8.5"
dependencies: highest
# Windows: Latest PHP only for CI speed
- os: windows-latest
php-version: "8.5"
dependencies: lowest
- os: windows-latest
php-version: "8.5"
dependencies: highest
# macOS: Latest PHP only for CI speed
- os: macos-latest
php-version: "8.5"
dependencies: lowest
- os: macos-latest
php-version: "8.5"
dependencies: highest
steps:
- name: Checkout repository
uses: actions/checkout@v4
# --- Redis Setup (All Platforms) ---
- name: Setup Redis (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update -qq
sudo apt-get install -y redis-server redis-tools
sudo systemctl start redis-server
redis-cli ping
- name: Setup Redis (Windows)
if: runner.os == 'Windows'
shell: powershell
run: |
$ProgressPreference = "SilentlyContinue"
Invoke-WebRequest -Uri "https://github.com/microsoftarchive/redis/releases/download/win-3.0.504/Redis-x64-3.0.504.zip" -OutFile "redis.zip"
Expand-Archive "redis.zip" -DestinationPath "redis"
Start-Process -FilePath "redis/redis-server.exe" -WindowStyle Hidden
Start-Sleep -Seconds 10
redis/redis-cli.exe ping
- name: Setup Redis (macOS)
if: runner.os == 'macOS'
run: |
brew install redis
brew services start redis
sleep 8
redis-cli ping
# --- Memcached Setup (All Platforms) ---
- name: Install Memcached (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get install -y memcached
sudo systemctl start memcached
- name: Install Memcached (macOS)
if: runner.os == 'macOS'
run: |
brew install memcached
brew services start memcached
sleep 5
- name: Install Memcached (Windows)
if: runner.os == 'Windows'
shell: powershell
run: |
# 1. Download the community-provided binary using curl to handle redirects.
$url = "https://github.com/jefyt/memcached-windows/releases/download/1.6.8_mingw/memcached-1.6.8-win64-mingw.zip"
$zipFile = "memcached.zip"
Write-Host "Downloading Memcached from $url..."
curl.exe -L -o $zipFile $url
# 2. Extract the archive.
$extractDir = "memcached_files"
Write-Host "Extracting $zipFile to $extractDir..."
Expand-Archive -Path $zipFile -DestinationPath $extractDir
# 3. Start Memcached as a background process.
# The service installation method (-d install) is not suitable for CI environments
# as it requires administrative privileges, which are not available by default.
$execPath = Join-Path -Path $extractDir -ChildPath "memcached-1.6.8-win64-mingw\bin\memcached.exe"
Write-Host "Starting Memcached directly as a background process from $execPath"
Start-Process -FilePath $execPath -ArgumentList "-m 64" -WindowStyle Hidden
# 4. Verify that the process started and is listening on the port.
Start-Sleep -Seconds 5
Write-Host "Verifying process and port..."
$process = Get-Process -Name "memcached" -ErrorAction SilentlyContinue
if ($null -eq $process) {
Write-Error "FATAL: Memcached process did not start!"
exit 1
}
$portCheck = netstat -an | findstr "11211"
if (-not $portCheck) {
Write-Error "FATAL: Port 11211 is not listening!"
exit 1
}
Write-Host "SUCCESS: Memcached is running as a process and listening on port 11211."
# --- PHP and Dependencies Setup ---
- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: pcov
ini-values: zend.assertions=1
tools: composer
extensions: ${{ matrix.php-version != '8.5' && 'redis, memcached' || '' }}
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ~/.composer/cache
key: ${{ runner.os }}-php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php-version }}-composer-
- name: Install dependencies
run: |
composer config platform --unset
composer update ${{ matrix.dependencies == 'lowest' && '--prefer-lowest' || '' }} ${{ env.COMPOSER_FLAGS }} ${{ matrix.php-version == '8.5' && '--ignore-platform-req=ext-redis --ignore-platform-req=ext-memcached' || '' }}
- name: Run PHPUnit tests
run: ./vendor/bin/phpunit --coverage-clover=coverage.xml
- name: Upload coverage report
if: matrix.os == 'ubuntu-latest' && matrix.php-version == '8.4' && matrix.dependencies == 'highest'
uses: codecov/codecov-action@v4
with:
files: coverage.xml
fail_ci_if_error: false
- name: Run demo script
if: env.SCRIPT != '' && matrix.os == 'ubuntu-latest' && matrix.php-version == '8.5' && matrix.dependencies == 'highest'
run: |
composer require doctrine/cache:"^1.12" --no-update
composer update ${{ env.COMPOSER_FLAGS }}
php ${{ env.SCRIPT }}