|
| 1 | +name: Browser Tests |
| 2 | + |
| 3 | +defaults: |
| 4 | + run: |
| 5 | + shell: bash |
| 6 | + |
| 7 | +on: |
| 8 | + push: |
| 9 | + paths-ignore: |
| 10 | + - 'src/*/doc/**' |
| 11 | + - 'src/**/*.md' |
| 12 | + - 'ux.symfony.com/**' |
| 13 | + - '.github/workflows/app-tests.yaml' |
| 14 | + - '.github/workflows/unit-tests.yaml' |
| 15 | + pull_request: |
| 16 | + paths-ignore: |
| 17 | + - 'src/*/doc/**' |
| 18 | + - 'src/**/*.md' |
| 19 | + - 'ux.symfony.com/**' |
| 20 | + - '.github/workflows/app-tests.yaml' |
| 21 | + - '.github/workflows/unit-tests.yaml' |
| 22 | + |
| 23 | +concurrency: |
| 24 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 25 | + cancel-in-progress: true |
| 26 | + |
| 27 | +jobs: |
| 28 | + test: |
| 29 | + runs-on: ubuntu-latest |
| 30 | + strategy: |
| 31 | + fail-fast: false |
| 32 | + matrix: |
| 33 | + symfony: ['6.4', '7.3'] |
| 34 | + env: |
| 35 | + SYMFONY_REQUIRE: '${{ matrix.symfony }}.*' |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v4 |
| 38 | + |
| 39 | + - run: npm i -g corepack && corepack enable |
| 40 | + - uses: actions/setup-node@v4 |
| 41 | + with: |
| 42 | + node-version-file: '.nvmrc' |
| 43 | + cache: 'pnpm' |
| 44 | + cache-dependency-path: | |
| 45 | + pnpm-lock.yaml |
| 46 | + package.json |
| 47 | +
|
| 48 | + - name: Install root JS dependencies |
| 49 | + run: pnpm install --frozen-lockfile |
| 50 | + |
| 51 | + - name: Install custom browsers |
| 52 | + run: node ./bin/get_browsers.mjs |
| 53 | + |
| 54 | + - name: Install browsers with Playwright |
| 55 | + run: pnpm exec playwright install firefox ffmpeg |
| 56 | + |
| 57 | + - uses: shivammathur/setup-php@v2 |
| 58 | + with: |
| 59 | + php-version: 8.2 |
| 60 | + tools: symfony-cli, flex |
| 61 | + |
| 62 | + - name: Install root PHP dependencies |
| 63 | + uses: ramsey/composer-install@v3 |
| 64 | + with: |
| 65 | + working-directory: ${{ github.workspace }} |
| 66 | + |
| 67 | + - name: Build root packages |
| 68 | + run: php .github/build-packages.php |
| 69 | + |
| 70 | + - name: Start Docker containers |
| 71 | + run: docker compose up -d --build |
| 72 | + working-directory: test_apps/e2e-app |
| 73 | + |
| 74 | + - name: Configure E2E app |
| 75 | + run: | |
| 76 | + echo 'APP_ENV=prod' >> .env.local |
| 77 | + echo 'APP_DEBUG=0' >> .env.local |
| 78 | + echo 'APP_SECRET=df4c071596e64cc75a349456f2887ae2419ae650' >> .env.local |
| 79 | + working-directory: test_apps/e2e-app |
| 80 | + |
| 81 | + - name: Install E2E PHP dependencies |
| 82 | + uses: ramsey/composer-install@v3 |
| 83 | + with: |
| 84 | + working-directory: test_apps/e2e-app |
| 85 | + dependency-versions: highest |
| 86 | + composer-options: --no-dev |
| 87 | + custom-cache-suffix: symfony-${{ matrix.symfony }} |
| 88 | + |
| 89 | + - name: Prepare E2E app |
| 90 | + run: | |
| 91 | + symfony composer dump-autoload --classmap-authoritative --no-dev |
| 92 | + symfony composer dump-env |
| 93 | + symfony console asset-map:compile |
| 94 | + symfony console ux:icons:warm-cache |
| 95 | + working-directory: test_apps/e2e-app |
| 96 | + |
| 97 | + - name: Start E2E app |
| 98 | + run: symfony serve --daemon |
| 99 | + working-directory: test_apps/e2e-app |
| 100 | + |
| 101 | + - name: Run browser tests |
| 102 | + run: pnpm run test:browser |
| 103 | + id: browser-tests |
| 104 | + |
| 105 | + - uses: actions/upload-artifact@v4 |
| 106 | + if: ${{ always() && steps.browser-tests.conclusion == 'failure' }} |
| 107 | + with: |
| 108 | + name: Playwright report and output (${{ matrix.symfony }}) |
| 109 | + path: | |
| 110 | + src/**/assets/.playwright-report/ |
| 111 | + src/**/assets/.playwright-output/ |
| 112 | + retention-days: 7 |
| 113 | + |
| 114 | + - uses: actions/upload-artifact@v4 |
| 115 | + if: ${{ always() && steps.browser-tests.conclusion == 'failure' }} |
| 116 | + with: |
| 117 | + name: Symfony logs (${{ matrix.symfony }}) |
| 118 | + path: test_apps/e2e-app/var/log/ |
| 119 | + retention-days: 7 |
0 commit comments