build: run E2E tests with the current branch (#27)

* build: run E2E tests with the current branch

* style: apply php style fixes

* build: cache PW browsers in GHA

* build: fix step name

* build: require branch name as argument for e2e setup

* chore: improve the e2e setup file traceability

* chore: improve file comment

* build: pass branch name as argument for e2e setup

* build: attempt to fix PW browser cache in GHA

* build: fix syntax issue with the e2e GHA

* build: also cache php installation for e2e test

* build: attempt to fix PW browsers cache

* build: don't attempt to cache php installation in e2e

it cannot be cached because it is installed in temporary runner directory
This commit is contained in:
Mazen Touati
2025-12-27 01:27:23 +01:00
committed by GitHub
parent 32ef39ef8e
commit 7b4c37d10d
4 changed files with 240 additions and 26 deletions

View File

@@ -13,13 +13,25 @@ jobs:
if: ${{ !env.ACT }}
uses: actions/checkout@v4
- name: Determine branch for E2E setup
id: branch
env:
EVENT_NAME: ${{ github.event_name }}
PR_HEAD: ${{ github.event.pull_request.head.ref }}
run: |
if [ "$EVENT_NAME" = "pull_request" ]; then
echo "branch_name=$PR_HEAD" >> $GITHUB_OUTPUT
else
echo "branch_name=base" >> $GITHUB_OUTPUT
fi
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
- name: Install JS dependencies
run: npm ci
- name: Setup PHP
@@ -37,11 +49,19 @@ jobs:
composer-8.2-L12
composer-8.2
- name: Cache Playwright browsers
uses: actions/cache@v3
with:
path: ~/.cache/ms-playwright
key: playwright-browsers-${{ runner.os }}-v1
restore-keys: |
playwright-browsers-${{ runner.os }}-
- name: Install Playwright Browsers
run: npx playwright install --with-deps
run: npx playwright install
- name: Setup E2E test repo
run: bash tests/E2E/setup.sh
run: bash tests/E2E/setup.sh "${{ steps.branch.outputs.branch_name }}"
- name: Run Playwright tests
run: bash tests/E2E/launch.sh & (sleep 5 && npm run test:e2e)