chore(deps): Update dependency phpunit/phpunit to v13 #1334
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: CI | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.5' | |
| extensions: dom, mbstring, json | |
| - name: Validate composer.json and composer.lock | |
| run: composer validate --strict | |
| - name: Cache Composer packages | |
| id: composer-cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: vendor | |
| key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-php- | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress | |
| - name: Run test suite | |
| run: composer run lint | |
| test: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.5' | |
| extensions: dom, mbstring, json | |
| - name: Cache Composer packages | |
| id: composer-cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: vendor | |
| key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-php- | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress | |
| - name: Install tools | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y jq curl netcat-traditional | |
| - name: Build Docker images | |
| run: make docker-compose-build | |
| - name: Start Docker containers | |
| run: make docker-compose-up | |
| - name: Wait for services to be ready | |
| run: | | |
| echo "Waiting for services to be ready..." | |
| for i in {1..30}; do | |
| if nc -z localhost 38080 2>/dev/null; then | |
| echo "Write API server port is open!" | |
| break | |
| fi | |
| echo "Waiting for write-api-server... ($i/30)" | |
| sleep 2 | |
| done | |
| for i in {1..30}; do | |
| if nc -z localhost 38082 2>/dev/null; then | |
| echo "Read API server port is open!" | |
| break | |
| fi | |
| echo "Waiting for read-api-server... ($i/30)" | |
| sleep 2 | |
| done | |
| echo "Additional wait for service initialization..." | |
| sleep 10 | |
| - name: Run tests with coverage | |
| run: | | |
| docker compose exec -T app vendor/bin/phpunit --testdox --coverage-text > coverage_output.txt 2>&1 || true | |
| cat coverage_output.txt | |
| - name: Generate coverage report | |
| id: coverage | |
| run: | | |
| COVERAGE_SUMMARY=$(docker compose exec -T app vendor/bin/phpunit --testdox --coverage-text 2>&1 | grep -A 50 "Code Coverage Report:" || echo "Coverage report not found") | |
| echo "summary<<EOF" >> $GITHUB_OUTPUT | |
| echo "$COVERAGE_SUMMARY" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| PERCENTAGE=$(echo "$COVERAGE_SUMMARY" | grep -oP "Lines:\s+\K[\d\.]+(?=%)" | head -1 || echo "0") | |
| echo "percentage=$PERCENTAGE" >> $GITHUB_OUTPUT | |
| echo "Coverage: $PERCENTAGE%" | |
| - name: Comment coverage on PR | |
| if: github.event_name == 'pull_request' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const coverage = '${{ steps.coverage.outputs.percentage }}'; | |
| const summary = `${{ steps.coverage.outputs.summary }}`; | |
| const comment = `## Test Coverage Report | |
| 📊 **Overall Coverage: ${coverage}%** | |
| <details> | |
| \`\`\` | |
| ${summary} | |
| \`\`\` | |
| </details> | |
| `; | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: comment | |
| }); | |
| - name: Show logs on failure | |
| if: failure() | |
| run: | | |
| docker compose logs --tail=100 | |
| e2e: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.5' | |
| extensions: dom, mbstring, json | |
| - name: Cache Composer packages | |
| id: composer-cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: vendor | |
| key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-php- | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress | |
| - name: Install tools | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y jq curl netcat-traditional | |
| - name: Build Docker images | |
| run: make docker-compose-build | |
| - name: Start Docker containers | |
| run: make docker-compose-up | |
| - name: Wait for services to be ready | |
| run: | | |
| echo "Waiting for services to be ready..." | |
| for i in {1..30}; do | |
| if nc -z localhost 38080 2>/dev/null; then | |
| echo "Write API server port is open!" | |
| break | |
| fi | |
| echo "Waiting for write-api-server... ($i/30)" | |
| sleep 2 | |
| done | |
| for i in {1..30}; do | |
| if nc -z localhost 38082 2>/dev/null; then | |
| echo "Read API server port is open!" | |
| break | |
| fi | |
| echo "Waiting for read-api-server... ($i/30)" | |
| sleep 2 | |
| done | |
| echo "Additional wait for service initialization..." | |
| sleep 10 | |
| - name: Run E2E tests | |
| run: | | |
| make verify-group-chat | |
| - name: Show logs on failure | |
| if: failure() | |
| run: | | |
| docker compose logs --tail=100 |