Skip to content

Chore: Consolidate CI workflows and harden test infra #7

Chore: Consolidate CI workflows and harden test infra

Chore: Consolidate CI workflows and harden test infra #7

Workflow file for this run

name: CI
on:
pull_request:
push:
branches: [master, "*.x"]
jobs:
format:
name: Checks / Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Pint
run: |
docker run --rm -v "$PWD":/app -w /app composer:2.7 sh -c \
"composer install --profile --ignore-platform-reqs --no-interaction && composer format:check"
analyze:
name: Checks / Analyze
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: swoole
coverage: none
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ hashFiles('composer.lock') }}
restore-keys: composer-
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-interaction --ignore-platform-req=ext-opentelemetry
- name: PHPStan
run: composer analyze
unit:
name: Tests / Unit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: swoole
coverage: none
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ hashFiles('composer.lock') }}
restore-keys: composer-
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-interaction --ignore-platform-req=ext-opentelemetry
- name: Run unit tests
run: vendor/bin/phpunit --configuration phpunit.xml --testsuite unit
e2e:
name: Tests / E2E / ${{ matrix.adapter.display }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
adapter:
- { id: fpm, display: FPM }
- { id: swoole, display: Swoole }
steps:
- uses: actions/checkout@v4
- name: Build and wait for ${{ matrix.adapter.id }} to be healthy
run: docker compose up -d --build --wait ${{ matrix.adapter.id }}
- name: Run E2E tests
run: docker compose exec -T ${{ matrix.adapter.id }} vendor/bin/phpunit --configuration phpunit.xml --testsuite e2e-${{ matrix.adapter.id }}
- name: Dump container logs on failure
if: failure()
run: docker compose logs ${{ matrix.adapter.id }}
benchmark:
name: Benchmark
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run phpbench
run: |
docker run --rm -v "$PWD":/app -w /app composer:2.7 sh -c \
"composer install --profile --ignore-platform-reqs --no-interaction && git config --global --add safe.directory /app && composer bench -- --progress=plain"