|
| 1 | +name: Vue App Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + types: [ opened, synchronize, reopened ] |
| 9 | + |
| 10 | +jobs: |
| 11 | + test: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + env: |
| 14 | + APP_URL: "http://127.0.0.1:8000" |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + php: [ 8.3 ] |
| 19 | + laravel: [ 11.* ] |
| 20 | + dependency-version: [ prefer-stable ] |
| 21 | + |
| 22 | + name: "P:${{ matrix.php }}, L:${{ matrix.laravel }}, V: ${{ matrix.dependency-version }}" |
| 23 | + |
| 24 | + steps: |
| 25 | + - name: Checkout Code |
| 26 | + uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - name: Cache Composer Dependencies |
| 29 | + uses: actions/cache@v4 |
| 30 | + with: |
| 31 | + path: ~/.cache/composer |
| 32 | + key: composer-app-vue-${{ matrix.laravel }}-${{ matrix.php }}-${{ hashFiles('apps/vue/composer.json') }} |
| 33 | + |
| 34 | + - name: Setup PHP |
| 35 | + uses: shivammathur/setup-php@v2 |
| 36 | + with: |
| 37 | + php-version: ${{ matrix.php }} |
| 38 | + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick |
| 39 | + |
| 40 | + - name: Setup Node.js |
| 41 | + uses: actions/setup-node@v4 |
| 42 | + with: |
| 43 | + node-version: '20' |
| 44 | + cache: 'npm' |
| 45 | + cache-dependency-path: 'apps/vue/package-lock.json' |
| 46 | + |
| 47 | + - name: Install PHP Dependencies |
| 48 | + working-directory: apps/vue |
| 49 | + run: | |
| 50 | + composer self-update |
| 51 | + composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction |
| 52 | + php artisan --version |
| 53 | +
|
| 54 | + - name: Copy Environment File |
| 55 | + working-directory: apps/vue |
| 56 | + run: | |
| 57 | + cp .env.example .env |
| 58 | + php artisan key:generate |
| 59 | +
|
| 60 | + - name: Install Node Dependencies |
| 61 | + working-directory: apps/vue |
| 62 | + run: npm ci |
| 63 | + |
| 64 | + # Install Rollup's Linux-specific optional dependency explicitly |
| 65 | + # This is needed due to an npm bug with optional dependencies: |
| 66 | + # https://github.com/npm/cli/issues/4828 |
| 67 | + - name: Install Rollup Linux Dependencies |
| 68 | + working-directory: packages/vue |
| 69 | + run: npm install @rollup/rollup-linux-x64-gnu |
| 70 | + |
| 71 | + - name: Install Rollup Linux Dependencies |
| 72 | + working-directory: apps/vue |
| 73 | + run: npm install @rollup/rollup-linux-x64-gnu |
| 74 | + |
| 75 | + - name: Build Assets |
| 76 | + working-directory: apps/vue |
| 77 | + run: npm run build |
| 78 | + |
| 79 | + - name: Install Playwright Browsers |
| 80 | + working-directory: apps/vue |
| 81 | + run: npx playwright install --with-deps |
| 82 | + |
| 83 | + - name: Run Laravel Server |
| 84 | + working-directory: apps/vue |
| 85 | + run: php artisan serve --no-reload & |
| 86 | + |
| 87 | + - name: Run Playwright tests |
| 88 | + working-directory: apps/vue |
| 89 | + run: npx playwright test |
| 90 | + |
| 91 | + - uses: actions/upload-artifact@v4 |
| 92 | + if: ${{ !cancelled() }} |
| 93 | + with: |
| 94 | + name: playwright-report |
| 95 | + path: apps/vue/playwright/reports/ |
| 96 | + retention-days: 30 |
0 commit comments