Skip to content

fix: ensure changelog job runs #79

fix: ensure changelog job runs

fix: ensure changelog job runs #79

Workflow file for this run

name: "(Test): Playwright"
on:
pull_request:
types: [labeled, synchronize, opened, reopened]
push:
branches:
- 'core'
- 'pro'
paths-ignore:
- '**.md'
- '**.txt'
- '.gitignore'
- 'docs/**'
workflow_dispatch:
permissions:
contents: write
pull-requests: write
actions: read
concurrency:
group: playwright-${{ github.event_name }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
Playwright:
name: Playwright test on PHP 8.1
runs-on: ubuntu-22.04
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-tests')
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Set up PHP
uses: codesnippetspro/setup-php@v2
with:
php-version: "8.1"
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: 'npm'
- name: Compute dependency hash
id: deps-hash
run: |
set -euo pipefail
# concatenate existing lock files (src/composer.lock and package-lock.json)
tmpfile=$(mktemp)
for f in src/composer.lock package-lock.json; do
if [ -f "$f" ]; then
cat "$f" >> "$tmpfile"
fi
done
if [ -s "$tmpfile" ]; then
deps_hash=$(shasum -a 1 "$tmpfile" | awk '{print $1}' | cut -c1-8)
else
# no lock files found, fall back to short commit sha
deps_hash=$(echo "${GITHUB_SHA:-unknown}" | cut -c1-8)
fi
echo "deps_hash=$deps_hash" >> "$GITHUB_OUTPUT"
- name: Get build cache
id: deps-cache
uses: actions/cache/restore@v4
with:
path: |
node_modules
src/vendor
key: ${{ runner.os }}-deps-${{ steps.deps-hash.outputs.deps_hash }}
restore-keys: |
${{ runner.os }}-deps-
- name: Install workflow dependencies (wp-env, playwright)
if: steps.deps-cache.outputs.cache-hit != 'true'
run: npm run prepare-environment:ci && npm run bundle
- name: Save vendor and node_modules cache
if: steps.deps-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
src/vendor
node_modules
key: ${{ runner.os }}-deps-${{ steps.deps-hash.outputs.deps_hash }}
- name: Start WordPress environment
run: |
npx wp-env start
- name: Activate code-snippets plugin
run: npx wp-env run cli wp plugin activate code-snippets
- name: WordPress debug information
run: |
npx wp-env run cli wp core version
npx wp-env run cli wp --info
- name: Install playwright/test
run: |
npx playwright install chromium
- name: Run Playwright tests
run: npm run test:playwright
- name: Stop WordPress environment
if: always()
run: npx wp-env stop
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-test-results
path: test-results/
if-no-files-found: ignore
retention-days: 2
test-result:
needs: [Playwright]
if: always() && (needs.Playwright.result != 'skipped')
runs-on: ubuntu-22.04
name: Playwright - Test Results
steps:
- name: Test status
run: echo "Test status is - ${{ needs.Playwright.result }}"
- name: Check Playwright status
if: ${{ needs.Playwright.result != 'success' && needs.Playwright.result != 'skipped' }}
run: exit 1