From f6eac5aa3e0994669a1f85e13274646e9f6ae009 Mon Sep 17 00:00:00 2001 From: Paul Bertrand Date: Thu, 18 Jun 2026 13:36:56 +0200 Subject: [PATCH] ci: improve e2e workflow reliability --- .github/workflows/tests.yml | 44 +++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b87fe31..9de793f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -61,6 +61,15 @@ jobs: - name: Install pnpm dependencies run: pnpm install + - name: Restore Playwright browsers cache + id: playwright-cache + uses: actions/cache/restore@v5 + with: + path: ~/.cache/ms-playwright + key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-playwright- + - name: Set WordPress and PHP version override run: | echo '{ @@ -71,8 +80,39 @@ jobs: - name: Start wp-env run: pnpm exec wp-env start - - name: Install Playwright browsers - run: pnpm run tests:install + - name: Verify WordPress login page + run: | + for attempt in {1..10}; do + if curl -fsS http://localhost:8888/wp-login.php | grep -q 'id="user_login"'; then + exit 0 + fi + sleep 3 + done + + curl -fsS http://localhost:8888/wp-login.php || true + exit 1 + + - name: Use Ubuntu archive mirror + run: | + if [ -f /etc/apt/apt-mirrors.txt ]; then + sudo sed -i 's|http://azure.archive.ubuntu.com/ubuntu|http://archive.ubuntu.com/ubuntu|g' /etc/apt/apt-mirrors.txt + fi + if [ -f /etc/apt/sources.list.d/ubuntu.sources ]; then + sudo sed -i 's|http://azure.archive.ubuntu.com/ubuntu|http://archive.ubuntu.com/ubuntu|g' /etc/apt/sources.list.d/ubuntu.sources + fi + sudo apt-get update + + - name: Install Playwright + timeout-minutes: 5 + run: pnpm exec playwright install --with-deps chromium + + - name: Save Playwright browsers cache + if: steps.playwright-cache.outputs.cache-hit != 'true' + uses: actions/cache/save@v5 + continue-on-error: true + with: + path: ~/.cache/ms-playwright + key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }} - name: Run Playwright tests run: pnpm exec playwright test