Optimize for better Windows compatibility #991
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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.1" | |
| dependencies: highest | |
| - 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 | |
| # Windows: Latest PHP only for CI speed | |
| - os: windows-latest | |
| php-version: "8.4" | |
| dependencies: lowest | |
| - os: windows-latest | |
| php-version: "8.4" | |
| dependencies: highest | |
| # macOS: Latest PHP only for CI speed | |
| - os: macos-latest | |
| php-version: "8.4" | |
| dependencies: lowest | |
| - os: macos-latest | |
| php-version: "8.4" | |
| dependencies: highest | |
| services: | |
| redis: | |
| image: redis:7-alpine | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 3 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Redis (Ubuntu) | |
| if: runner.os == 'Linux' | |
| run: | | |
| # Install redis-cli for connection verification | |
| sudo apt-get update -qq | |
| sudo apt-get install -y redis-tools | |
| redis-cli -h localhost -p 6379 ping | |
| - name: Setup Redis (Windows) | |
| if: runner.os == 'Windows' | |
| shell: powershell | |
| run: | | |
| # Quick Redis setup for CI testing | |
| $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 8 | |
| redis/redis-cli.exe ping | |
| - name: Setup Redis (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| # Fast Redis setup for CI | |
| brew install redis | |
| brew services start redis | |
| sleep 5 | |
| redis-cli ping | |
| - 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: redis | |
| - 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 }} | |
| - name: Run PHPUnit tests | |
| run: ./vendor/bin/phpunit --coverage-clover=coverage.xml | |
| - name: Upload coverage report | |
| # Only upload coverage once to avoid duplication | |
| 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 | |
| # Only run demo on one matrix combination to save CI time | |
| if: env.SCRIPT != '' && matrix.os == 'ubuntu-latest' && matrix.php-version == '8.4' && matrix.dependencies == 'highest' | |
| run: | | |
| composer require doctrine/cache:"^1.12" --no-update | |
| composer update ${{ env.COMPOSER_FLAGS }} | |
| php ${{ env.SCRIPT }} |