Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 20 additions & 37 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ concurrency:
cancel-in-progress: true

jobs:
build:
name: Build
runs-on: ubuntu-latest
test:
name: Build and E2E Tests
# Pin to ubuntu-22.04 for Playwright compatibility
# ubuntu-latest (24.04) has library version mismatches with Playwright's WebKit dependencies
runs-on: ubuntu-22.04
permissions:
contents: read

Expand Down Expand Up @@ -85,46 +87,27 @@ jobs:
echo "| custom-status-block.js | $(du -h build/custom-status-block.js | cut -f1) |" >> $GITHUB_STEP_SUMMARY
echo "| calendar-react.js | $(du -h build/calendar-react.js | cut -f1) |" >> $GITHUB_STEP_SUMMARY

- name: Upload build artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: build-artifacts
path: build/
retention-days: 1

test:
name: E2E Tests
# Pin to ubuntu-22.04 for Playwright compatibility
# ubuntu-latest (24.04) has library version mismatches with Playwright's WebKit dependencies
runs-on: ubuntu-22.04
needs: build
permissions:
contents: read

steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

- name: Set up NodeJS 20
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: '20'
cache: npm

- name: Install dependencies
run: npm ci
- name: Resolve Playwright version
id: playwright-version
run: |
version=$(node -p "require('@playwright/test/package.json').version")
echo "version=${version}" >> "$GITHUB_OUTPUT"

- name: Download build artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
- name: Cache Playwright browsers
id: playwright-cache
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
name: build-artifacts
path: build/
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.version }}

- name: Install Playwright browsers and system dependencies
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: npx playwright install --with-deps chromium

- name: Install Playwright system dependencies
if: steps.playwright-cache.outputs.cache-hit == 'true'
run: npx playwright install-deps chromium

- name: Install WordPress with wp-env
run: npm run wp-env start

Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/js-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,19 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Cache ESLint and Jest results
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
.eslintcache
node_modules/.cache/jest
key: js-cache-${{ runner.os }}-${{ hashFiles('package-lock.json', 'jest.config.js', '.eslintrc*', 'eslint.config.*') }}-${{ github.sha }}
restore-keys: |
js-cache-${{ runner.os }}-${{ hashFiles('package-lock.json', 'jest.config.js', '.eslintrc*', 'eslint.config.*') }}-
js-cache-${{ runner.os }}-

- name: Run Lint JS
run: npm run lint-js
run: npm run lint-js -- --cache

- name: Run Jest tests
run: npm run test-jest
11 changes: 10 additions & 1 deletion .github/workflows/php-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,17 @@ jobs:
with:
composer-options: --prefer-dist --no-progress

- name: Cache PHPCS results
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: .phpcs-cache
key: phpcs-${{ runner.os }}-${{ hashFiles('.phpcs.xml.dist', 'composer.json') }}-${{ github.sha }}
restore-keys: |
phpcs-${{ runner.os }}-${{ hashFiles('.phpcs.xml.dist', 'composer.json') }}-
phpcs-${{ runner.os }}-

- name: PHP syntax lint
run: composer lint-ci | cs2pr

- name: PHP coding standards
run: composer cs -- --report=checkstyle | cs2pr
run: composer cs -- --cache=.phpcs-cache --report=checkstyle | cs2pr
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@ dist/
.phpunit.cache/
artifacts/

# Tool caches
.phpcs-cache
.eslintcache

# Local wp-env overrides
.wp-env.override.json
Loading