add phpunit xml #2
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] | |
| jobs: | |
| code-style: | |
| name: Code Style (PSR-12) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: "8.4" | |
| tools: php-cs-fixer | |
| - name: Check code style | |
| run: php-cs-fixer fix --dry-run --diff | |
| static-analysis: | |
| name: Static Analysis (PHPStan) | |
| runs-on: ubuntu-latest | |
| needs: code-style | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: "8.4" | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress | |
| - name: Run PHPStan | |
| run: ./vendor/bin/phpstan analyse --no-progress | |
| unit-tests: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| needs: static-analysis | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: "8.4" | |
| coverage: none | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress | |
| - name: Run unit tests | |
| run: ./vendor/bin/pest --exclude-group=integration | |
| integration-tests: | |
| name: Integration Tests | |
| runs-on: ubuntu-latest | |
| needs: unit-tests | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: "8.4" | |
| coverage: none | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress | |
| - name: Start Listmonk | |
| run: docker compose -f docker-compose.test.yml up -d | |
| - name: Wait for Listmonk to be healthy | |
| run: | | |
| echo "Waiting for Listmonk to be healthy..." | |
| timeout 120 bash -c 'until docker inspect --format="{{.State.Health.Status}}" listmonk_php_sdk_test 2>/dev/null | grep -q "healthy"; do sleep 2; done' | |
| echo "Listmonk is healthy!" | |
| - name: Run integration tests | |
| run: ./vendor/bin/pest --group=integration | |
| - name: Stop Listmonk | |
| if: always() | |
| run: docker compose -f docker-compose.test.yml down -v |