|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + pull_request: |
| 7 | + branches: [ main ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + tests: |
| 11 | + name: PHP ${{ matrix.php }} / Symfony ${{ matrix.symfony }} |
| 12 | + runs-on: ubuntu-latest |
| 13 | + |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + php: ['8.3', '8.4'] |
| 17 | + symfony: ['7.0', '8.0'] |
| 18 | + exclude: |
| 19 | + - php: '8.3' |
| 20 | + symfony: '8.0' # Symfony 8.0 requires PHP 8.4+ |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: Checkout code |
| 24 | + uses: actions/checkout@v4 |
| 25 | + |
| 26 | + - name: Setup PHP |
| 27 | + uses: shivammathur/setup-php@v2 |
| 28 | + with: |
| 29 | + php-version: ${{ matrix.php }} |
| 30 | + coverage: pcov |
| 31 | + |
| 32 | + - name: Setup Node.js |
| 33 | + uses: actions/setup-node@v4 |
| 34 | + with: |
| 35 | + node-version: '20' |
| 36 | + cache: 'npm' |
| 37 | + |
| 38 | + - name: Install Playwright |
| 39 | + run: | |
| 40 | + npm install -g playwright@latest |
| 41 | + playwright install chromium --with-deps |
| 42 | +
|
| 43 | + - name: Get composer cache directory |
| 44 | + id: composer-cache |
| 45 | + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT |
| 46 | + |
| 47 | + - name: Cache composer dependencies |
| 48 | + uses: actions/cache@v3 |
| 49 | + with: |
| 50 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 51 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 52 | + restore-keys: ${{ runner.os }}-composer- |
| 53 | + |
| 54 | + - name: Install dependencies |
| 55 | + run: composer install --no-progress --prefer-dist --optimize-autoloader |
| 56 | + env: |
| 57 | + SYMFONY_REQUIRE: ${{ matrix.symfony }}.* |
| 58 | + |
| 59 | + - name: Install app dependencies |
| 60 | + run: | |
| 61 | + cd app |
| 62 | + composer install --no-progress --prefer-dist --optimize-autoloader |
| 63 | +
|
| 64 | + - name: Run code style check |
| 65 | + run: composer cs-check |
| 66 | + |
| 67 | +# - name: Run PHPStan |
| 68 | +# run: vendor/bin/phpstan analyse --no-progress |
| 69 | + |
| 70 | + - name: Debug Playwright setup |
| 71 | + run: php bin/console debug:playwright || true |
| 72 | + |
| 73 | + - name: Run unit tests |
| 74 | + run: composer test |
| 75 | + env: |
| 76 | + PLAYWRIGHT_HEADLESS: true |
| 77 | + |
| 78 | + - name: Run E2E tests |
| 79 | + run: | |
| 80 | + cd app |
| 81 | + vendor/bin/phpunit |
| 82 | + env: |
| 83 | + PLAYWRIGHT_HEADLESS: true |
| 84 | + |
| 85 | + - name: Generate test coverage |
| 86 | + run: composer test-coverage |
| 87 | + env: |
| 88 | + PLAYWRIGHT_HEADLESS: true |
| 89 | + |
| 90 | + code-quality: |
| 91 | + name: Code Quality |
| 92 | + runs-on: ubuntu-latest |
| 93 | + |
| 94 | + steps: |
| 95 | + - name: Checkout code |
| 96 | + uses: actions/checkout@v4 |
| 97 | + |
| 98 | + - name: Setup PHP |
| 99 | + uses: shivammathur/setup-php@v2 |
| 100 | + with: |
| 101 | + php-version: '8.3' |
| 102 | + |
| 103 | + - name: Install dependencies |
| 104 | + run: composer install --no-progress --prefer-dist --optimize-autoloader |
| 105 | + |
| 106 | + - name: Run PHP CS Fixer (dry run) |
| 107 | + run: composer cs-check |
| 108 | + |
| 109 | + - name: Run PHPStan |
| 110 | + run: vendor/bin/phpstan analyse --no-progress |
| 111 | + |
| 112 | + bundle-test: |
| 113 | + name: Bundle Integration Test |
| 114 | + runs-on: ubuntu-latest |
| 115 | + |
| 116 | + steps: |
| 117 | + - name: Checkout code |
| 118 | + uses: actions/checkout@v4 |
| 119 | + |
| 120 | + - name: Setup PHP |
| 121 | + uses: shivammathur/setup-php@v2 |
| 122 | + with: |
| 123 | + php-version: '8.3' |
| 124 | + extensions: mbstring, xml, ctype, iconv, intl |
| 125 | + |
| 126 | + - name: Setup Node.js |
| 127 | + uses: actions/setup-node@v4 |
| 128 | + with: |
| 129 | + node-version: '18' |
| 130 | + |
| 131 | + - name: Install Playwright |
| 132 | + run: | |
| 133 | + npm install -g playwright@latest |
| 134 | + playwright install chromium --with-deps |
| 135 | +
|
| 136 | + - name: Create test Symfony app |
| 137 | + run: | |
| 138 | + composer create-project symfony/skeleton bundle-test |
| 139 | + cd bundle-test |
| 140 | + composer require --dev phpunit/phpunit |
| 141 | + |
| 142 | + - name: Add bundle to test app |
| 143 | + run: | |
| 144 | + cd bundle-test |
| 145 | + echo '{ |
| 146 | + "repositories": [ |
| 147 | + { |
| 148 | + "type": "path", |
| 149 | + "url": "..", |
| 150 | + "options": {"symlink": false} |
| 151 | + } |
| 152 | + ] |
| 153 | + }' > composer.local.json |
| 154 | + composer require playwright-php/playwright-symfony:* |
| 155 | + |
| 156 | + - name: Test bundle integration |
| 157 | + run: | |
| 158 | + cd bundle-test |
| 159 | + php bin/console debug:playwright |
| 160 | + php bin/console debug:container | grep -i playwright |
0 commit comments