Debug driver test on CI (#1) #9
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: [ "*" ] | |
| pull_request: | |
| branches: [ "*" ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| cs: | |
| uses: playwright-php/.github/.github/workflows/CS.yml@main | |
| # with: | |
| # php-version: '8.4' | |
| # composer-validate: true | |
| # php-cs-fixer-args: '--diff --dry-run' | |
| sa: | |
| uses: playwright-php/.github/.github/workflows/SA.yml@main | |
| # with: | |
| # php-version: '8.4' | |
| # phpstan-args: 'analyse --no-progress --memory-limit=-1' | |
| tests: | |
| name: Tests (PHP ${{ matrix.php }} • ${{ matrix.browser }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: [ | |
| #'8.2', | |
| '8.3', | |
| '8.4' | |
| ] | |
| browser: [ | |
| 'chromium', | |
| # 'firefox', | |
| # 'webkit' | |
| ] | |
| env: | |
| PLAYWRIGHT_BROWSER: ${{ matrix.browser }} | |
| PLAYWRIGHT_HEADLESS: '1' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: PHP ${{ matrix.php }} | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| coverage: none | |
| tools: composer | |
| - name: Composer cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.composer/cache | |
| key: composer-${{ runner.os }}-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: composer-${{ runner.os }}- | |
| - name: Install PHP deps | |
| run: composer install --no-interaction --prefer-dist --no-progress | |
| - name: Node.js (for Playwright browsers) | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Cache Playwright browsers | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: ms-playwright-${{ runner.os }}-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: ms-playwright-${{ runner.os }}- | |
| - name: Install Playwright (browsers + system deps) | |
| run: vendor/bin/playwright-install --with-deps | |
| - name: Start Mink test server | |
| run: vendor/bin/mink-test-server > mink-test-server.log 2>&1 & | |
| shell: bash | |
| - name: Output server log (debug) | |
| run: tail -n +50 mink-test-server.log || true | |
| if: failure() | |
| - name: Check Mink test server process | |
| run: | | |
| sleep 2 | |
| pgrep -af 'php.*8002' || (echo "No PHP server running on 8002" && exit 1) | |
| netstat -tlnp || true | |
| shell: bash | |
| - name: Wait for Mink test server to be ready | |
| run: | | |
| for i in {1..60}; do | |
| if curl -fsS http://127.0.0.1:8002/ >/dev/null || curl -fsS http://localhost:8002/ >/dev/null; then | |
| echo "Mink test server is up"; exit 0; | |
| fi | |
| sleep 1; | |
| done | |
| echo "Mink test server did not become ready in time"; exit 1 | |
| shell: bash | |
| - name: PHPUnit (Mink driver testsuite) | |
| run: vendor/bin/phpunit --colors=always | |
| - name: Show Mink server log on failure | |
| if: failure() | |
| run: | | |
| echo "==== mink-test-server.log ====" | |
| tail -n +1 mink-test-server.log || true | |
| - name: Upload Mink server log artifact | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mink-test-server-log-${{ matrix.php }}-${{ matrix.browser }} | |
| path: mink-test-server.log | |
| if-no-files-found: ignore |